An easy way to build a website is by using a content management system like WordPress or Magento. Here, we will create a WordPress site, a database and a database user.
To setup the server, you will need to follow the Part One of this series. Add virtual host by following Part Two. To setup database management tool, phpMyAdmin, see the Part Three.
Create a MySQL Database and User for WordPress using phpMyAdmin or from command line.
From the phpMyAdmin interface, click on users and add a new one. Tick the option create database with same name and grand all privileges option to get thinks done fast.
Now we will move on to install WordPress. Move to the base directory of the website.
$ cd /var/www/site1/public_html
Download the latest WordPress version and extract it. You may want to move the contents in the folder wordpress to public_html. The file does not contains the uploads folder and we will need to make one.
$ wget http://wordpress.org/latest.tar.gz $ tar -xvzf latest.tar.gz $ mv wordpress/* . $ rm -rf wordpress latest.tar.gz $ mkdir wp-content/uploads
Now we will edit the WordPress configuration and change the database. For that, first create the configuration file from the default sample.
$ cp wp-config-sample.php wp-config.php // ** 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', 'wordpress');
/** MySQL database password */ define('DB_PASSWORD', 'password'); /** MySQL hostname */ define('DB_HOST', 'localhost');
Now, you can complete the WordPress installation through the web interface. First, remove the test index.html that we have made in the previous parts so that the index.php will be loaded when the site is called. You may want to add host entry on your local machine and you can follow it in the Part two of this documentation.
Fill in the details and click on Install WordPress.
You will get a success page if everything goes right. Now login using the admin details to get to dashboard and edit the site.
Try calling the site and see the homepage.
You have now successfully installed WordPress on your server. Now you can add posts, pages or customize your site.