How to setup WordPress

Install the packages:

required packages
root@wordpress:~# apt install apache2 libapache2-mod-php mariadb-server php-mysql

Start the web server

starting of web server
root@wordpress:~# svcs http
STATE          STIME    FMRI
disabled        8:13:12 svc:/network/http:apache24
root@wordpress:~# svcadm enable http
root@wordpress:~# svcs http
STATE          STIME    FMRI
online          8:14:14 svc:/network/http:apache24

Now the web server works, check it by your web browser:

Now we need to start a database server. We installed MariaDb to use it as the main server, let's start it:

starting of mariadb
root@wordpress:~# svcs mariadb
STATE          STIME    FMRI
disabled        8:13:11 svc:/database/mariadb:default
root@wordpress:~# svcadm enable mariadb
root@wordpress:~# svcs mariadb
STATE          STIME    FMRI
online          8:17:00 svc:/database/mariadb:default

Create a database user for the CMS and assign privileges for a database to it:

creating of database and user
root@wordpress:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.23-MariaDB-2 DilOS n/a

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create user 'wp'@'localhost' identified by 'VerySecretPassword';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on wordpress.* to 'wp'@'localhost';
Query OK, 0 rows affected (0.00 sec)

Let's check it:

testing of database account
root@wordpress:~# mysql -u wp -p wordpress
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.23-MariaDB-2 DilOS n/a

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [wordpress]> Bye

It works, as we expceted it. It's time to install our CMS. Download the latest archive from the site (https://wordpress.org/latest.tar.gz) and upack it to the root directory of the web server (/var/www/html, if you did not change it). Also don't forget to change owner of the wordpress directory:

changing owner of the directory
root@wordpress:/var/www/html# chown -R webservd:webservd wordpress
root@wordpress:/var/www/html# ls -l wordpress
total 94
-rw-r--r--  1 webservd webservd   418 Sep 25  2013 index.php
-rw-r--r--  1 webservd webservd 19935 Jan  2 20:58 license.txt
-rw-r--r--  1 webservd webservd  7413 Dec 12  2016 readme.html
-rw-r--r--  1 webservd webservd  5447 Sep 28  2016 wp-activate.php
drwxr-xr-x  9 webservd webservd    89 Jun  8 17:29 wp-admin
-rw-r--r--  1 webservd webservd   364 Dec 19  2015 wp-blog-header.php
-rw-r--r--  1 webservd webservd  1627 Aug 29  2016 wp-comments-post.php
-rw-r--r--  1 webservd webservd  2853 Dec 16  2015 wp-config-sample.php
drwxr-xr-x  4 webservd webservd     5 Jun  8 17:29 wp-content
-rw-r--r--  1 webservd webservd  3286 May 24  2015 wp-cron.php
drwxr-xr-x 18 webservd webservd   187 Jun  8 17:29 wp-includes
-rw-r--r--  1 webservd webservd  2422 Nov 21  2016 wp-links-opml.php
-rw-r--r--  1 webservd webservd  3301 Oct 25  2016 wp-load.php
-rw-r--r--  1 webservd webservd 34327 May 12 20:12 wp-login.php
-rw-r--r--  1 webservd webservd  8048 Jan 11 08:13 wp-mail.php
-rw-r--r--  1 webservd webservd 16200 Apr  6 21:01 wp-settings.php
-rw-r--r--  1 webservd webservd 29924 Jan 24 14:08 wp-signup.php
-rw-r--r--  1 webservd webservd  4513 Oct 14  2016 wp-trackback.php
-rw-r--r--  1 webservd webservd  3065 Aug 31  2016 xmlrpc.php

Now we need to configure the CMS (see the primady doctumentation). Copy wp-config-sample.php to wp-config.php and edit it. You should change the account to access the database you have created.

creating of the configuration
root@wordpress:/var/www/html# cd wordpress/
root@wordpress:/var/www/html/wordpress# cp -f wp-config-sample.php wp-config.php
root@wordpress:/var/www/html/wordpress# less wp-config.php

Before editing:


And after we changed the database account:


Don't forget to change the owner of the configuration (we work as the system administrator)

changing of the owner
root@wordpress:/var/www/html/wordpress# ls -l
total 96
-rw-r--r--  1 webservd webservd   418 Sep 25  2013 index.php
-rw-r--r--  1 webservd webservd 19935 Jan  2 20:58 license.txt
-rw-r--r--  1 webservd webservd  7413 Dec 12  2016 readme.html
-rw-r--r--  1 webservd webservd  5447 Sep 28  2016 wp-activate.php
drwxr-xr-x  9 webservd webservd    89 Jun  8 17:29 wp-admin
-rw-r--r--  1 webservd webservd   364 Dec 19  2015 wp-blog-header.php
-rw-r--r--  1 webservd webservd  1627 Aug 29  2016 wp-comments-post.php
-rw-r--r--  1 webservd webservd  2853 Dec 16  2015 wp-config-sample.php
-rw-r--r--  1 root     root      2853 Jun 26 08:44 wp-config.php
drwxr-xr-x  4 webservd webservd     5 Jun  8 17:29 wp-content
-rw-r--r--  1 webservd webservd  3286 May 24  2015 wp-cron.php
drwxr-xr-x 18 webservd webservd   187 Jun  8 17:29 wp-includes
-rw-r--r--  1 webservd webservd  2422 Nov 21  2016 wp-links-opml.php
-rw-r--r--  1 webservd webservd  3301 Oct 25  2016 wp-load.php
-rw-r--r--  1 webservd webservd 34327 May 12 20:12 wp-login.php
-rw-r--r--  1 webservd webservd  8048 Jan 11 08:13 wp-mail.php
-rw-r--r--  1 webservd webservd 16200 Apr  6 21:01 wp-settings.php
-rw-r--r--  1 webservd webservd 29924 Jan 24 14:08 wp-signup.php
-rw-r--r--  1 webservd webservd  4513 Oct 14  2016 wp-trackback.php
-rw-r--r--  1 webservd webservd  3065 Aug 31  2016 xmlrpc.php
root@wordpress:/var/www/html/wordpress# chown webservd:webservd wp-config.php
root@wordpress:/var/www/html/wordpress# ls -l
total 96
-rw-r--r--  1 webservd webservd   418 Sep 25  2013 index.php
-rw-r--r--  1 webservd webservd 19935 Jan  2 20:58 license.txt
-rw-r--r--  1 webservd webservd  7413 Dec 12  2016 readme.html
-rw-r--r--  1 webservd webservd  5447 Sep 28  2016 wp-activate.php
drwxr-xr-x  9 webservd webservd    89 Jun  8 17:29 wp-admin
-rw-r--r--  1 webservd webservd   364 Dec 19  2015 wp-blog-header.php
-rw-r--r--  1 webservd webservd  1627 Aug 29  2016 wp-comments-post.php
-rw-r--r--  1 webservd webservd  2853 Dec 16  2015 wp-config-sample.php
-rw-r--r--  1 webservd webservd  2838 Jun 26 08:47 wp-config.php
drwxr-xr-x  4 webservd webservd     5 Jun  8 17:29 wp-content
-rw-r--r--  1 webservd webservd  3286 May 24  2015 wp-cron.php
drwxr-xr-x 18 webservd webservd   187 Jun  8 17:29 wp-includes
-rw-r--r--  1 webservd webservd  2422 Nov 21  2016 wp-links-opml.php
-rw-r--r--  1 webservd webservd  3301 Oct 25  2016 wp-load.php
-rw-r--r--  1 webservd webservd 34327 May 12 20:12 wp-login.php
-rw-r--r--  1 webservd webservd  8048 Jan 11 08:13 wp-mail.php
-rw-r--r--  1 webservd webservd 16200 Apr  6 21:01 wp-settings.php
-rw-r--r--  1 webservd webservd 29924 Jan 24 14:08 wp-signup.php
-rw-r--r--  1 webservd webservd  4513 Oct 14  2016 wp-trackback.php
-rw-r--r--  1 webservd webservd  3065 Aug 31  2016 xmlrpc.php

Well, done... Let's test it:

Just fill all fields in this page and click "Install WordPress"

Now just log in the site:

That's all, so easy (wink)