Today we will learn How to Install WordPress on Ubuntu 14.04

How to Install WordPress on Ubuntu 14.04

How to Install WordPress on Ubuntu 14.04

 

What is WordPress?

WordPress is a free and open source blogging tool and a content management system (CMS) based on PHP and MySQL, which runs on a web hosting service. Features include a plugin architecture and a template system. WordPress is used by more than 22.0% of the top 10 million websites as of August 2013. WordPress is the most popular blogging system in use on the Web, at more than 60 million websites. To read more

 

How to Install WordPress on Ubuntu 14.04

The only requirement of Installing WordPress is LAMP (Linux, Apache, MySQL & PHP). If you don’t have LAMP already Installed on your server please follow the tutorial LAMP in Ubuntu 14.04.

 

Now let’s start Installing WordPress.

 

Step 1 (Create Database):

We need to create a Database for WordPress & a user who can access that Database. First of all log into MySQL account you created while setting up LAMP.

mysql -u root -p

Enter the MySQL Root Password & now you’re in the MySQL Termial. Run the below command in MySQL Terminal.

First of all we will create a Database for WordPress. (I am creating the database with the name wordpress, You can name it whatever you want.)

CREATE DATABASE wordpress;

 

Now we will create a MySQL user who will access the database. The user I am going to create is wpuser, You can create user with whatever name you like.

CREATE USER wpuser@localhost IDENTIFIED BY 'password';

 

Now we will grant the newly created user wpuser access of the database wordpress we created above.

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

 

Now the newly created user wpuser has the access to the database wordpress but we need to tell the current running instance of MySQL about the recent changes.

FLUSH PRIVILEGES;

 

Our work here is done, Just get out of the MySQL terminal by typing…

quit

 

Now you are back to the regular command prompt (Terminal)

 

Step 2 (Download WordPress & Extract it):

sudo wget http://wordpress.org/latest.tar.gz

sudo tar -xzvf latest.tar.gz

 

Just make sure you are in the Root Directory. This will create a Directory named WordPress in your Root Directory, Which contains all the files of WordPress.

 

Step 3 (Configure WordPress):

Now we will do some basic Settings in the Configuration file, But first we will change the name of the config file so wordpress can read it.

sudo cp /wordpress/wp-config-sample.php /wordpress/wp-config.php

 

Now open this file & change these lines according the database name & newly created database user.

sudo vim wordpress/wp-config.php

 

You just need to change the three lines from this file.

 

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

/** MySQL database username */

define('DB_USER', 'wpuser');

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

 

Save the file & exit the vim editor.

 

Step 4 (Copy the Files to Document Root):

Now copy all the files of the wordpress directory to the Documnet Root of the Server. (/var/www/html)

sudo mv wordpress/* /var/www/html/

 

Step 5 (Create New User):

Now we will create a new user with Restricted access.

Open the shells file & add the below line in it.

sudo vim /etc/shells
/usr/sbin/nologin

 

Now add the new user.

useradd -m userwp -s /usr/sbin/nologin
passwd userwp

 

Change ownership

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

chmod -R g+s /var/www/html

usermod -a -G userwp www-data

 

Step 6 (Complete the Installation via Web Interface):

Goto the browser & enter the domain on which you are installing the WordPress.

www.uncovertech.com/wp-admin/install.php

 

Rest of the installation is piece of cake. You just have to enter the Site Title, Username & Email etc & hit the Install WordPress button.

 

You have now successfully installed WordPress on Ubuntu 14.04. 🙂

 

Constructive Criticism is highly appreciated, Feel free to leave feedback in the comments section.