What is LAMP?
LAMP stands for Linux, Apache, MySQL and php. It is also called a web stack, that uses Linux as the operating system, Apache as the Web server, MySQL as the database and PHP as the HTML embedded scripting language used to create dynamic Web pages.
You will need LAMP installed to run a local installation of WordPress.
Installing LAMP stack
We can install LAMP stack by using Tasksel. Tasksel is a Debian/Ubuntu tool that installs multiple related packages as a coordinated “task” onto your system. In other words it means we can install LAMP all together rather than separately.
Open your command line terminal and type:
sudo apt-get install tasksel
Next install LAMP server using tasksel. Type in:
In the dialogue box which appears you can choose which server you want to use. Choose “LAMP server” by using the arrow key. Use the space bar key to select. Then use the TAB key to move to OK. Press ENTER.
LAMP server is now installed!
To check everything has gone OK go into your browser and in the address bar type “localhost” (without quotation marks). You should see the Apache 2 Default Page:
You can now check which PHP version on your system. In your command line terminal type:
You should see some information about your PHP which should look something like:
Configuring the Apache Server
We’ll now need to configure the Apache server so that it can read the PHP file. In your command line terminal type:
sudo gedit /etc/apache2/apache2.conf
This should the apache2.conf file. At the bottom of the file add an extra line:
# Include /php7.0/apache.conf
Save the file and close the apache2.conf file.
We’ll now create a php file as a test. In your command line terminal type:
sudo gedit /var/www/html/test.php
This should open a file called ‘test.php’. In the file you need to type:
<?php echo phpinfo(); ?>
Save the file and close it.
For the changes to be recognised restart the apache server by typing into your command line terminal:
sudo service apache2 restart
Finally go into your browser and in the address bar type:
You should now see the php page below which means that php is working on your LAMP stack.
To finish off you should now go into your file system (var/www/html) and delete both the ‘test.php’ and index.html’ file. This is to ensure that if you do a future WordPress installation they do not conflict with the installation. To delete the files you will need to open as ‘root’. Right click in the folder and select ‘Open as Root’ – you will be prompted for your password.
Let me know if this has worked for you or if you have any other useful tips for installing LAMP.