Technical Help & Resources / Setting Up Wordpress

Setting Up Wordpress


This guide will help you to install Wordpress to your host.

The walkthrough will assume you are installing Wordpress to a new host that has no existing website and that you are already connected to your host through ssh.

Prerequisites

For Wordpress to work you will need to have MySQL installed to your host.

Different linux enviornments may result in issues trying to install it.
To avoid issues you can follow our tested method for installation below.

MySQL Installation


Setup The Database

To set up the database for Wordpress a user and the database will need to be created.

Running the commands below will create a new user named wordpress1.
Be sure to use a secure password.

sudo mysql -upgrade=FORCE -u root -p
CREATE USER 'wordpress1' IDENTIFIED BY 'Password123';

Create the database Wordpress will use and grant the user privlages.

CREATE DATABASE wordpressdb;
GRANT ALL PRIVILEGES ON wordpressdb.* TO "wordpress1"@"%";
FLUSH PRIVILEGES;
EXIT


Download Wordpress

The commands below can be ran to download the latest wordpress.

wget https://wordpress.org/latest.zip
unzip latest.zip
rm latest.zip


Copy over Files

Copy the wordpress files to the web servers root directory
The web servers root directory is located here /var/www/

rm /var/www/html/index.php
cp -r ./wordpress/* /var/www/html/
rm -Rf wordpress


Configure Wordpress

Configuration will need to be set for wordpress related to the database as well as other small settings.

Make a copy of the configuration sample file to use

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

Edit the new configuration file

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

Change/Add the following Lines

define( 'DB_NAME', 'wordpressdb' );
define( 'DB_USER', 'wordpress1' );
define( 'DB_PASSWORD', 'Password123' );
define( 'DB_HOST', '127.0.0.1' );
define( 'WP_SITEURL', 'http://yourdomain.com' );
define( 'WP_HOME', 'http://yourdomain.com' );

* Please note that WP_SITEURL and WP_HOME must be added and set to your domain to avoid issues on wordpress. Also be sure that DB_HOST is set to 127.0.0.1 insteads of localhost.

Be sure to also change these lines below. They can be replaced with keys generated from here.

define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );

If there are any issues with database connectivity you can try going through the wordpress installation wizzard by visiting your website at http://yourwebsite.com/wp-admin/ Just be sure to edit the configuration file as shown previously to add WP_SITEURL and WP_HOME values.


Set Proper File Ownership

To make sure the files have correct ownership for the apache server run the command below.

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

This will make sure the files can be read by the server and that they can be edited by the host user.


Completing Setup

Visit the URL of your website and plug in the wordpress database information based on the previous steps.

Wordpress also recomends installing these additonal modules.

sudo apt install php-dom
sudo apt install php-imagick