Sofia
Bulgaria 1000
8835.1001289.0363
sales@linuxssdvps.com
support@linuxssdvps.com

How To Install WordPress on Ubuntu 14.x and Ubuntu 15.x

How To Install Wordpress on Ubuntu 14.x and Ubuntu 15.x
[vc_mad_single_image image=”3556″ alignment=”center” onclick=”link_image” img_size=”full”]

At this moment, WordPress is the most widely used CMS (content management system) on the internet. It enables you to quickly set up flexible blogs and web sites on top of a MySQL backend with PHP processing. WordPress has enjoyed incredible adoption and is a fantastic choice for getting a web site up and running quickly.

In this manual, we’ll focus on getting a WordPress instance setup with an Apache web server on Ubuntu 14.04.
Requirements

Prior to you begin this manual, there are some crucial actions that you need to complete on your server.

We will be moving forward through these steps as a non-root user with sudo privileges, so you will need to have actually one available. You can find how to create a user with sudo privileges by following steps 1-4 in our Ubuntu 14.04 server setup guide for begginers.

In addition, you’ll need to have a LAMP (Linux, Apache, MySQL, and PHP) stack installed on your VPS instance. If you don’t have these types of components already installed and configured, you can use this guide to learn how to install LAMP on Ubuntu 14.04.

When you are done with these things, you can carry on with this tutorial.

Step 1 — Create a MySQL Database and User for WordPress

The 1st step that we will take is a preparatory one. WordPress uses a relational data-base to manage and store site content and user information.

We have MySQL installed already, which can provide this functionality, but we have to make username and database for WordPress to work with.

In order to get started, log into the MySQL root (administrative) account by issuing this command:

mysql -u root -p

You’ll be prompted for the security password you had set for the MySQL root account when you firstly installed the software. You will then be given a MySQL command prompt.

First of all, we will create a separate database that WordPress will control. You can name it anything you would like, but We will be calling it wordpress because it is descriptive and simple. Excecute this command to create the database:

CREATE DATABASE wordpress;

Each and every MySQL statement must end in a semi-colon (;), so always check to make sure this is present if you are running into any issues.

After that, we are going to make a separate MySQL user account that we will use only to operate on our brand new database. Creating one-function databases and unique accounts is a good idea from a management and safety standpoint.

We are going to call the new account that We are making wordpressuser and will assign it a password of password. You must definitely change the password for your installation and can name the user anything you’d like. This is the command you need to create the user:

CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';

By now, you have a database and a user account, each made specifically for WordPress. However, these two components have no relationship yet. The user has no access to the database.

Let’s correct that by granting our user account access to our data-base with this command:

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

Now the username has access to the database. We need to flush the rights so that the current instance of MySQL knows about the recent right changes we’ve made:

FLUSH PRIVILEGES;

We’re all set now. We can exit out of the MySQL prompt by typing:

exit

You should now be back to your regular command prompt.

Step 2 — Download WordPress

Next, we will download the actual WordPress files from the official project’s website.

Luckily, the WordPress team always links the most recent stable version of their software to the same URL, so we can get the most up-to-date version of WordPress by typing this:

cd ~
wget http://wordpress.org/latest.tar.gz

This will download a compressed file that contains the archived directory contents of the WordPress files to our home directory.

We can extract the files to rebuild the WordPress directory we need by typing:

tar xzvf latest.tar.gz

This will build a directory called wordpress in your /home directory.

While we are downloading things, we should also get a few more packages that we need. We can get these directly from Ubuntu’s default repositories after we update our local package index:

sudo apt-get update
sudo apt-get install php5-gd libssh2-php

This will permit you to work with photos and will also let you to install plugins and update portions of your site using your SSH login credentials.

Step 3 — Configure WordPress

Most of the setting that we will be doing will be through a web interface later on. And yet, we do need to do some work from the command line prior we can get this up and running.

Begin by moving into the WordPress directory that you just unpacked:

cd ~/wordpress

A example configuration file that generally matches the configuration we need is included by default. However, we need to copy it to the default configuration file location to get WordPress to recognize the file. To do that now by typing:

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

Now that we have a configuration file to work with, let’s open it in a text editor:

nano wp-config.php

As We stated before, this file is almost entirely suitable for our needs already. The only changes we need to make are to the parameters that hold our database information.

We will need to find the options for DB_NAME, DB_USER, and DB_PASSWORD in order for WordPress to correctly connect and authenticate to the database we created.

Fill in the values of these parameters with the information for the database you created. It should look like this:

// ** 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', 'wordpressuser');

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

These are the only values that you need to change.

When you are finished, save and close the file.

Step 4 — Copy Files to the Document Root

Now that we have our application configured, we would need to copy it into Apache’s document root, where it can be served to visitors of our web site.

One of the simplest and most reliable way of transferring files from directory to directory is with the rsync command. This saves permissions and has good data integrity features.

The location of the document root in the Ubuntu 14.x / 15.x LAMP guide is /var/www/html/. We can transfer our WordPress files there by typing:

sudo rsync -avP ~/wordpress/ /var/www/html/

This will safely copy all of the contents from the directory you unpacked to the document root.

Now we need to move into the document root to make some final permissions changes

cd /var/www/html

You will have to modify the ownership of our files for increased security.

We want to give user ownership to the regular, non-root user (with sudo privileges) that you plan on using to interact with your site. This can be your regular user if you wish, but some may recommend that you create an additional user for this process. It is up to you which you choose.

For this manual, we will use the same account that we set up during the initial server setup tutorial, which we called demo. This is the account We are performing all of the actions of this guide as.

The group ownership we will give to our web server process, which is www-data. This will permit Apache to interact with the content as necessary.

We can quickly assign these ownership values by typing:

sudo chown -R demo:www-data *

This will set up the ownership properties that we are looking for.

While we are working with ownership and permissions, we should also look into assigning correct ownership on our uploads directory. This will let us to upload images and other content to our site. Currently, the permissions are too restrictive.

First, let’s manually generate the uploads directory beneath the wp-content directory at our document root. This will be the parent directory of our content:

mkdir /var/www/html/wp-content/uploads

We have a directory now to house uploaded files, however the permissions are still too restrictive. We need to allow the web server itself to write to this directory. We can do this by assigning group ownership of this directory to our web server, like this:

sudo chown -R :www-data /var/www/html/wp-content/uploads

This will allow the web server to create files and directories under this directory, which will permit us to upload content to the server.

Step 5 — Complete Installation through the Web Interface

Now that you have your files in place and your software is configured, you can complete the installation through the web interface.

In your web browser, navigate to your server’s domain name or public IP address:

http://server_domain_name_or_IP

You will see the WordPress initial configuration page, where you will create an initial administrator account:

wordpress-install

Fill in the data for the site and the administrative account you wish to make. When you are finished, click on the install button at the bottom.

WordPress will verify the installation, and then ask you to log in with the account you just created:

confirm_install

Are you looking for Offshore VPS Hosting for your WordPress site?

Check our plans now -> click here


Leave a Reply

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

Themetf