How to Install Lighttpd, MySQL, phpMyAdmin and PHP5 on Ubuntu 10.04

1 May

This was written for my own purposes since I was unable to find instructions for installing Lighttpd, MySQL, phpMyAdmin and PHP5 on Ubuntu that worked without error for me. These instructions accomplish that for me. I am sharing what I have learned with the hope that someone, possibly you, finds this useful.

Please note these instructions were written for Ubuntu 10.04 (32-bit) and (64-bit) variants and also tested to work with Ubuntu 9.10 (32-bit) and (64-bit) versions too.

1 : Open Terminal and Become Root

sudo su

2 : Update Repositories

aptitude update

If updates are available install them. If updates are not available skip this.

aptitude safe-upgrade

3 : Install MySQL Server and Client

aptitude install mysql-client mysql-server

Returns:

The following NEW packages will be installed:
libdbd-mysql-perl{a} libdbi-perl{a} libhtml-template-perl{a} libmysqlclient16{a} libnet-daemon-perl{a} libplrpc-perl{a} mysql-client mysql-client-5.1{a} mysql-client-core-5.1{a} mysql-common{a} mysql-server mysql-server-5.1{a} mysql-server-core-5.1{a}

Do you want to continue? [Y/n/?]

Type “Y” without quotes to continue installation of MySQL Server and Client.

At this point the installation of the MySQL Server and Client will pause to gather some information from you. On this screen you will enter and repeat a password for the root “master” MySQL account. Make sure to choose something that is secure, yet memorable enough for you to remember. After this is completed the installation process will continue.

4 : Install LIghttpd and LIghttpd Docs

aptitude install lighttpd lighttpd-docs

Returns :
The following NEW packages will be installed:
libterm-readline-perl-perl{a} lighttpd lighttpd-doc spawn-fcgi{a}

Do you want to continue? [Y/n/?]

Type “Y” without quotes to continue installation of Lighttpd and Lighttpd Docs.

5 : Check Status of LIghttpd

Open web browser and navigate to http://127.0.0.1 or http://127.0.1.1.

Returns:
A placeholder web page for your Lighttpd web server.

6 : Install PHP5

aptitude install php5 php5-cgi php5-common php5-curl php5-gd php5-imagick php5-imap php5-intl php5-ldap php5-librdf php5-mcrypt php5-memcache php5-memcached php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-svn php5-tidy php5-xmlrpc php5-xsl

Returns:
The following NEW packages will be installed:
libapr1{a} libaprutil1{a} libc-client2007e{a} libmcrypt4{a} libmemcached2{a} libming1{a} librecode0{a} libsvn1{a} libt1-5{a} libtidy-0.99-0{a} memcached{a} mlock{a} php5 php5-cgi php5-common php5-curl php5-gd php5-imagick php5-imap php5-intl php5-ldap php5-librdf php5-mcrypt php5-memcache php5-memcached php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-svn php5-tidy php5-xmlrpc php5-xsl pslib1{a}

Do you want to continue? [Y/n/?]

Type “Y” without quotes to continue installation of PHP5.

7 : Enable PHP5 in Lighttpd

gedit /etc/php5/cgi/php.ini

Returns:

Gedit with the file php.ini already loaded.

Use ctrl+h to search for “;cgi.fix_pathinfo=1″ (without quotes) and replace with “cgi.fix_pathinfo=1″ (again, without quotes).

Save file (ctrl+s) and quit (ctrl+q) Gedit.

8 : Enable FastCGI in Lighttpd

lighttpd-enable-mod fastcgi

Reload Lighttpd:

/etc/init.d/lighttpd force-reload

Check Status of Lighttpd, PHP5 and FastCGI:

gedit /var/www/php-info.php

Returns:
Gedit with a blank file named php-info.php.

Insert the following php code:

<?php phpinfo(); ?>

Save file (ctrl+s) and quit (ctrl+q) Gedit.

Open a web browser and navigate to http://127.0.0.1/php-info.php or http://127.0.1.1/php-info.php.

If the page loads, PHP5 is working and if the Server API is listed as CGI/FastCGI, FastCGI is working too.

9 : Install phpMyAdmin

aptitude install phpMyAdmin

Returns:
The following NEW packages will be installed:
dbconfig-common{a} javascript-common{a} libjs-mootools{a} phpmyadmin wwwconfig-common{a}

Do you want to continue? [Y/n/?]

Type “Y” without quotes to continue installation of phpMyAdmin.

The installation of phpMyAdmin will now pause to collect information it needs from you. You will be asked which web server you would like to use phpMyAdmin with. You will want to choose Lighttpd as your web server. After you have chosen Lighttpd the installation process will continue.

Next the installation will again pause to collect more configuration information. This time you will be asked if you would like phpMyAdmin to configure your database using dbconfig-common. The answer to this is negative or “N” because you already completed this when you finished step 3 : Install MySQL Server and Client. So just type “N” to skip this step so the installation process may complete.

Now that the installation of phpMyAdmin is complete you may open a web browser and navigate to http://127.0.0.1/phpMyAdmin or http://127.0.1.1/phpMyAdmin.

Returns :
phpMyAdmin login screen.

Enter “root” (without quotes) as the Username and enter the password that you set in Step 3 : Install MySQL Server and Client.

10 : Return to Normal User Mode

exit

And if you would like to leave Terminal completely you can type one additional “exit” to quit Terminal.

Congratulations, if all went as expected you now have a working Lighttpd, MySQL, phpMyAdmin and PHP5 development environment.

About these ads

3 Responses to “How to Install Lighttpd, MySQL, phpMyAdmin and PHP5 on Ubuntu 10.04”

  1. Jim Siler 26/06/2010 at 16:29 #

    Thanks so much for this great tutorial. I was going crazy trying to get php to work with lighttpd. Now if I could only find something as good for installing pastebin.ca.

  2. Becca 29/09/2010 at 18:17 #

    Aha, now if only I had found this sooner! Thanks for the tutorial, I was thinking of writing one myself.

    I did this setup using HowToForge’s tutorial (http://www.howtoforge.com/installing-lighttpd-with-php5-and-mysql-on-ubuntu-10.04)

    I was also able to get SysCP (http://syscp.com) working to a certain extent, however I’m running into some issues trying to get nameservers/a records with Bind9 working. Any suggestions? Oh and I prefer Chive vs. phpMyAdmin (http://www.chive-project.com/)

    Thanks!

Trackbacks/Pingbacks

  1. difficulty installing lighttpd+php5+fastcgi on Ubuntu 10.04 - 13/05/2010

    [...] Never mind, I got it. I found, and followed, this tutorial. http://amselgrunwald.wordpress.com/2…-ubuntu-10-04/ [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: