In the last part of this series we’ve learned how to setup the server by installing LAMP stack and connecting your domain in to the server with Apache2 virtual hosts. Now let’s move on to building the site for your visitor. We will be using the last domain we setup with the apache2 virtual hosts.
For now we will be using WordPress as the CMS (Content Management System) to serve the content for our visitor, so let’s installing the WordPress to our server.
Step One – Preparing Database
First open up your SSH console, and then insert this command
mysql -u root -p
Next create a database:
mysql> CREATE DATABASE nsc_db;
Create new user which will given permission later for working with the database:
mysql> CREATE USER 'nsc_user'@'localhost' IDENTIFIED by 'password';
We will need to grant usage for our new user:
mysql> GRANT USAGE on *.* to nsc_user@localhost IDENTIFIED by 'password';
USAGE is a way to tell MySQL that an account exists without conferring any real privileges to that account. They have merely permission to use MySQL, hence
USAGE. It corresponds to a row in the `mysql`.`user` table with no privileges set.
Now we need to give privileges for the user to work with our new database.
mysql> GRANT ALL PRIVILEGES on nsc_db.* to nsc_user@localhost; mysql> FLUSH PRIVILEGES;
That’s all on database, exit your MySQL with:
Step Two – Downloading WordPress
First, we will need to go to the directory we created in the previous tutorial for our WordPress installation.
If you have index.html on this directory remove it first
sudo rm -rf .index.html
Now that we have reached the correct directory we will download WordPress using the
sudo wget http://wordpress.org/latest.tar.gz
After the downloading try listing your directory file with
You’ll see the archive file in your directory, we will need to extract the archive file by using this command:
sudo tar xfz latest.tar.gz
After the extraction done, if you do another listing, you’ll see
wordpress/ directory and
So to shift the files back to where they should be use the following commands:
sudo mv wordpress/* ./
This command moves the contents of the
wordpress directory into the current directory. Anytime you want to check what the current directory consists of, type
You can delete both the
wordpress directory and the archive file you downloaded if you want using the following commands:
sudo rm -rf wordpress sudo rm -rf latest.tar.gz
Step Three – Installing WordPress
There are two ways of installing WordPress, you can got to your domain.com now since the wordpress is installed there or by modifying the
wp-config.php. The easiest way will be to go to your domain.com and setup the installation there.