Linux newbie guide to installation of LAMP on Ubuntu!!!

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. The LAMP stack is a very popular setup and many websites run on it. Best of all, all four of the tools in the stack are free and open source and really easy to get started with.

For this tutorial, I’m going to be showing you how to install LAMP on Ubuntu 9.04 (Jaunty Jackalope), but the process is very similar for other Linux distributions too.

All the stuff you need is pre-loaded into Ubuntu’s software repositories, and it’s really simple to install everything you need. If you’re doing a new install, you may want to take a look at the server edition of Ubuntu as it allows for a pre-configured profile that you can pick at install time.

You need to install the following packages:

  • apache2
  • php5-mysql
  • libapache2-mod-php5
  • mysql-server

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

That’s pretty much all the configuration you need to do, so you can now grab any web applications you want and install them.

Cheers :)

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • FriendFeed
  • Reddit
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Yahoo! Buzz
  1. Overall your brief article is marvelous, I don’t know much about Linux and only started about three months ago.

    My web site which has a few simple java server pages including one that connects to MySQL is hosted on a linux server & has phpmyadmin facilities set up, which I thought was very useful, once I figured out how to use it.
    I was previously using apache-tomcat-5.5.25 on windows , got MySQl set up but I couldn’t get phpmyadmin installed on windows to save my life.

    After looking into Linux I noticed articles stating you could install lamp using something like: sudo apt-get lamp-server ^

    However after trying several times I got glitches which I didn’t know how to sort out , especially at the stage phpmyadmin which came up with “ you need to have a database installed “ .

    Yours is the first to work which I have set up on Linux Mint 7. The only thing different from your installation list was that after doing :

    sudo apt-get install mysql-server

    a prompt can up for the password on the screen to type in anyway.

    I then decided to log in using mysql -u root -p (mypassword) & do CREATE DATABASE ..

    use database, then CREATE TABLE

    I then followed the rest of your schedule to the end , but http://locahost/phpmyadmin

    wouldn’t bring up the log in. From my other trial & error efforts I remembered seeing amend /etc/apache2/apache2.conf , so I did a gedit & put in the line

    “Include /etc/phpmyadmin/apache.conf

    re started apache & got the phpmyadmin log in. I got in using root & the same password for mysql.
    The database & table were showing that I created when I logged in . MySQl administrator & query is in under the programing menu of my Mint Installation so it looks like everything I want is installed & working !

    Hallelujah!!!

  1. No trackbacks yet.

This site is using OpenAvatar based on