Archive for August, 2009

Ubuntu 9.10 alpha 5, includes Ext4, GRUB 2

Ubuntu 9.10, codenamed Karmic Koala, is the next major release of the popular Ubuntu Linux distribution. Karmic is scheduled to be released in October, but developers and testers can get an early look by getting the alpha 5 release, which will be available for download next week. Feature freeze and first look at new graphics will mark this version.

The roadmap for Ubuntu 9.10 was announced back in February. CEO Mark Shuttleworth of Canonical explained that some of the main features will include extensive support for cloud computing and further netbook compatibility improvements. During the recent Ubuntu Developer Summit in Barcelona, developers also discussed some other experimental features that are tentatively planned for the Karmic release.

These include support for Android applications, integration of social networking software, improved development tools, next version of Firefox 3.5, and many usability enhancements. Ubuntu also began taking major steps towards reducing boot time since 9.04, so that the developers’ ambitious ten-second startup goal can be achieved in the future version 10.04.

(more…)

How To Create A WordPress Plugin Or Widget

This is a very simple Tutorial to create a Partner Links plugin.

A WordPress plugin is a snippet of code that extends on the functionality of WordPress, which can add to the inner workings such as an SEO extension for example, or it can add visual elements to the site, like a Facebook link. Widgets allow these code segments to be quickly and easily enabled or disabled within predefined areas such in newer themes, like a sidebar.

Prior to WP version 2, modifications and addons had to be hard coded into the source code or the theme. With today’s version and the ability to add plugins, we have a modular system of adding and removing functionality. This also makes upgrades a lot easier.

Here I show you how to create a very simple plugin, then enable it as a widget.

A simple WordPress plugin

Let’s create a new file in plugin inside your wordpress directory. Call it anything you like, I will use myplugin.php. Then we’ll add some code that creates partner links in your sidebar:

<?php
/*
Plugin Name: My Plugin
Plugin URI: http://articles.itecsoftware.com/
Description: Partner Links WordPress Plugin
Author: Peter
Version: 1.0
Author URI: http://articles.itecsoftware.com/
*/

function partnerLinks() {
echo “<h2>Partner Links</h2>”;
}
?>

Code inside /* */ are called comments, and in this case are used by WordPress to display information to the webmaster or whoever installs and configures it. The function partnerLinks will display the title, nothing more at this point. Save the file and you now should have a new plugin visible in the WordPress plugin section.

(more…)

Setup MySQL Replication the easy way

1. Configure the Master

We will need to modify a file called my.cnf, which is the main configuration file for mysql. On most systems it’s located in /etc/ or /etc/mysql/ and it contains all important configuration data.

First, let’s ensure that networking is enabled and mysql listens on all, or at least the client’s IP addresses. We also have to tell mysql what file to write the logs to and from which databases to keep logging, so that the Slave can pick up the changes. And finally we need to assign a unique ID to the Master.

All this info is contained within the following lines in your my.cnf file. Please note that the position of these entries can be spread throughout the file, so you might have to search for each of them.

#skip-networking
# bind-address = xxx.xxx.xxx.xxx (this can be the Slave’s IP address. if you’re not sure, leave it commented out)
log-bin = /var/log/mysql/mydatabase-bin.log
server-id = 1

Restart the server. Then log into mysql and create a user with replication privileges:

GRANT REPLICATION SLAVE ON *.* TO ‘slave_user’@'%’ IDENTIFIED BY ‘<password>’;
FLUSH PRIVILEGES;
USE mydatabase;

The next 3 steps is to lock all tables on the database, take a backup and get the replication sequence ID. We’ll use the backup later on the Slave to establish the baseline, and tell it to start replication starting from the sequence ID.

(more…)

Add Medibuntu Repository for Ubuntu 9.04

Medibuntu is probably the most useful and popular non-included repository, as it contains a lot of codecs for viewing or creating audio and video files. It’s a must have repository for Ubuntu.

  • Acrobat Reader
  • Firmware for the ALSA sound system
  • Google Earth
  • DVD decryption
  • MPlayer / MEncoder
  • Non-free codecs and
  • Skype

and the list goes on. Two simple commands get you up and running:

sudo wget http://www.medibuntu.org/sources.list.d/jaunty.list –output-document=/etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

This adds the Medibuntu as a repository and updates the sources list. You can now install software like additional codecs, utilities and more like this:

sudo apt-get install non-free-codecs libdvdcss2

And you can always use Synaptic to install new software, of course. For a complete list, go here.

Ubuntu run script at startup, shutdown or reboot

What’s the proper method to run a script at startup on Ubuntu?
You can use update-rc.d for start-only or stop-only scripts, following these steps:

Start script called “startup_script” on startup (note the dot at the end of the line) :

# update-rc.d -f startup_script start 99 2 3 4 5 .

- start is the argument given to the command (start, stop).
- 99 is the start priority of the script (1 = first one, 99= last one)
- 2 3 4 5 are the runlevels at which to run the script

The dot at the end of the line has significance, read more here: /etc/rcS.d/README

Start startup_script on shutdown and reboot :
# update-rc.d -f startup_script start 90 0 6 .

Stop startup_script on halt and reboot :
# update-rc.d -f startup_script reboot 90 0 6 .

To run the script as a daemon, use the skeleton file located at “/etc/init.d/skeleton”

To know which runlevel you are running, type:
$ runlevel

Read more about runlevels here.