« Posts under Ubuntu

Converting a RPM package to Deb package

Deb packages are the Debian / Ubuntu equivalent of a Windows MSI file. They package up the required files for a application and provide a convenient way to distribute and install it.

However some more generic applications that work across many distributions, especially Red Hat Linux, come in a RPM file. RPM files are not natively able to run under a Debian version of Linux like Ubuntu. These means that you need some way of running it under Ubuntu. Enter Alien!

Alien is a piece of free open source software that allows you to convert RPM, SLP, TGZ, and PKG file formats to Deb (and also to one another but if you’re using Ubuntu then you want *.deb).

To install Alien you have (as you do most of the time) two choices. Either use the Synaptic Package Manager (SPM) or the Command Line Interface (CLI). At the time of posting the latest version in the repositories is 8.73.

To install via SPM search for the term alien and it should be the third option. Right click alien and select Mark for installation and then click Apply

To install via CLI, fire up the terminal and use the command sudo apt-get install alien type in your root password when prompted and let Ubuntu sort out the rest.

Once it’s installed fire up the Terminal (if you haven’t already to install Alien) and enter the command sudo alien -d name_of_package.rpm This will convert the RPM file to a Deb file. If you use the -i switch so sudo alient -d -i name_of_package.rpm it will generate and install the Deb package.

There other options that can be activated using other switches, these can be found using
alien --help

How to install Apache, MySQL, and PHP (LAMP) on Ubuntu

This is a HOW TO guide to installing LAMP (Linux Apache MySQL PHP). This consists of Apache web server, MySQL database (as well as a DB tool), and PHP. Together these can be used to run as a local web server on your computer, using Ubuntu distribution of Linux. This is similar to WAMP, which is the Windows version.

The idea of this HOW TO is to explain how to get these working together, with little to no use of the Terminal Command Line, but I will give the command line interface (from now on I will call this CLI) as well as they do make life a little faster. For this we will be using the “Synaptic Package Manager” (from now on I will call this SPM) which can be found on Ubuntu in System -> Administration -> Synaptic Package Manager.

So first up we need to install the Apache Web Server. Type the following into the SPM Quick Search box:

apache2

If you add a space after it will be the first result returned, without and it will be the third. For all SPM options make sure you mark them for The command line alternative is (it assumes that you are running as a sudo user, this is the same for all CLI alternatives written here):

sudo apt-get install apache2

To check if this works, click http://localhost, which points to your new local web server. If the words “It works!” appear then everything is on track!

With Apache installed, we now want to install PHP. For this use either SPM and search for:

php5 and libapache2-mod-php5

Or using the CLI: sudo apt-get install php 5 libapache2-mod-php5

Next we need to restart the Apache server so it loads PHP. To do this without the CLI you need to use “Run Application…”, this can be found by right clicking one of the task-bars and and adding the “Run Application..” to the task bar panel. Once this is done type the following command:

gksudo /etc/init.d/apache2 restart Note: This will prompt for your password

Or using the CLI: sudo /etc/init.d/apache2 restart

Now you need to check that PHP is installed correctly. We need to create a small PHP file in the Web Servers directory that displays the PHP info. To do this we are going to run the following command under “Run Application…”:

gksudo gedit /var/www/testphp.php

Or using the CLI: sudo gedit /var/www/testphp.php

Once GEdit is open add the following line and save the file: phpinfo(); inside opening and closing PHP tags

Now check that this has worked by clicking : http://localhost/testphp.php

This should display all the information about the PHP configuration that’s just been installed. Now we move on to the last part which is to install the MySQL server. Using the SPM find and install:

mysql-server

Or using the CLI: sudo apt-get install mysql-server

This will run the MySQL set-up which will at some point prompt you for a root password. This is for root login to your MySQL server, and you’ll need to enter it twice.

After MySQL has been set-up there are two more packages that you need, the first is MySQL libraries for PHP 5, and the second is for Apache to use MySQL.

php5-mysql and libapache2-mod-auth-mysql

Or using the CLI: sudo apt-get install libapache2-mod-auth-mysql php5-mysql

Once these have been installed you need to tell PHP about the MySQL extension by editing the php configuration file. This can be done using “Run Application..” using:

gksudo gedit /etc/php5/apache2/php.ini

In this file you need to find the line that says ; extension=msql.so, remove the ; from the begining of the line, save and close the file.

That’s it, Apache, PHP & MySQL are all installed and set-up. However there is one more stage that might be of use. That is to install Navicat, which allows easy administration to a MySQL Database. First head to the Navicat Download Page and get the appropriate version. I use the Lite (non-commercial) version.

Once your downloaded the tar ball, extract it to where ever you want Navicat to be installed. To run it create a shortcut to the start_navicat file.

Ubuntu How To: Eclipse 3.2 running slowly

This is an issue that I ran into when first using Ubuntu & Eclipse 3.2…

Eclipse 3.2 (Europa) can be found in the the Ubuntu repositories, using the package manager. Once it’s installed fire it up.

What I noticed was that Eclipse booted really slowly, and when using it some operations like opening a file to edit it lagged a fair bit. I did a little research and it turns out that this happens when Eclipse is using a non-Sun JRE.

So I needed to install the latest Sun JRE (currently Java 6 update 10). This can also be found in the Ubuntu repositories under “sun-java6-jre”. Once thats also installed you can change the default JRE used by Eclipse.

First of all we need to tell Ubuntu to use the Sun JRE so you will need to run the following command from the console

sudo update-alternatives --config java

This will display a list of installed JREs. You want to select (by entering the corresponding number) the JRE labeled:

/usr/lib/jvm/java-6-sun/jre/bin/java

Now you need to tell Eclipse to use the Sun JRE as well. So we need to edit the Eclipse java_home file by entering the following command into the console:

sudo gedit /etc/eclipse/java_home

This will open up a text editor, into which you need to add the following line at the top:

java-6-sun-1.6.0.10

Save the file & viola, your done! Fire up Eclipse and you should notice it is running a lot smoother. The same process applies for Eclipse 3.4 (Ganymede), but if your on a lower end system I would stick using Eclipse 3.2 unless you need plugins that only run on 3.4 (e.g. Scala plugin).

This information was found by searching the Ubuntu Forums

Installing Ubuntu on IBM X40

Last year I was looking for a new small, lightweight laptop that I could use for coding when I was traveling around & didn’t want to carry a big powerful workhorse.

After looking at the new Netbooks that were around for a couple of hundred pounds I decided they might be a bit under powered for what I wanted to use it for. Despite having the small form factor that I needed.

In the end I settled for a IBM Thinkpad X40. I was already given one of these for work and liked the size of the keyboard & screen.

Specs for the X40 are:

  • 1.2 GHz Intel Centrino processor
  • 256 MB RAM (1 x Expansion Slot, so I have 1.25 GB)
  • 12.1″ Screen
  • 40 GB HDD

OK so the processor is slower than the Intel Atom you get in Netbooks, but this takes the edge with much more RAM. When you have a browser, IDE, etc all running a a low RAM system will begin to grind to a halt.

I found one of these on eBay for £150, BARGAIN!! It came pre-installed with Windows XP Pro. However even XP starts to lag when running on a 1.2gig processor & 512mb RAM (this was how i bought it). I had been reading more & more about this magic Linux distribution called Ubuntu which runs fast even if your computer is powered by a hamster in a wheel, and that requires little to no setting up once installed.

I went over to the Ubuntu site here and downloaded the CD ISO, popped it into my drive and fired up my laptop.

Then I just followed the on screen instructions of the installer until it was completed and Ubuntu was ready to use!

You may have noticed that at no time did I say that I formated my hard drive. This is because I didn’t & if you want to use your existing operating system as well Ubuntu then the installer will help you partition your hard drive for each OS without any loss of data. Installing Ubuntu is easier & faster than installing Windows XP.

A lot of applications come pre-installed with Ubuntu, more than enough to do all your normal tasks. I will write some more blogs on other applications that are useful for Ubuntu that aren’t defaultly installed.