Read MoreThe best VPS hosting starts from $5 per month!

How To Install WordPress On Ubuntu 14.04 Server

WordPress is a one of the most powerful content management system and blogging software. If you want to install WordPress on Ubuntu 14.04 server, Then you are on right place.

Here We are going to share how to install WordPress on Ubuntu 14.04 server.

I assume you have LAMP stack installed on your Ubuntu 14.04 and if you are complete beginners and want to learn LAMP stack installation, please follow our LAMP Stack installation guide on Ubuntu 14.04.

Once you have installed and configured LAMP stack on your Ubuntu 14.04 server, Now follow the WordPress installation procedure.

How To Install WordPress On Ubuntu 14.04

The very first step is downloading WordPress to your Ubuntu 14.04 server. To download latest WordPress release type the following command in terminal.

wget https://wordpress.org/latest.tar.gz

Once latest version of WordPress downloaded to your Ubuntu server, Now extract the latest.tar.gz file so we can move all the file inside it to the server root directory. Your server’s root directory should be /var/www/html by default.

Use the following command to extract latest WordPress (That you have downloaded a few seconds ago):

tar -xvzf latest.tar.gz

Since the default Apache2 root directory on Ubuntu is /var/www/html, We need to copy/move the extracted WordPress files to that directory. In my case I’m moving WordPress files to save space on my server.

sudo mv wordpress/* /var/www/html

Above the command will move all files inside WordPress directory to /var/www/html.

One thing to confirm before moving forward is, There is no index.html file on the server root directory. After successful Apache2 installation, Apache2 place a index.html file to the server root directory by default. So If you haven’t deleted the index.html file yet, Do it now

sudo rm /var/www/html/index.html

Above the command will delete index.html from your server’s root directory.

After that, We need to create database for WordPress to store your blog data and content. As we have already MySQL database installed on our server, We just need to create a database for WordPress.

Create MySQL Database

In order to create a new MySQL database, we need to login to MySQL to create it.

mysql -u root -p

In this case I’m logging into MySQL database as root user.

Now type the root password when MySQL prompt for the password.

After that create a database using the following command:

CREATE DATABASE wordpress;

Here I’m creating database named wordpress and off-course you can change it with yours.

And then create a new user:

CREATE USER [email protected] IDENTIFIED BY 'password';

Make sure to replace wordpressuser with the database user name you want and password with your own and unique password.

Now grant the user to full access the database using

GRANT ALL PRIVILEGES ON wordpress.* TO [email protected];

Now the use has full access to the database and it’s time to refresh the database tables and exit from MySQL.

FLUSH PRIVILEGES;
exit

We are all set now. It’s time to provide database info to WordPress configuration file. But first we need to rename or copy wp-config-sample.php to wp-config.php. To do that run the following command:

sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

Now edit wp-config.php and insert database info on it:

sudo nano /var/www/html/wp-config.php

Now replace default with correct database info

/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Now save and exit the file with Ctrl + x. Before starting WordPress installation, We need to set the appropriate permission on WordPress installation so that it function correctly.

sudo chown -R www-data:www-data /var/www/html/

This will give www-data group to access and create directory and files inside this directory.

Now finish the installation by visiting your Ubuntu server’s public IP or domain name.

Hope this tutorial will help you to Install WordPress on Ubuntu 14.04. Use our discussion box below If you need further information or want to share some tweaks that can make this more easy and secure.

Tags:

Leave a Reply