4

Now all the components are installed and configured we can now install WordPress.

Create a Database

The first thing we need to do is create a database, we will use the MySQL command:

Enter the password you created for the root user

Enter the commands below to create a new database and user, remember to set your own names:

Get the latest WordPress Installation

Enter the commands below to download the latest version of WordPress and unpack the files:

Configure WordPress

Move into the wordpress directory:

$ cd ~/wordpress

We need to create the wp-config.php file, the easiest way is to copy the sample and then edit the file:

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

Now we can edit the file:

$ nano wp-config.php

We need to enter the correct details for the database name, user name and password:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'spacedata');
/** MySQL database username */
define('DB_USER', 'spaceman');
/** MySQL database password */
define('DB_PASSWORD', 'P@55w0rd');

We also need to enter the Authentication and Salt keys, the easiest way is to visit the online WordPress Salt Generator, this will generate all the required salts etc, copy the text and paste it into your wp-config.php file:

define('AUTH_KEY',         'v]s-+3LDJ7|omwaqSgI&(-?{2{qS-oOrvcFQ`RO+3}!5)&$z^V;6*KG>Y6M#apL.');
define('SECURE_AUTH_KEY',  '8QAnhPH(B.y#zX+6HE2}EkFL)S%V-!] CaPP>qJ+O!TV34 M`ZAH7iA~+ o&jo!a');
define('LOGGED_IN_KEY',    ',(Crlf>m~&*.e.UK&n2s|HR/t+LsNAse)]IUM)Z?|#WBgH;`72^8v,|NQQ.!JRg=');
define('NONCE_KEY',        'C}TvgOubBF48la6;6Mn:3.aCaHmGRZ@f%@ZQ@snsxW$w=EK&{/`7h|hNTpfI9o:+');
define('AUTH_SALT',        '<A-F4/:,Iv,TLhZ+zJ(ZP5vwE}^qohvSjiwhF0/0^c!#6KwC./OjBWnQB D&*lPA');
define('SECURE_AUTH_SALT', 'z]7<s.ue|xl95_S{5a12BrH;+sscZ`!&{wd<zOV};+g2<s5JXh MX>+::ACNj1R$');
define('LOGGED_IN_SALT',   'HuajOI3^V%4j$xmp>pslSh2E`F_crItJ&IhSHTZZTydu5Dt[t}/qxKyF-+X^cbqo');
define('NONCE_SALT',       'Cp)|c>N+(w`+}#Q}Yg[S96Sa TW:6s$/~wMwi^eC92eMU )zNR@%`L_6]x}:_;x-');

We also need to the change the table prefix from the default, find the line:

$table_prefix = 'wp_';

Change the ‘wp’ to any random collection of characters:

$table_prefix = 'qhl_';

Save and close the file.

Copy the files to the root of the website

We will be using rsync to copy the files to the document root of our website, /usr/share/nginx/html.

$ sudo rsync -avP ~/wordpress/ /usr/share/nginx/html

All the files will be copied over to the correct directory.

The last thing is to update the permissions:

$ cd /usr/share/nginx/html

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

We need to create an uploads directory and also assign correct permissions:

$ sudo mkdir /usr/share/nginx/html/wp-content/uploads

$ sudo chown -R :www-data  /usr/share/nginx/html/wp-content/uploads

Now everything is ready and you can complete the installation via your web browser.  Go to http://servername or IP address