Today we will be covering the installation of LAMP stack using Ubuntu Linux 14.04. LAMP stands for “Linux, Apache, MySQL and PHP” and it’s the most used web server environment used on the internet today. This particular software combination has become popular because it is entirely free and open-source software, it is also easy to install and use, offering great stability, usability and security.
We will start by installing MySQL on our system, the database management system that will keep all the information we use on our website. Additional we will install the php5-mysql package which will provide support for PHP. Run the following command:
$ sudo apt-get install mysql-server php5-mysql
During the installation you will get prompted to enter a password for the root (administrator) user of the MySQL server, you will need this password later on to configure the server, please note that this is not the same password as the root user of Linux.
The Apache HTTP Server has been the most popular web server on the Internet, in 2014, Apache was estimated to serve over 50% of all active websites. The latest generation of Apache is 2.4 and you can install it from the Ubuntu repository with PHP support using the following command:
$ sudo apt-get install apache2 libapache2-mod-php5
To see if Apache is working correctly, open a web browser and access the IP address of the server you have installed it on and you should get the first page looking like this:
WordPress is a free and open source blogging platform, that developed over time in the most used CMS (Content Management System) on the Internet. It is easy to use and install, free of cost and with a huge community offers a lot of customization possibilities from themes that change the look to modules that expand the functionality.
Installing WordPress is easy, first you will have to download the package from the WordPress Download Section using an utility like wget and then decompress it in the Apache HTML folder in /var/ww/html: or you can use wp-cli command line utility to install latest version of wordpress.
$ cd /var/www/html $ sudo wget http://wordpress.org/latest.tar.gz $ sudo tar zxvf latest.tar.gz –strip-components=1
Then using the sudo command set the permissions so you will be able to modify the files and allow the web server to access them as well like this:
$ sudo chown -R www-data * $ sudo chgrp -R www-data *
Next we will have to create a database and username for our WordPress installation, to do so follow the next steps, you will be asked for the root password you setup earlier when you installed MySQL:
Note: This will create a database named wordpress with a username named wordpress and the password “foopassword”, you can use your own database names and you will have to use your own password.
$ mysql -u root -p mysql> CREATE DATABASE wordpress; mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “wordpress”@”localhost” IDENTIFIED BY “foopassword”; mysql> FLUSH PRIVILEGES; mysql> EXIT
Rename the wp-config-sample.php file to wp-config.php and using your favorite text editor you will need to add the name of your database, mysql username and password to the config file, it should look like this:
You can now go to your favorite browser and use your IP or hostname to access the new WordPress installation, it will ask you for the website name and the username you want to use with WordPress:
After you finish with that it will quickly setup WordPress:
Now you will just have to use your WordPress username and password to log in:
It will point you to your freshly installed WordPress:
Congratulations you now have a fully working installation of WordPress on the Linux, Apache, MySQL and PHP stack, one of the most used on the Internet.