How to Install WordPress on Ubuntu 14

Try it in our public cloud & Get $50 Credit

CMS powerhouse WordPress makes up over 25% of the internet, and that percentage only continues to grow. The millions of websites that use WordPress love it for its flexibility, ease of use, consistent performance, and continual innovative growth. Once you have it set up, you can design and manage your website or blog right from the web. In this Knowledge Base, you will learn how to install WordPress on Ubuntu 14.

Getting Started

To complete this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) with Ubuntu 14 and a LAMP setup previously installed.

If you don't want to go through the whole installation of WordPress on your CentOS 7 server, you can always try our One-Click Apps and get a new WordPress in seconds.


1. Create database and user account.
Wordpress relies on MySQL to manage and store information. We need to create the database. In this case, we will use “wordpress” for the database name.

Log into your MySQL with your root access:

mysql -u root -p

To function, WordPress needs a database that it can control. Now we’ll create the create the database for WordPress:

mysql> CREATE DATABASE wordpress;

You need to create an account with a username and password that will exclusively operate the database you’ve just created. We will use user “wpuser” and password “wppassword” in this example. Create the account:

mysql> CREATE USER wpuser@localhost IDENTIFIED BY 'wppassword';

At this point, the database and the user accounts you’ve created aren’t connected, so the next step is to give the privileges to the user to access the database created:

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost;

To ensure that MySQL knows about the changes just made, we need to confirm and flush all privileges:


You can now exit MySQL:

mysql> exit

2. Download and unzip the latest version of WordPress.
It’s important to use the latest version of WordPress, which updates fairly regularly, for security reasons. Download the latest version of WordPress in the /root directory:

cd /root

When the download is complete, we need to unzip to extract the files we need. This will create a directory WordPress in your /root:

tar -zxvf latest.tar.gz

Some PHP modules are needed to run WordPress on your server:

apt-get install php5-gd libssh2-php -y

3.Copy the content of the WordPress directory in the Document root.
Wordpress uses index.php, but your server will automatically use index.html instead if it’s there, so we need to remove the index.html file in the Document root directory:

rm -rf /var/www/html/index.html

For WordPress to work, we now must copy the content of the WordPress directory in the Document root:

cd /root/wordpress
cp * -R /var/www/html/

Apache will sometimes need to interact with the content, so we have to give the ownership to Apache to the Document root directory:

cd /var/www/html/
chown -R www-data. *

So that we will be able to upload files and images to the website, we next create the “uploads” directory to your WordPress and give this directory the ownership:

mkdir /var/www/html/wp-content/uploads
chown -R www-data. /var/www/html/wp-content/uploads/

4. Configure your WordPress
Go in your WordPress installation to the Document root directory:

cd /var/www/html/

For WordPress to function properly, we need to configure it. A sample config file is included with our WordPress directory. Copy the sample config file to wp-config.php:

cp wp-config-sample.php wp-config.php

The sample wp-config.php file won’t work correctly until we edit it and fill up the information with our database credentials:

nano wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wpuser');
/** MySQL database password */
define('DB_PASSWORD', 'wppassword');

Save and exit.

We’ve already given ownership to Apache, but in order for Apache to actually be able to do rewrites for your WordPress, we need to create the default .htaccess file in the Document root directory:

cd /var/www/html/
nano .htaccess

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Save and exit.

5. Complete WordPress installation directly on the web.
• You will have to choose the language you want for your WordPress.
• You need to add your site title.
• You need to choose the username you want for administrator. It’s best to avoid common or generic usernames like “admin” for security reasons.
• Wordpress will automatically create a very strong password, but you can change this to another strong password if you wish.
• You will need to add your email address.

You can now access your WordPress with the username and password set.


Your WordPress should now be installed and you’re ready to create your website. This basic setup should serve most users well, but some tweaks may be necessary depending on the way you plan to use WordPress. Explore the interface of your new CMS, and you’ll quickly see why so much of the web relies on it. Check out our list of some of the most popular WordPress plugins that will really help take your website to the next level, and take some time to learn about how to protect your WordPress site from attack.

If you liked this KB article, please share it with your friends.