LAMP Install (Apache, MySQL, PHP)

  • Few things about LAMP

LAMP is is a group of open source software used for web servers. LAMP stands for Linux, Apache, MySQL, and PHP.

If you are planning to run a web server for personal website, forum, chat etc. LAMP is the best solution for you

As you can see from above, there are four things you’ll need for a web server:

1. Linux

  • Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution.

2. Apache

  • The role of LAMP’s web server has been traditionally supplied by Apache. The Apache HTTP Server has been the most popular web server on the public Internet.

3. MySQL

  • MySQL’s original role as the LAMP’s relational database management system (RDBMS). MySQL is a multithreaded, multi-user, SQL database management system (DBMS),

4. PHP

  • PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP code is interpreted by a web server via a PHP processor module, which generates the resulting web page.

So, lets begin!

I assume that you have Linux installed on your computer

First thing to do is to check if our repositories are up to date:

This will install all new updates if there are any.

1. Install Apache

Note: You’ll need a root Terminal for this

You are probably wondering whats next but this is it! Your apache should be installed. To check if everything went fine, go to web browser and type:

To find whats your IP address you can type:

This will show you your network information. Look for inet addr, this is your internal IP address which can be used to access a web server locally.

2. Install MySQL

Run the following command:

During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password, it is very easy to set the password later from within the MySQL shell.

When it’s all done, run:

You’ll see something like this:

Enter your root password.

Then the prompt will ask you if you want to change the root password. Type N if you set it before or Y to set a new password.

By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them.  You should remove it. Type Y:

To ensure that root can only connect from localhost type Y:

By default, MySQL comes with a database named ‘test’ that anyone can access.  This is intended only for testing, and should be removed. Type Y:

Reloading the privileges tables will ensure that all changes made so far will take effect immediately. Type Y:

Now you can proceed to PHP installation.

3. Install PHP

Run the following command:

You’ll need to type Y two times. After that PHP will finish installation.

Restart apache server:

4. Test your configuration

To test if PHP is working type:

Enter following:

Save file and exit.

Type this address in web browser:

If you see informations on that page, you’ve successfully completed LAMP installation.

If you see blank page, you need to enable mod_php5 on apache. To do that, open Terminal and enter:

After that you’ll need to restart apache to apply changes:

Now reload page phpinfo.php in your web browser and you should see PHP information page.


 

Thats it!

Your web server is ready to go, put some cool stuff on it and have fun!

You may also like...

Leave a Reply

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