Install and Set up WordPress in Ubuntu 14.04 Server

Last updated: April 26, 2014

install wordpress ubuntu 14.04

Already installed LEMP or LAMP on your Ubuntu server? Well, now it’s time to install wordpress CMS and get your site running!

As you may know, wordPress is a popular blogging tool and a content management system (CMS) based on PHP and MySQL. It’s free and open-source. In the steps below the lines that the user needs to enter or customize will be in red in this tutorial!

1. Setup Mysql Database for WordPress

For LEMP (Ubuntu, Nginx, Mysql, Php) without phpmyadmin installed:

Database name: wordpress_db; user name: ubuntuhandbook; password: 12345678; Change them in the code below.

Step 1 – Run command in Ubuntu Server to log into MySQL Shell with MySQL root password:

mysql -u root -p

Step 2 – Create database, here I named it wordpress_db:

CREATE DATABASE wordpress_db;

Step 3 – Create a new user named ubuntuhandbook:

CREATE USER ubuntuhandbook@localhost;

Step 4 – Set a password for this user:

SET PASSWORD FOR ubuntuhandbook@localhost= PASSWORD("12345678");

Step 5 – Grant all privileges to the new user:

GRANT ALL PRIVILEGES ON wordpress_db.* TO ubuntuhandbook@localhost IDENTIFIED BY '12345678';

Step 6 – Refresh MySQL:


Exit MySQL shell:


For LAMP (Apache2, Mysql, Php, Ubuntu Linux):

If you’ve installed LEMP and want to use PhpMyadmin to manage database, click the link in the top of this tutorial.

1. Install Phpmyadmin:

sudo apt-get install phpmyadmin

Choose apache2 webserver during the installing process and say NO to “Configure database for phpmyadmin with dbconfig-common?”

Once installed, run commands below to get it working:

sudo sh -c 'echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf' && sudo service apache2 restart

Now, go to http://UBUNTUSERVERIP/phpmyadmin/ in your client’s browser and type in root and the password you set when MySQL was installed to login.

phpmyadmin login

phpmyadmin login

2. Follow the below steps to create database and user with same name.

Step 1 – Click on Users then click Add User.
Step 2 – Type in your desired User name (wordpress is a good one) and ensure Use text field is selected. Ensure Host is set to Local from the drop down list and the text box will change to localhost and enter a Password and then confirm it in the Re-type box. Ensure the Password Use text field is also selected.
Step 3 – Check the box that says Create database with same name and grant all priviliges.
Step 4 – Click on Go.

phpmyadmin create user and database

phpmyadmin create user and database

2. Download & Config WordPress:

Download the latest wordpress from its official website:

cd && wget

Decompress the package:

tar -xzvf latest.tar.gz 

Go to the result folder and create the configuration file by copying the sample file:

cd wordpress/ && cp wp-config-sample.php wp-config.php

Edit the wordpress configuration file via vi editor:

vi wp-config.php

Find the section that contains the field below and substitute in the correct name for your database, username, and password:

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */

/** MySQL database username */
define(‘DB_USER’, ‘USER_NAME_HERE‘);

/** MySQL database password */

Press i to start editing, and Esc to end editing. Finally press Shift+: followed by wq and Enter to save and exit the file.

3. Copy Files and Set Ownership:

Now move WordPress files to webserver root directory:


cd && sudo rsync -avP wordpress/ /var/www/


cd && sudo rsync -avP wordpress/ /usr/share/nginx/html/

Set ownership of the root directory:

cd /var/www/  ###For nginx: cd /usr/share/nginx/html/

sudo chown www-data:www-data * -R 

sudo usermod -a -G www-data www-data

4. Install WordPress:

Finally in your client’s web browser go to http://UBUNTUSERVERIP/wp-admin/install.php and install your wordpress site:

installing wordpress

installing wordpress

Once done, if you still get “It Works!” Apache page. Run command below to edit dir.conf:

sudo vi /etc/apache2/mods-enabled/dir.conf

You will see a line of index files (index.html, index.php, index.cgi, etc) under the DirectoryIndex setting. Add index.php as the first item in the list.

After that, restart Apache server by:

sudo service apache2 restart

Now you can access your new website:

wordpress site

wordpress site


I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee:

7 responses to Install and Set up WordPress in Ubuntu 14.04 Server

  1. Hi,

    I would like to say that your tutorials are very helpfull.

    But I have one problem. I followed every step from this tutorial and I still can’t run wp instalation.

    When I type in my browser “localhost” I get Apache, when I type localhost/phpmyadmin I get PHP…but when I type localhost/wp-admin/install.php I get “404 Not found – The requested URL /wp-admin/install.php was not found on this server.”…

    If you know what I should do, please tell me…

    I would appreciate your help….

    • Use your local IP instead of “localhost”. To find your local IP in Ubuntu, go to Networks > Connection Information. Under the IPv4, is your local IP address.

      In Windows, open cmd and type ipconfig.

    • I had the same problem and I discovered in other blogs that in the part 3 (for LAMP):
      “cd && sudo rsync -avP wordpress/ /var/www/” in ubuntu 14.04 have to be “cd && sudo rsync -avP wordpress/ /var/www/html” and then have to be changed in the next part also: “cd /var/www/” to “cd /var/www/html”.
      For me it worked.

  2. hi, thank you for advice but I still have the same problem….

    Since then I have noticed one more problem….bigger problem…

    Following this tutorial I created huge problem for me…and I don’t know how to reverse that thing….

    “Step 3. Copy Files and Set Ownership”, I believe (better to say I’m sure) that in this step I typed wrong instruction…and now my all files are locked and owner of this files is “user” www-data…I can’t even delete this user, group or whatever it is…

    I can’t copy, cut, paste, delete etc….because always sasy that owner of all files is www-data and group www-data….

    Please help….

    • hello, do yo find the solution for ´The requested URL /wp-admin/install.php was not found on this server.”…´

  3. kumar dhanuskody December 16, 2014 at 2:49 pm

    super nice phpmyadmin working fine. thanks a lot…..

  4. thanks a lot it worked