LAMP (Linux, Apache, MySQL and PHP) is a package name for the installation of Apache server, MySQL database and PHP performed on a Linux machine. Similar packages (also available as application) named as WAMP and MAMP are available for Windows and Mac operating systems respectively. To install and use a server based application like WordPress (for development and testing purpose) on a local machine, you need to first install these packages on the machine. Recently, I installed LAMP and WordPress on couple of Ubuntu machines and here is what I did.

WordPress and LAMP in Ubuntu

Installing LAMP first!

Open the terminal on Ubuntu. Execute below commands to complete the tasks mentioned,

1. Install Apache

[text]sudo apt-get install apache2[/text]

2. Install MySQL

[text]sudo apt-get install mysql-server[/text]

3. Install PHP

[text]sudo apt-get install php5 libapache2-mod-php5[/text]

4. Restart Apache Server

[text]sudo service apache2 restart[/text]

Now open any web browser e.g. Firefox and open the URL http://localhost and it should show a message saying ‘It Works’.

Install WordPress

As the Apache server is running on your Ubuntu machine, now it is time to go ahead and start with the installation of WordPress on localhost. Follow the steps below,

1. Download the latest version of WordPress


Unzip the same,

[text]tar -xzvf latest.tar.gz[/text]

Unzipped folder ‘wordpress’ should appear inside the Home directory of Ubuntu.

Create Database and User

For the installation of WordPress, you need to create a database in MySQL and also assign a username and associated password with full authority of that database to the user.

Login to MySQL shell to execute MySQL commands from terminal,

[text]mysql -u root -p[/text]

Execute below commands one by one on terminal,

[text]CREATE DATABASE wordpress;[/text]

[text]CREATE USER wordpressuser@localhost;[/text]

[text]SET PASSWORD FOR wordpressuser@localhost=

[text]GRANT ALL PRIVILEGES ON wordpress.* TO
IDENTIFIED BY ‘password’;[/text]

[text]FLUSH PRIVILEGES;[/text]


Now you are out of MySQL shell. It’s time to move on.

Create wp-config.php file (Configuration File)

WordPress packages comes with wp-config-sample.php and by editing the content of this file, we can create wp-config.php. Execute following command on terminal to create a copy of the sample file.

[text]cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php[/text]

Open wp-config.php for editing,

[text]sudo nano ~/wordpress/wp-config.php[/text]

Update Database, Username and Password in wp-config.php file then save and exit.

Time to move the ‘wordpress’ folder to /var/www/ folder. Execute following command on terminal.

[text]sudo rsync -avP ~/wordpress/ /var/www/[/text]

Change permission for the folder ‘wordpress’. first go inside the folder,

[text]cd /var/www/[/text]

Give read-write permission to the Apache user,

[text]sudo chown username:www-data /var/www -R
sudo chmod g+w /var/www -R[/text]

Done. Go ahead and open the URL http://localhost/wordpress/wp-admin on browser.

If you are seeing the error message as “Your PHP installation appears to be missing the MySQL extension which is required by WordPress“, then go ahead and execute the following command on terminal,

[text]sudo apt-get install php5-mysql[/text]

Restart Apache server,

[text]sudo service apache2 restart[/text]

Re-open the URL http://localhost/wordpress/wp-admin on your browser and see if the WordPress installation page opens.

Installing GD Library

WordPress uses GD libraries for few functionalities and that’s why it is recommended to install GD library as well. Execute the below command on terminal to install the same.

[text]sudo apt-get install php5-gd[/text]

Your WordPress installation must be up and running on LAMP Ubuntu. Go ahead and start the development + testing tasks on your awesome Ubuntu system.


Install phpMyAdmin to manage the Database

Execute this command on terminal,

[text]sudo apt-get install phpMyAdmin[/text]

After that, you need to modify the apache2.conf file available inside the /etc/apache2/ folder. Use terminal to do the same,

[text]sudo gedit /etc/apache2/apache2.conf[/text]

Now add the following piece of line at the bottom of this apache2.conf file,

[text]Include /etc/phpmyadmin/apache.conf[/text]

Restart the Apache server,

[text]sudo service apache2 restart[/text]

Well, now you have WordPress installed on LAMP server running on Ubuntu and you can see the database through http://localhost/phpmyadmin URL in browser.

By Sanjeev Mishra

Sanjeev Mishra is a professional blogger and an Internet Marketing Consultant based in India. He has built the Internet Techies to provide you updates in technology and web application area.

Leave a Reply

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