Installing LAMP (Apache2 With PHP5 And MySQL) with Webmin on Ubuntu 10

LAMP is short form for Linux, Apache, MySQL, PHP.

Webmin is a web-based interface for system administration for Unix.

In this tutorial I guide you to install Apache Webserver with PHP5 and MYSQL support and also installing Webmin  for their easy configuration.

1 Notes

In this tutorial I use the hostname server.example.com with the IP address 1.2.3.4. These settings might differ for you, so you have to replace them where appropriate.

I’m running all the steps in this tutorial with root privileges, so make sure you’re logged in as root. Use this command:

sudo su

 

2 Installing MYSQL

First we will install MySQL  like this:

 

apt-get install mysql-server mysql-client

 

You will be asked to provide a password for the MySQL root user – this password is valid for the user [email protected] as well as [email protected]

New password for the MySQL “root” user: your_password_here

Repeat password for the MySQL “root” user: your_password_here

3 Installing Apache Web Server

Apache Web Server is available as an Ubuntu package, therefore we will install it like this:

 

apt-get install apache2

 

Now direct your browser to http://1.2.3.4 , and you should see the Apache2 placeholder page (It works!):

It Works!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Apache’s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.

Don’t worry these configuration will be automatically done by Webmin which we are going to install in later part.

4 Installing PHP5

We will install PHP5 and the Apache PHP5 module as follows:

 

apt-get install php5 libapache2-mod-php5

 

It is necessary restart Apache afterwards:

 

/etc/init.d/apache2 restart

 

5 Testing PHP5 Installation

The document root of the our default web site is /var/www. We will now create a small PHP Info file (info.php) in that directory and open it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version. If this file opens, then PHP5 was successfully installed.

Type in:

 

nano /var/www/info.php

 

Note: If it gives error Command Not found. Then the text editor Nano is not installed. Install It using:

apt-get install nano

 

the re-run the command above this one.

Now in Nano editor type

<?php
phpinfo();
?>

Now we open that file in a browser (e.g. http://1.2.3.4/info.php):

 

 

 

 

 

 

 

 

 

 

 

 

As you see, PHP5 is working, and it’s working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don’t have MySQL support in PHP5 yet.

6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we must install the php5-mysql package.But it’s a good idea to install some other PHP5 modules as well as you might need them for your applications. So install most commonly needed PHP5 modules:

 

apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick  php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps  php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc  php5-xsl php5-json

Now restart Apache2:

 

/etc/init.d/apache2 restart

 

Now reload http://1.2.3.4/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

 

 

 

 

 

 

 

 

 

 

 

 

7 Installing phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases. It’s a good idea to install it:

 

apt-get install phpmyadmin

 

You will see the following questions:

Web server to reconfigure automatically: Select apache2
Configure database for phpmyadmin with dbconfig-common? Select No

Afterwards, you can access phpMyAdmin under http://1.2.3.4/phpmyadmin/:

Username: root

Password: the one which you set earlier

 

 

 

 

 

 

 

 

 

 

 

 

8 Installing Webmin

Download latest version of Webmin from http:www.webmin.com

 

wget http://www.webmin.com/download/deb/webmin-current.deb

Execute webmin package. It will say installation failed because we have

 

dpkg -i webmin-current.deb

 

It will say installation failed because we haven’t installed the dependencies required for Webmin.  So Install missing dependencies and it will automatically recompile Webmin.

 

apt-get -f install

 

Open Webmin on https://1.2.3.4:10000

Login using

Username: root

Password: Your ubuntu root password. Not the one which we set during MYSQL installation.

After you login it will look something like this:

 

 

 

 

 

 

 

 

 

 

 

 

This means you have successfully installed Webmin.

you can now configure your system with a Web-based GUI..

  • Hosting

    I will share this information with my colleagues.. Very useful post.. Thanks for this..

    • SAHIL

      u r welcome.. :)