Installing Lighttpd + MySQL + PHP + Perl on Ubuntu 8.04 LTS

I just signed up a VPS plan from Linode. It is called Linode 360, which provides 360M memory, 10G storage, 200G transfer per month, and more importantly, an affordable price. Please remember, if you are in Australia, choose the data center at Fremont CA because it can give a decent ping value around 192 ms, which is better than most hosting companies in America. I plan to move my previous blog to this VPS server, but some necessary environments need to be built up first. This article is mainly about how to setup Lighttpd, MySQL, PHP, and Perl on Ubuntu 8.04 LTS. They are necessary for WordPress or Movable Type blogging systems.

Step 1: Create a new user in Ubuntu 8.04, with sudo privilege.
After Ubuntu 8.04 is deployed, we should create a new user with sudo privilege to perform most common tasks. If you have created one, you can ignore this step.

> adduser xxx

Edit the sudoer’s file:

> visudo

Add “xxx ALL = (ALL) ALL” at the end of the file. Then re-login the system with xxx.

Step 2: Update the system and Install the basic tools.

> sudo aptitude update -y
/> sudo locale-gen en_GB.UTF-8
/> sudo /usr/sbin/update-locale LANG=en_GB.UTF-8
/> sudo aptitude install build-essential -y

Step 3: Install Lighttpd, MySQL, PHP

> sudo aptitude install lighttpd
/> sudo aptitude install mysql-server
/> sudo aptitude install php5-cli php5-cgi php5-mysql php5-xcache

Step 4: Configure php.ini and lighttpd.conf

> sudo vim /etc/php5/cgi/php.ini

Add “cgi.fix_pathinfo=1″ at the end of file php.ini.

>sudo vim /etc/lighttpd/lighttpd.conf

Find the codes like below and add  “mod_fastcig” and “mod_cgi” modules:

server.modules = (
“mod_access”,
“mod_alias”,
“mod_accesslog”,
mod_fastcgi“,
“mod_rewrite”,
mod_cgi“,
)

Add the following codes at the end of lighttpd.conf:

fastcgi.server = (“.php” => ((
“bin-path” => “/usr/bin/php5-cgi”,
“socket” => “/tmp/php.socket”
)))
cgi.assign = (
“.pl” => “/usr/bin/perl”,
“.cgi” => “/usr/bin/perl”
)

Step 5: Restart Lighttpd

>/etc/init.d/lighttpd restart

After the steps above, the necessary environments have been built up. It is enough to install WordPress or Movable Type.

from http://lua.me/2008/05/installing-lighttpd-mysql-php-perl.html

Leave a Reply