Setup LAMP With Ubuntu In 10 Minutes

Published on : October 18, 2011

Author:

Category: Ubuntu


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 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.


3 replies on “Setup LAMP With Ubuntu In 10 Minutes”

I followed these utntricsions exactly they are the same as on other sites and I can’t seem to get rvm installed.Curiously, I have two installs that were created at the exact same time:$HOME/.rvm/src/rvm/scripts/rvm/usr/local/rvm/scripts/rvmEach contains the entire rvm install that ostensibly was created after I ran the curl command.Why are there two installs in two separate installations?Additionally, I can’t get the rvm function to run. The command I put in .bash_profile includes a directory that does not exist:$HOME/.rvm/scripts/rvmThat directory was not created as part of the install.Instead, $HOME/.rvm/src/rvm/scripts was created but when I use that path in .bash_profile it doesn’t work either. I get the following errors:-bash: rvm_error: command not foundcat: $HOME/.rvm/VERSION: No such file or directory-bash: __rvm_conditionally_add_bin_path: command not foundHow can this be since I’m just following utntricsions that apparently work for everyone else? Any help is MUCH appreciated thanks!Chris

Leave a Reply

Your email address will not be published. Required fields are marked *