In this post I will explain how to install a LAMP(Linux,Apache,Mysql,PHP) system.
First 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:
3. The Terminal will then ask you for your password, type it and then press enter.
Now we will test Apache installation
To make sure that 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:
You should see a folder entitled apache2-default/. Open it and you will see a message saying ”It works!” , congrats to you!
Now we will Install PHP
Here 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:
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:
Now we will Test PHP Installation
To check that there are no issues with PHP installation.
Step 1. In the terminal copy/paste the following line:
This will open up a file called myphptest.php.
Step 2. Copy/Paste this line into the myphptest.php file:
Step 3. Save and close the file.
Step 4. Now open your web browser and type the following into the web address. it
The result will be: My Test PHP
Now We will Install MySQL
Here we will finish mysql installation step by stesp
Step 1. Again open up the Terminal and then copy/paste below line:
Step 2. Now type the following line into Terminal:
Now copy/paste the Following and set the password:
- mysql> SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘yourpassword’);
(You can change password of your choice.)
Step 3. Now We will 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
After MYSQL/phpMyAdmin installatio 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:
Now we are going to have to uncomment the following line by taking out the semicolon (;).
Change this line:
To look like this:
Now just restart Apache and you are all set!
You have now installed a LAMP server on Ubuntu! You are now ready to manage web projects with server side scripting and MySQL database access.