Installing LAMP on Ubuntu 12.04 Precise Pangolin

Installing LAMP on Ubuntu 12.04 Precise Pangolin

When working on web development, I prefer to work within the privacy of my own development environment located on my computer. I’d rather make the majority of my mistakes where no one else can see them rather than out in the wild of the Internet. In order to have that private development environment, I install a LAMP configuration. If you’re not familiar with LAMP, it stands for Linux, Apache, MySQL, php (and/or Perl). LAMP is one of the most common web hosting platforms on the Internet, so it’s a great environment to build and test your website. Follow these step by step instructions to install and configure LAMP on Ubuntu

Install LAMP on Ubuntu

The developers at Ubuntu have made it really easy to install and configure the packages for LAMP with a single terminal command. So open up a terminal window and let’s get started.

sudo apt-get install lamp-server^

Yes, you read that right. Don’t leave out the caret (^) at the end. The command won’t work without it. It’s magical!

sudo apt-get install lamp-server^

The apt package manager will now show the packages to be installed and ask for confirmation. Hit <Enter> to confirm and continue with the install.

Install LAMP packages

After some time downloading packages, you will be prompted to set a password for the root user for MySQL.

Set MySQL root password

Enter the password you want to use for MySQL. Do not leave it blank. You’ll be prompted a second time to confirm your password.

Confirm MySQL root password

After confirming your password, apt will continue installing the remaining packages.

Remaining LAMP package installation

Your LAMP installation is now complete. Wow, that was easy! Now there’s just a few more steps to get things configured to make it easy to work with your system.

Test Apache

Open a web browser window and enter the address http://localhost/. You should see a web page that says “It Works!
Apache works

Test php

Now that you’ve confirmed that the Apache web server works, you want to make sure that your php installation is working. To do that you need to create a file in /var/www called testing.php. You can use your favorite text editor as root, or you can use the following terminal command:

echo “” | sudo tee /var/www/testing.php

Go back to your web browser and enter the address http://localhost/testing.php/ and you should see a page displaying information about your php installation.

php information
Fix Apache fully qualified domain name

You may have noticed an error message from Apache about the server’s fully qualified domain name.

apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName

This is not a big deal, but if it bothers you, you can fix it with the following commands.

echo “ServerName localhost” | sudo tee /etc/apache2/conf.d/fqdn

Now reload the Apache web server.

sudo service apache2 reload

You should no longer see the error message.

Configure MySQL

Since this tutorial is for setting up a local web development environment, the MySQL needs to be bound to the localhost IP address. By default this should be on your system. Just in case, you can verify it with these commands.

cat /etc/hosts | grep localhost

You should see something like: localhost
::1 ip6-localhost ip6-loopback

You now want to verify that you have the correct bind address in MySQL’s my.cnf file.

cat /etc/mysql/my.cnf | grep bind-address

You should see:
bind-address =

If the bind address doesn’t match the one set for localhost on your system, you’ll need to edit /etc/mysql/my.cnf as root to correct it.

Install phpMyAdmin

You don’t need to install


, but unless you’re a wizard with SQL, you’ll want it to do administrative tasks on your MySQL databases.

You can install phpMyAdmin with this terminal command:

sudo apt-get install libapache2-mod-auth-mysql phpmyadmin

You’ll be prompted to confirm that you want to install the packages. Hit <Enter> to continue.

Install phpMyAdmin packages

You’ll next be prompted to select a web server to configure with phpMyAdmin. This is important! Use the arrow keys on your keyboard to highlight apache2 and then used the space bar to select it. Then hit <Enter> to continue. Make sure to click the picture below to see it in full size to see what I’m describing.

Configure phpMyAdmin for Apache

The next screen will ask if you want to configure


with a database called


Select “Yes” and hit <Enter>.

phpMyAdmin configure dbconfig-common

You’ll next be prompted to enter the MySQL root password you created earlier so that the new database can be created. So enter your MySQL root password and hit <Enter>.

Enter MySQL root password

The next prompt is to create a MySQL application password for phpMyAdmin. You can hit <Enter> if you want a random password to be created. I usually use the same password that I used for the MySQL root password. It’s probably not the greatest idea in terms of security, but since this is for a closed development environment, it’s probably low risk.

phpMyAdmin MySQL application password

Finally, you’ll be prompted to confirm your MySQL application password. Type the same password as the previous step and hit <Enter>.

Confirm MySQL application password

Installing and configuring phpMyAdmin is now complete.

Testing phpMyAdmin

The last step is to make sure that phpMyAdmin is working. Open a web browser and enter the address http://localhost/phpmyadmin/. You should see a page that looks like this.

phpMyAdmin login screen

You should now be able to log in with the username root and the root password that you created earlier.

phpMyAdmin logged in

Congratulations, you are now done installing and configuring LAMP and phpMyAdmin on Ubuntu 12.04. You can now start building the local version of your website. If you are only working on one site, you can place your files in /var/www. Note that /var/www is owned by the user and group root, so you will either need to copy files over as root, or change the ownership and/or permissions of that directory so you can write your files there. As an alternative, you can do some additional Apache configuration so that you can keep your files somewhere under your home directory. You can even set up multiple sites that way.

Courtesy of tuxtweaks

Some usefull stuff to install for ubuntu

Some usefull stuff to install for ubuntu

Media Players:

Amarok – My favourite music player (apt-get install amarok). I use mysql to store my collections.

xine – (apt-get remove totem-gstreamer)

smplayer – SMplayer is a GUI for mplayer, one of the best media players around. (apt-get install smplayer)

vlc media player – I keep this just out of habit. just as good as smplayer, only not as good a GUI (apt-get install vlc)


nmap – nmap is a great network scanner. (apt-get install nmap)
Yakuake – Yakuake is what you call a drop-down terminal. It requires the use of kde libraries (so does amarok), but all that
is taken care of by apt-get. (apt-get install yakuake)

Wine – helps me run some windoze apps (like counter strike!) on linux. (apt-get install wine)

Partition Editor – A great tool to examine and manipulate partitions on your hard drive. (apt-get install gparted)

Linux DC++ – A linux client for the DC++ protocol (apt-get install linuxdcpp)

Dev tools:

G++ – the C++ development environment (apt-get install g++)

manpages-dev – Contains man pages describing the Linux programming interface including Linux system calls and library calls.
(apt-get install manpages-dev)

Java – I don’t use java a lot, but I still install it. But I dont use the ubuntu package for this (sun-java5-jdk). Instead I download it
directly from Sun’s website. This way I can prevent java from “getting into ubuntu’s heart”

Web server stuff:

Apache2 – the supreme web server of all earth, water and sky! (apt-get install apache2)

PHP5 – my favourite server scripting language. To get this working with apache, we need the php5 apache mod.
(apt-get install php5 libapache2-mod-php5)

MySQL – The database server of my choice. I also install the mysql module for php to get database access from php.
(apt-get install mysql- server-5.0 php5-mysql)


Firefox 3 – already available

Firefox 2 – This is purely for testing web pages on FF2. I make a separate user (ff2) and install FF2 in a separate folder by downloading
the setup from here.

Opera – for testing javascript and web pages on opera. Mostly all these browsers are for ensuring cross-browser operation

Konqueror – again for cross-browser stuff. (apt-get install konqueror)

ies4linux – This nifty software install the Windows IE 5, 5.5 and 6 on linux. This uses wine and cabextract, so wine must be installed
first.(apt-get install wine cabextract). Now ies4linux must be downloaded and installed separately from here.

Install Turpial in ubuntu 10.04/9.10

Turpial is twitter client written in Python. Light, fast, fully functional and integrated to the user desktop.

Open the terminal and run the following commands

  • sudo add-apt-repository ppa:effie-jayx/turpial
  • sudo aptitude update
  • sudo aptitude install turpial

Re-blogged from:

Installing the latest version of Firefox (Firefox 4) on Ubuntu 10.04 LTS

Ubuntu 10.04 and 10.10 users wanting to upgrade to the latest release of Mozilla Firefox can do so by adding the Firefox Stable PPA to their system sources.

To do this, open up the Ubuntu Software Center, head to Edit > Software Sources and click the ‘Other Software’ tab. Press ‘Add’ and then paste ppa:mozillateam/firefox-stable into the relevant field.

After adding the PPA you will be prompted to update your sources. Once done you can head to System > Administration > Update Manager to perform an upgrade

Alternatively you can do the above via the Terminal (Applications > Terminal). Just enter the following two commands separately, entering your password when asked:

  • sudo add-apt-repository ppa:mozillateam/firefox-stable
  • sudo apt-get update && sudo apt-get upgrade

Re-blogged from: