Setting up a LAMP environment on the Asus EEE

If you fancy using the Asus EEE as a development environment for you web projects then you are in luck. The little machine will quite happily run the entire LAMP stack. LAMP stands for Linux, Apache, PHP and MySQL, which are the operating system, web server, programming language and database components respectively. Being a developer isn't the only reason you might want to install this technology, it also lets you experiment with some interesting software, which I will be exploring in later blog posts.

In addition to the normal LAMP stack, I'll show you how to install two other components that might be useful, the web database front end PHPMyAdmin and the source code control system Subversion, which will allow you to connect to a remote Subversion server, which makes a good backup should anything happen to your EEE. If you haven't got access to a remote Subversion server to back up your source code then have a look here! There is a excellent free online book to help you get started in Subversion (a.k.a. SVN) at:

The LAMP stack is not included in the standard repositories, so you will have to add some more (as we did in an earlier post). Follow the instructions at paying particular attention to the section on 'Pinning'. After doing an apt-get update you will be ready to install the software. We can do all of this at once:

apt-get install subversion libapache2-mod-php5 php5-mysql mysql-server \
phpmyadmin php5-gd

([EDIT] Note the "\" backslash means continue the command - see comments below. You could run this all on one line - then you would miss out the backslash)

Thanks to the built in dependency system, this will give you everything you need. However, we need to make a couple of manual adjustments to make this work properly. Notice we are installing PHP5 and not PHP4, this is because most of the open source community is upgrading to take advantage of the powerful new features of PHP5 have a look at for more information.

So on to our tweaking, the first task is to set a password for the root account on MySQL which is by default blank, so not very secure. You can do this by going to http://localhost/phpmyadmin then selecting 'Privileges'. On the list you will see two entries for root, go ahead and edit their properties to set a password, just don't forget what you set it to! When you were in PHPMyAdmin you might have noticed that the graphics were not working. You may also have noticed that when Apache started up it complained it could not 'could not reliably determine server's fully qualified domain name'. Both of these issues can be fixed by editing the file (as root) /etc/apache2/apache2.conf and adding these two lines to the end:

EnableSendFile Off
ServerName localhost

Now we just need to set up the directory that contains the web files to be accessible by the normal user and to be adaptable to the different web applications you might like to install. A commonly used Apache module is mod_rewrite, this allows applications to change URLS to be more human friendly. To enable it use the command:
sudo a2enmod rewrite

A quick change is needed now to /etc/apache2/sites-available/default and that is to change the line that says AllowOverrides None to AllowOverrides all. This enables applications like Drupal to protect thier system files. The final step to configure the Apache part is to change the web files directory so the normal user can write to it, then you will be able to edit files normally with your favourite text editor. Do this with the command:
sudo chown user /var/www

Restart Apache to get it to pick up the changes:
sudo /etc/init.d/apache2 restart

When you start your computer, Apache and MySQL won't start automatically. This is probably unnecessary and could use up battery life. You can start it with:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/mysql start

Can you guess how would stop it?!

You can always get round having to start each daemon (service) seperately by using a little script, I have this saved to the "bin" directory in my home and it is named "lamp":

# Script to start/stop lamp service
case $1 in
[ -f /var/run/ ] || /etc/init.d/apache2 start
[ -f /var/run/mysqld/ ] || /etc/init.d/mysql start
[ -f /var/run/ ] && /etc/init.d/apache2 stop
[ -f /var/run/mysqld/ ] && /etc/init.d/mysql stop

Change the script to be executable with:
chmod u+x ~/bin/lamp

Now when you want to start the LAMP stack, just type:
sudo ~/bin/lamp start

To stop:
sudo ~/bin/lamp stop

Now you are all set up to try out some PHP and MySQL development!



just to let u know that apt-get install subversion libapache2-mod-php5 php5-mysql mysql-server \
phpmyadmin php5-gd didn't work for me. i had to remove the \ from btw mysql-server and phpmyadmin

The backslash means "continue the command on the next line", so if you type up to and including the "\"  and then press [Return] you will see a ">" prompt, this means you can continue to type in your command for another line. I should have pointed that out really! You can use this to spilt a command over multiple lines to make it more readable as you type it in.

So for an example:

/home/user> echo "You can type the first bit here, \ [Press Return]
> and keep going here" [Press Return]
You can type the first bit here, and keep going here


cheers! argh - new prob. i'm not seeing my php files. i've saved phptest.php to var/www/apache2-default but http://localhost/phptest.php throws back a 404. i can see index.html fine

in etc/php5/apache2 should i edit the php.ini file from

doc_root =


doc_root = var/www/apache2-default (or just var/www) ??

man, i'm such a newbie at this!

Don't worry! No reconfigration is needed. A slightly confusing situation exists regarding the default document (i.e. what you get when you type only the server name, e.g. http://localhost/). To make a file appear at the URL: http://localhost/phptest.php you would put the file under /var/www/phptest.php.

Now you might be asking - what's going on with the apache2-default directory? Well this comes into play for situations where the default document is requested. If you have a look at the file /etc/apache2/sites-available/default, you will see a line that says:

RedirectMatch ^/$ /apache2-default/

What this means is that if the user requests the default document then go off and look in the apache2-default directory, otherwise proceed normally.

fantastic - that's done the trick! i think i might be able to sleep tonight now :)

After a successful installation of lamp: how can I now install other php extensions as gd? Other question: what is the purpose of the "~" before /bin/lamp start
Thank you very much for your tutorial. I have bought the eee for my 6 year son but now I will buy another for me!

Hi Christophe,

The tilde '~' means your home directory (i.e. /home/user), it is a bit of Linux shorthand, so ~/bin/lamp start is the same as /home/user/bin/lamp start. A handy shortcut!

A good way to get the php extensions (or any other bit of software) is to search the repositories. To get the GD library for PHP you would need to first locate the right package to install, for this you use the apt-cache search command:
apt-cache search php5 gd

In this case you will only see one result for your search, a packages named php5-gd, but in other cases you might get more than one. To find out more about a package use the apt-cache show command:
apt-cache show php5-gd

This will tell you all sorts of information about the package, including what other packages it relies on and a description of the package so you can make sure you have found the right one. Notice you don't have to run the apt-cache command using sudo. When you are happy that you have found the right one you can install it with:
sudo apt-get install php5-gd

Hope this helps!

Thank you very much.I would also like now to understand the way the command 'apt-cache search php5 gd' can find a package. Is the Advanced Packaging Tool a sofware on a server or on my eee? If it is on a distant server, how and where this command is transformed to a hyperlink? I now, I have to study linux (and I will do this) but for the moment, I would be grateful to have a little light in my dark ignorance. Christophe

Hi Christophe,

The apt system gets its data from a servers known as repositories. Each of these repositories contains a list of available packages. Packages can depend on other packages from completely different repositories making the system very powerful as it is aware of software installed on the system regardless of the resource. When you do a apt-get update command, your computer will download these lists of packages into an internal database, so when you issue a command like apt-cache search php5-gd it looks in this database to find the site it should download the package from, and when you come to install it the database is used to work out the locations of any packages that it might depend on.

Probably the most complete reference to APT is available on the Debian site at:

Hope this helps!

When I ent to http://localhost/phpmyadmin it anted me to sign in.
I cant get inside to set the password like this. Thanks a lot.

When you first install MySQL, the default password is blank, so in the PHPMyAdmin screen enter root for the user and make sure the password box has nothing in it. You should then get past the sign in page.

Nice tuto, thanks !

I didnt' get "sudo chmod /var/www user" to work : did you mean "chown -R user.user /var/www" ???

And, if you want your LAMP service to start along with the computer, see : "" : quite interesting !

Sorry for my English (I'm French !!!)


Hi JP!

Whoops,Foot in mouth I made an error on that line, it should read:

sudo chown user /var/www 

Have corrected it now in the tutorial.

PS Your English is very good! 


Kudos on such a great and useful site!

I'm thinking of getting the Eee PC portable development server and would love to know how to get Apache/MySQL to start up automatically.

According to the Xandros forums, you can go to Control Center -> System Administration -> Services, and set Apache from 'Manual' to 'System Startup'; Is this control center available on the Eee PC? Will the same procedure work for MySQL, or is there another way entirely?

Thanks Felipe!

Haven't tried to get this to automatically start myself, but looks there is an article at: which describes a method. For the services you would enter "mysql" and "apache2". Let me know how you get on.

Hi - thanks for the guide.

I'm having a slight problem with php - when I try to access phpmyadmin, or any other php file under /var/www/, the browser attempts to download the php file, rather than serving it as normal. Do I need to do something to properly enable PHP? (Googling around suggests any number of possible ways to do this, and I'm not sure how to proceed - I tried adding AddType application/x-httpd-php .php
to my httpd.conf, but to no avail...)

Hi Jack,

There is some information here that might help you: this is for Ubuntu but it should work in the same way on the EEE. Try this:
sudo apt-get install --reinstall libapache2-mod-php5
sudo a2enmod php5
sudo /etc/init.d/apache2 restart

Then you should clear the cache of your browser before attempting to reload the page.
Hope this helps.

wow! nice article. thanks for sharing

This is a great tutorial, thank you very much. I never understood how to do this properly and with your help I can venture further into new realms so thanks again.

Nice article. The only downside here is the processor. I tried this as a dev box for my Wordpress server but the machine was a little slow. If you can live with that, cool - go for it :)


I would like to install LAMP on my Eee PC with the original OS and I followed the instructions I found on WIKI, but when I tried to get Apache I got a 404 error for the!

Can you help me?


Thank you for that tutorial but..
The eeeuser site is no longer functional and I cannot find any repository containing the necessary packages to install lamp. After so long, would you think I could find some link to dowload the files I need? Thank you. Regards