WordPress installation procedure

 

Start by updating your CentOS virtual machine :

[root@localhost ~]# yum update

LAMP installation

Apache server installation

Install “httpd” :

[root@localhost ~]# yum install -y httpd

Start “httpd” :

[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl is-active httpd.service
active

Enable both “http” and “https” services (currently disabled by “FirewallD”) :

[root@localhost ~]# firewall-cmd --permanent --add-service=http
success
[root@localhost ~]# firewall-cmd --permanent --add-service=https
success
[root@localhost ~]# firewall-cmd --reload
success

Use a browser to check Apache :

centoshttpd

 

 

 

 

 

 

 

 

 

 

 

 

Enable “httpd” service across reboot :

[root@localhost ~]# systemctl enable httpd.service
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'

MySQL installation

Install MySQL (today known as “MariaDB”) :

[root@localhost ~]# yum install -y mariadb-server mariadb

Start “MariaDB” now :

[root@localhost ~]# systemctl start mariadb.service

And keep it started after next reboot :

[root@localhost ~]# systemctl enable mariadb.service
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'

Improve MySQL Installation Security :

[root@localhost ~]# mysql_secure_installation

Check MariaDB connection :

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit

PHP installation

Install PHP :

[root@localhost ~]# yum install -y php php-mysql

Restat Apache server :

[root@localhost ~]# systemctl restart httpd.service

Test PHP :

  • Create this short example file
[root@localhost ~]# cat /var/www/html/hello.php
<?php Print "here is my first PHP page"; ?>
  • Launch this page from your browser

centoshttpd1

 

 

 

 

PHP graphics library for images manipulation

Install this PHP module :

[root@localhost ~]# yum install -y php-gd

Restat Apache server :

[root@localhost ~]# systemctl restart httpd.service

Verify if  this module is loaded or not :

[root@localhost ~]# php -m | grep gd
gd

WordPress

Create a database for WordPress

We’ll create the wordpress “database”, then the “wordpressuser@localhost” account and set all privileges for this user on this data base :

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.44-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user wordpressuser@localhost identified by 'my_password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on wordpress.* to wordpressuser@localhost identified by 'my_password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye

Download WordPress

Install “wget” if you haven’t already yet :

[root@localhost ~]# yum install -y wget

Download WordPress :

[root@localhost ~]# wget -P /tmp https://wordpress.org/latest.zip

Install “unzip” if you haven’t already yet :

[root@localhost ~]# yum install -y zip unzip

Go to “/tmp” and unzip :

[root@localhost ~]# cd /tmp
[root@localhost tmp]# unzip -q latest.zip

Copy files to “/var/www/html” directory :

[root@localhost tmp]# cp -rp wordpress/* /var/www/html/.

Go to this directory :

[root@localhost tmp]# cd /var/www/html

Create this subdirectory :

[root@localhost html]# mkdir wp-content/uploads

Edit configuration file :

  • Copy from the sample :
[root@localhost html]# cp -p wp-config-sample.php wp-config.php
  • Edit “DB_NAME” ; “DB_USER” and “DB_PASSWORD” values :
[root@localhost html]# grep -E "DB_NAME|DB_USER|DB_PASSWORD" wp-config.php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'my_password');

Chance files owner to “Apache” :

[root@localhost html]# pwd
/var/www/html
[root@localhost html]# id apache
uid=48(apache) gid=48(apache) groups=48(apache)
[root@localhost html]# chown -R apache:apache .

Finaly Restart Apache :

[root@localhost html]# systemctl restart httpd.service

Connect to your WordPress instance

mywordpress

 

 

 

 

 

 

 

 

 

 

 

Let’s go on with installation :

mywordpress1

 

 

 

 

 

 

 

 

 

 

 

mywordpress2

 

 

 

 

 

 

 

Your WordPress instance is here :

mywordpress3

PDF24    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*