Sep 21 2009

Setup LAMP on Ubuntu

Install Apache

To start off we will install Apache.

1. Open up the Terminal (Applications > Accessories > Terminal).

2. Copy/Paste the following line of code into Terminal and then press enter:

sudo apt-get install apache2

3. The Terminal will then ask you for you’re password, type it and then press enter.

Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

1. Open up any web browser and then enter the following into the web address:

http://localhost/

You should see a folder entitled apache2-default/. Open it and you will see a message saying “It works!” , congrats to you!

Install PHP

In this part we will install PHP 5.

Step 1. Again open up the Terminal (Applications > Accessories > Terminal).

Step 2. Copy/Paste the following line into Terminal and press enter:

sudo apt-get install php5 libapache2-mod-php5

Step 3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:

sudo /etc/init.d/apache2 restart

Test PHP

To ensure there are no issues with PHP let’s give it a quick test run.

Step 1. In the terminal copy/paste the following line:

sudo gedit /var/www/testphp.php

This will open up a file called phptest.php.

Step 2. Copy/Paste this line into the phptest file:

<?php phpinfo(); ?>

Step 3. Save and close the file.

Step 4. Now open you’re web browser and type the following into the web address:

http://localhost/testphp.php

Congrats you have now installed both Apache and PHP!

Install MySQL

To finish this guide up we will install MySQL. (Note – Out of Apache and PHP, MySQL is the most difficult to set up. I will provide some great resources for anyone having trouble at the end of this guide.)

Step 1. Once again open up the amazing Terminal and then copy/paste this line:

sudo apt-get install mysql-server

Step 2 (optional). In order for other computers on your network to view the server you have created, you must first edit the “Bind Address”. Begin by opening up Terminal to edit the my.cnf file.

gksudo gedit /etc/mysql/my.cnf

Change the line

bind-address = 127.0.0.1

And change the 127.0.0.1 to your IP address.

Step 3. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste the following line into Terminal:

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Step 4. Now linking phpMyAdmin to Apache’s www folder

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:

gksudo gedit /etc/php5/apache2/php.ini

Now we are going to have to uncomment the following line by taking out the semicolon (;).

Change this line:

;extension=mysql.so

To look like this:

extension=mysql.so

Now just restart Apache and you are all set!

sudo /etc/init.d/apache2 restart


Jan 9 2009

Installing LAMPP on Linux/ Ubuntu

The acronym LAMP refers to a solution stack of software, usually free and open source software, used to run dynamic Web sites or servers. The original expansion is as follows:

  • Linux, referring to the operating system;
  • Apache, the Web server;
  • MySQL, the database management system (or database server);
  • PHP or others, i.e., Perl, Python, the programming languages.[1]

The combination of these technologies is used primarily to define a web server infrastructure, define a programming paradigm of developing software, and establish a software distribution package.

Though the originators of these open source programs did not design them all to work specifically with each other, the combination has become popular because of its low acquisition cost and because of the ubiquity of its components (which come bundled with most current Linux distributions). When used in combination they represent a solution stack of technologies that support application servers.

vie Wikipedia

Download the current version from here

F Y I:
By the way: In the past this software was called LAMPP but to avoid misconceptions they renamed it to »XAMPP for Linux«.

inside the terminal type:

sudo tar xvfz xampp-linux-1.7.tar.gz -C /opt

Tha’s all. LAMP is now installed on your computer. All you need to do now is to start LAMP (this is to start the Apache server and MySQL). To do that execute the following command in Terminal:

sudo /opt/lampp/lampp start

You can test your installation by pointing your browser to http://localhost

In order to make sure LAMP starts automatically every time you start your computer, follow these steps.

First, execute this command in Terminal:

sudo gedit /etc/init.d/rc.local

When gedit opens, add the following line right at the bottom of the file (below the word “esac”)

sudo /opt/lampp/lampp start

Save the file and close it. Now you don’t have to start LAMP manually each time your start your computer.

Notes:

  • Your root (admin) password for MySQL is left blank. It’s better if you set a password.
  • Your php files and projects should be put inside the directory /opt/lampp/htdocs
  • Login to phpMyAdmin from here: http://localhost/phpmyadmin/index.php