Optimizing Your Headway Powered Website – Installing WordPress

Introduction

Today we are going to walk through installing WordPress from source. We’ll be using command line tools to get the job done today. Hopefully you’ve been following along with them previously and that you are starting to get comfortable in the command line.

Step One – Get WordPress

You should already be logged into your server. We can download WordPress from it’s website with the following:

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

This will download a zipped package straight to our home directory. We can then unzip the package with the following command:

tar -xzvf latest.tar.gz

You should now have a folder called WordPress and in it you should see the typical files you see normally with your WordPress install. We are going to need to edit the wp-config.php file, but we need to first create a database and MySQL user.

Step Two – Create Database and User

We need to change gears a second and create our user and database. You almost never want to use your root user, especially when dealing with code. So let’s create a user for WordPress now.

To open a MySQL shell you need to type in the following:

mysql -u root -p

You’re going to login to MySQL with your root user, so put that password in when it prompts you to. It’s a good time to point out that all MySQL commands must end with a semi-colon.

Once we’re in to the MySQL shell, let’s first create the database we’ll be using with our install of WordPress. *Please note that you can replace the database, user name, and password with whatever you want to call them.

CREATE DATABASE wordpress_db_name;

New we need to create our new user.

CREATE USER ajs_new_wp_user@localhost;

To set the password for our new user:

SET PASSWORD FOR ajs_new_wp_user@localhost = PASSWORD("enterpasswordHERE");

We’re almost done. We have one last step while we are in here and that’s to give privileges to our new user. Without giving them privileges, the WordPress install process will not be able to run:

GRANT ALL PRIVILEGES ON wordpress_db_name.* TO ajs_new_wp_user@localhost IDENTIFIED BY 'enterpasswordHERE';

And finally let’s refresh MySQL:

FLUSH PRIVILEGES;

Now we can exit out of the MySQL shell:

exit

Step Three – Change Settings in WordPress’ wp-config.php File

Since WordPress doesn’t automatically come with a wp-config.php file, we need to copy the sample file over so we can edit it and add our information to it.

cp ~/wordpress/wp-config-sample.php ~/wodpress/wp-config.php

Next, let’s open up the config file:

sudo nano ~/wordpress/wp-config.php

Now we need to find the MySQL section in order to edit our information in there.

// ** MySQL settings - You can get this info from your web host **//
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_db_name');
/** MySQL database username */
define('DB_USER', 'ajs_new_wp_user');
/** MySQL database password */
define('DB_PASSWORD', 'enterpasswordHERE');

Now save and exit the file.

Step Four – Copy files

Our final step is to transfer our unzipped WordPress folder to our website’s root directory.

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

We need to set the permissions on the folder as well, but we need to switch into the new directory so let’s do that now:

cd /var/www/

We’ll give ownership of the directory to the Apache user:

sudo chown www-data:www-data * -R
sudo usermod -a -G www-data ajmorris

*Remember to replace “ajmorris” with your username you use to login to your server.

We can now use WordPress’ own easy to follow installation form online. In order to get that form to run properly, we may need to install a small component on the server. If you run into problems run the following command:

sudo apt-get install php5-gd

Step Five – Checking Our Results!

Our WordPress installation page is up and waiting for us. Let’s access the page by adding /wp-admin/install.php to your site’s domain or IP address and fill out the short form.

And there we have it. WordPress should be configured and installed. You’re homework for the night is to start installing plugins and Headway.

I’ll catch you back here next week as we have another installment on Optimizing our WordPress site.

Spread the word!

Leave a reply

Copyright © 2016 Vesped Inc. All Rights Reserved. Proudly Powered by Headway and WordPress