Installing LAMP Server on Debian/Ubuntu Linux
Posted by Freelander | Filed under Howto Articles
In this tutorial I will describe a step-by-step installation of a LAMP server on a Debian or Ubuntu Linux. If you’re accessing your server via ssh remotely from a Windows machine, I recommend using putty. It’s pretty easy to set things up thanks to Debian’s apt-get command.
Connect to your Debian / Ubuntu via ssh using putty and get super user rights.
$ su
password:
Type your root password when prompted. Now we have administrator rights to install or remove packages.
In Debian based systems all packages that are installed, not installed and available for installation are kept in a private database. The apt-get program uses this database. So you must always update this database prior to installing a new package.
$ apt-get update
We can now start installing necessary packages for our LAMP server.
$ apt-get install apache2 php5 libapache2-mod-php5
This command will download and install current Apache2 and PHP5 versions and all dependencies automatically from Debian Repositories.
It’s a good idea to test our Apache and PHP once the installation is finished. Create a php page with phpinfo() function and see if it works.
$ nano /var/www/check.php
Write (or copy / paste) the following text into your check.php document.
<?php
phpinfo();
?>
Save the file and exit. Now open your browser and point it to:
http://ip.of.your.linux.box/check.php
You should see a screen similar to this. If your browser tries to download the check.php file, don’t panic. You may need to restart your new Apache server. Just issue the following command and try again.
$ /etc/init.d/apache2 restart
phpinfo() function prints your default PHP settings. You can change them if you want, through your php.ini file located under /etc/php5/apache2/ folder.

Following command will install MySQL 5 Server and MySQL 5 client on your Debian / Ubuntu linux.
$ apt-get install mysql-server mysql-client php5-mysql
During setup, MySQL will ask you to specify a root password for your database access. Enter a password that you will not forget and hit continue. The setup will ask for confirmation of your password. Enter it again and hit continue.
phpMyAdmin is a free software tool written in PHP for MySQL database administration via an Internet Browser. (i.e. Firefox, IE etc.) Installation is a piece of cake again. Simply type this in your console and hit enter.
$ apt-get install phpmyadmin
During setup you will be asked for your server to be reconfigured automatically. Choose “apache2″ at this screen and click “ok”. To use phpMyAdmin start your browser and point it to
http://ip.of.your.linux.box/phpmyadmin
Type “root” for username and enter your MySQL root password you specified while you were setting up MySQL server.
That’s all! Your LAMP server is now up and running plus you have phpMyAdmin!



ShareThis


