The acronym LAMP refers to a set of free software programs commonly used together to run dynamic Web sites or servers Linux, the operating system; Apache, the Web server; MySQL, the database management system (or database server) and Perl, PHP, and/or Python, scripting languages.

This tutorial is how to install LAMP on Ubuntu Desktop.

Linux

Here are several steps to install Ubuntu Linux Desktop if you have not already done so.

  • First download and burn your own installation CD file from the Ubuntu Linux site or order a free CD from Shipit – Free CDs.
  • Second, try out your new Ubuntu Linux without changing anything on your computer by booting the installation CD. This is a great way to test compatibility with your computer.
  • Third, install Ubuntu Linux permanently on your computer by double-clicking the install icon on your temporary desktop.
    1. Download the Ubuntu Linux Desktop ISO CD image from the Ubuntu Linux site.
    2. Burn a bootable CD from the ISO CD image.
    3. Boot the CD on the target machine. Make sure the network is connected. If all is successful, Ubuntu Linux will start up in a fully functional friendly desktop environment. Experiment for a while if you like.
    4. Double-click on the installer icon on the desktop to permanently install Linux.
    5. Enter Name, Username, Password, and Time Zone. Set the clock if necessary. Choose automatic partition and format to erase the previous operating system.
    6. WARNING – This will wipe out everything on the target machine hard drive.
    7. Wait.
    8. Restart.
    9. Remove the CD to prevent starting over.
    10. Type Enter to boot.
    11. Login.

Apache

Install Apache

sudo apt-get install apache2

Testing HTTP Server by open a web browser and enter http://localhost

PHP

Install PHP5

sudo apt-get install php5 libapache2-mod-php5

Stop/Restart Apache

sudo /etc/init.d/apache2 restart

Test the installation

sudo gedit /var/www/testphp.php

Insert this following line into testphp.php file.

<?php phpinfo(); ?>

Save this new file.
Open a web browser and enter http://localhost/testphp.php
Be sure to remove the file afterwards, as it may pose a security risk.

sudo rm /var/www/testphp.php

MySQL

Install MySQL Server

sudo apt-get install mysql-server

MySQL initially only allows connections from the localhost (127.0.0.1). We’ll need to remove that restriction if you wish to make it accessible to everyone on the internet. Open the file /etc/mysql/my.cnf

gksudo gedit /etc/mysql/my.cnf

Find the line bind-address = 127.0.0.1 and comment it out then save the file.
MySQL comes with no root password as default. This is a huge security risk. You’ll need to set one. So that the local computer gets root access as well, you’ll need to set a password for that too. The local-machine-name is the name of the computer you’re working on.

mysqladmin -u root password newpassword
mysqladmin -h root@local-machine-name -u root -p password newpassword
sudo /etc/init.d/mysql restart

MySQL Administrator

Install MySQL Administrator

sudo apt-get install mysql-admin

Refresh Gnome Panel

killall gnome-panel

Run MySQL Administrator
Applications -> System Tools -> MySQL Administrator

MySQL for Apache HTTP Server

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

To get PHP to work with MySQL, open the php.ini file

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

You’ll need to uncomment the “;extension=mysql.so” line so that it looks like this

extension=mysql.so

Restart Apache

sudo /etc/init.d/apache2 restart

Well done!

Related Posts: