WordPress: Everything you need to know to install the CMS
Updated on , by Jacky Thierry, in the category #Wordpress

Discover WordPress
1 – What is WordPress
WordPress is today by far the most famous and used CMS (content managing system). It is a tool who offers you to easily setup a website without any knowledge in web development and any coding skill.
Released in 2003, WordPress is a free open-source project, managed by the community and closely associated with the company Automattic, founded by Matt Mullenweg, the co-creator of WordPress.
1.1 How WordPress works
WordPress is developed in PHP, and uses Mysql for its database. It includes :
- A core : the main part of WordPress, including an administration interface.
- A Theme : created by community or commercial companies. This component will change the design of your site.
- Plugins : created by the community or commercial companies. Theses tools will add some functionalities to your site.
1.2 When you should use WordPress
It is mostly used in the following cases :
- Build a blog
- Build a one page site
- Build a full website
- Build an e-commerce shop
- Build a forum
2 – Why you should use a CMS
2.1 What is a CMS
CMS means Content Managing System. The main goal of a CMS is to make easy the management of your content. It manages by his own all the technical parts to let you focus on your content, by writing, editing and displaying it.
2.2 CMS vs Framework
A framework is a software for developers, including some pre developed functionalities and libraries. Its main goal is to facilitate the development of an application by bringing some already coded functionalities.
- A CMS brings more functionalities and focus on the content. It’s aiming mainly people without programming skill, but also developers.
- A framework brings just technical parts and some libraries. It’s aiming only developers, as you will have to code your website above it.
2.3 When to use a CMS over a framework (the 50% rule)
If you don’t have any coding knowledge or if you don’t want to develop anything, use a CMS, a framework is not meant for you.
If you are a developer, and thinking about the basis of your application, both solutions can be good.
For me, when i have to choose between a CMS and a framework for a website, i check the specific features of my application who are not included in a CMS (core + theme + plugins). If i have to build more than 50% of my application’s features on a CMS, i choose a framework who will bring me more freedom to build and will probably be faster.
2.4 WordPress, both a CMS and a framework
WordPress was built to be at the border between a CMS and a framework. From initially a CMS, this software was designed to be easily developed above. It contains a smart system of hooks, to allow you to add some functionalities in all the process of the CMS, and can so be easily used as a framework.
3 – Hosting WordPress
3.1 Self-hosting
Self hosting is the best solution for freedom and control. You can optimize yours servers and website and are not limited in components. See my article to discover why you should self host your webserver.
3.2 WordPress.com vs WordPress.org
You can both host your website on wordpress.com and wordpress.org (although wordpress.org redirect you to thirds hosting companies). But be careful, the solutions are very different on few points :
- Range : WordPress.com allows you to just manage your wordpress throught a web interface. WordPress.org gives you full control on a webserver (already configured)
- Price : WordPress.com is free and can be enough for new bloggers. It also includes premium options to upgrade your features. wordpress.org is a paid solution, you’re renting a server each month.
- Domain Name : WordPress.com does not allow you to have your own domain name, excepting by buying premium options. You can use your own domain name on wordpress.org servers.
- Limitations : WordPress.com limits some features on your wordpress (you have a limited themes or plugins available to use). It also includes publicity and a limited stockage. You’re totally free on wordpress.org
- Maintenance : You don’t have any maintenance to do on wordpress.com, but you have to update your server on wordpress.org
4 – WordPress Market Share
- WordPress is now used by 29.6% of websites (in january 2018).
- Since 2011, the market share of wordpress grows by around 2% each year.
- WordPress is used by 60% of websites using a CMS (january 2018)
- The CMS the most used after WordPress is Joomla, with only 6.5% of market share (janaury 2018)
- The version 4 of WordPress (the latest in janary 2018) is used by 94.2% of wordpress websites
Source : WordPress global market share, WordPress CMS market share, WordPress usage overview
Install WordPress
1 – Requirements
Before installing WordPress, you will need a functional webserver. I invite you to read and follow my ultimate guide to setup a secure LEMP server.
You will also need curl to download some WordPress configuration later :
apt install -y curl
2 – Copy WordPress
First, you need to download WordPress from the official source :
wget https://www.wordpress.org/latest.tar.gz && tar xzvf latest.tar.gz -C /var/www/
You will now have your CMS in the folder /var/www/wordpress
3 – Configure Nginx
Before configuring your virtualhost in Nginx, start by creating the log folder and give it the right permissions for your nginx user to write inside it :
mkdir /var/log/nginx/wordpress/
chown -R www-data /var/log/nginx/wordpress/
You can now make your vhost :
vi /etc/nginx/sites-available/www.website.com.conf
server { server_name www.website.com; listen 80; port_in_redirect off; access_log /var/log/nginx/wordpress/access.log; error_log /var/log/nginx/wordpress/error.log warn; root /var/www/wordpress/; index index.php; location / { try_files $uri $uri/ /index.php?$args; } # Cache static files for as long as possible location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|cur)$ { expires max; log_not_found off; access_log off; } # Deny public access to wp-config.php location ~* wp-config.php { deny all; } location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
Finally, activate the vhost and restart your service
ln -s /etc/nginx/sites-available/www.website.com.conf /etc/nginx/sites-enabled/www.website.com.conf
service nginx restart
This vhost is a basic one to start with WordPress, i strongly advise you to strengthen it :
- Add SSL certificates and Diffie-Hellman : see my article on how to implement SSL in Nginx
- Add security options : see my article on how to improve security in Nginx
- Add performances options : see my article on how to improve performances in Nginx
3 – Configure MariaDB
After Nginx, you need to create a new database and a new user to access it for your wordpress website :
mysql -u root -p
create DATABASE wordpress; GRANT ALL ON wordpress.* TO 'user'@'localhost' IDENTIFIED BY 'password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; FLUSH PRIVILEGES; QUIT;
4 – Configure WordPress options
The configuration file is wp-config.php. Let’s start by adding some DB security it and writing the necessary configuration for our database and options :
echo '<?php' > /var/www/wordpress/wp-config.php && curl https://api.wordpress.org/secret-key/1.1/salt/ >> /var/www/wordpress/wp-config.php
vi /var/www/wordpress/wp-config.php
define('DB_NAME', 'wordpress'); define('DB_USER', 'user'); define('DB_PASSWORD', 'password'); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); $table_prefix = 'DG5fd_'; //put random characters instad of 'wp' define('WPLANG', 'en_US'); define('WP_DEBUG', false); if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); require_once(ABSPATH . 'wp-settings.php');