Setup LAMP With Ubuntu In 10 Minutes

I love Debian/Ubuntu based Linux because of this command apt-get. As a starter knowing this one command, It is so easy to install packages and you dont need to worry about package dependency and configuration. I first come use Ubuntu when i start using Amazon’s ec2. I was amazed how easily i can build up a server. I am going to show how easy LAMP setup really is. I assume you have a Ubuntu setup-ed server and PuTTy.Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.

Before proceeding to install, update the necessary packages with Debian with this command.

 apt-get update

1. Installing Apache + PHP
To install PHP5, just run the following on Linux shell. Note that if you dont specify packages with ‘4’, PHP5 will be automatically installed.

apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www

To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function exactly as shown below.

nano /var/www/test.php

And write this

<?php phpinfo(); ?>

Point your browser to http://ip.address/test.php or http://domain/test.php and this should show all your php configuration and default settings.
To enable GD Enter this

apt-get install php5-gd

To enabling mod rewrite with .htaccess

a2enmod rewrite

Then open the apache config

nano /etc/apache2/sites-enabled/000-default

Change AllowOverride none to AllowOverride All

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

2. Installing MySQL Database Server
The following commands will install mysql 5 server and mysql 5 client.

apt-get install mysql-server mysql-client php5-mysql

To install PhpMyAdmin use the following code

apt-get install phpmyadmin

Then restart Apache

/etc/init.d/apache2 restart

Now When you develop web app or sites you need more packages then the default installation for that use the following command

apt-get install curl libcurl3 libcurl4-openssl-dev php5-curl php5-mcrypt php5-xmlrpc 

To install pear use the following command

apt-get install php-pear

How much time did it take – less than 10 Minutes right.

About Zakir Hyder

This entry was written by .

18. October 2011 by Zakir Hyder
Categories: Linux, Server Management | Tags: , , , , , | Comments

Comments

  1. […] Setup LAMP With Ubuntu In 10 Minutes Tuesday, October 18, 2011 2:10 PM I love debian/ubuntu based linux because of this command apt-get. As a starter knowing this one command, It is so easy to install packages and you dont need to worry about package dependency and configuration. I first come use Ubuntu when i start using Amozon’s ec2. I was amazed how easily i can build up […] […]

  2. […] a LAMP server for one of client. As usual I chose Ubuntu. I setup the The LAMP. You can view the Setup LAMP With Ubuntu In 10 Minutes. Then my client wanted to setup domain on that server. So start searching for easy to setup domain […]

  3. […] a LAMP server for one of client. As usual I chose Ubuntu. I setup the The LAMP. You can view the Setup LAMP With Ubuntu In 10 Minutes. Then my client wanted to setup domain on that server. So start searching for easy to setup domain […]

  4. […] to the world of putty i was lost. SO i had to search for certain commands. I recently show the SSetup LAMP With Ubuntu In 10 Minutes. He was also happy mouse driven windows user So he was not able to setup the LAMP correctly. So in […]

  5. […] to the world of putty i was lost. SO i had to search for certain commands. I recently show the SSetup LAMP With Ubuntu In 10 Minutes. He was also happy mouse driven windows user So he was not able to setup the LAMP correctly. So in […]

  6. […] Before you start this you should look into these post Some Important Linux commands for Newbies and Setup LAMP With Ubuntu In 10 Minutes. We will setup Postfix (Mail Transfer Agent MTA), Dovecot (IMAP/POP3 Server), SASL Authentication […]