How to install Wordpress in CenOS 7

How to install Wordpress in CenOS 7

WordPress is a blogging platform and content management system. WordPress, according to wordpress.org, is "a cutting-edge semantic personal publishing platform with a focus on aesthetics, Web standards, and usability." You can use this platform to create and manage a website without any coding knowledge. This software allows you to customise almost every aspect of your website.


The latest version of WordPress requires PHP 7.3 or later, so you'll need to install the Remi repository first.



Step 1: Log in to the database server.


Command : # sudo mysql -u root -p





Step 2: Create a database for WordPress, user, grant permissions, flush privileges and after that exit from mysql by using following command .


Commands :


CREATE DATABASE wordpressdb;

CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'Abcd@1234';

GRANT ALL ON wordpressdb.* TO 'wordpress_user'@'localhost';

FLUSH PRIVILEGES;

EXIT;




















Step 3 : Restart mysqld service .


Command : # systemctl restart mysqld 




Step 4: Download the WordPress tarball from the WordPress repository .


Command : # cd /tmp && sudo wget http://wordpress.org/latest.tar.gz





Step 5 : extract the WordPress tarball file a shown.


Command : # sudo tar -xvf latest.tar.gz





Step 6 :Move the ‘WordPress’ folder to the Webroot directory /var/www/html as shown .


Command : # sudo mv wordpress /var/www/html/







Step 7 : Now change the ownership of that directory to user “apache”.

Command : # chown -R apache /var/www/html/wordpress .





Step 8 : change directory to /var/www/html/wordpress .

Command : cd /var/www/html/wordpress



Step 9 : Proceed and rename the wp-config-sample.php to wp-config.php .


Command :  mv wp-config-sample.php wp-config.php



Step 10 : Now , open the file wp-config.php and edit the database , user and password record for Wordpress .

Command :  vi wp-config.php



Edit the database name, user name and password mentioned in step 2 as shown in the screenshot below.
press 'i' for insert mode


Save and exit the file by pressing ‘ESC’ and then ‘:wq’ .

Step 11: We will create a separate virtual host for our WordPress install. Open /etc/httpd/conf/httpd.conf with your favorite text editor:

Command : # vi /etc/httpd/conf/httpd.conf




press 'i' for the insert mode and add the following code at the bottom of the file and replace the marked text with the information related to your installation:


For domain :- 


<VirtualHost *:80>

  ServerAdmin your_domainname 

  DocumentRoot /var/www/html/wordpress

  ServerName your_domainname

  ServerAlias www.your_domainname

  ErrorLog /var/log/httpd/tecminttest-error-log

  CustomLog /var/log/httpd/tecminttest-acces-log common

</VirtualHost>


OR for IP (Testing)


<VirtualHost *:80> 

  DocumentRoot /var/www/html/wordpress

</VirtualHost>




 

Save and exit the file by pressing ‘ESC’ and then ‘:wq’ .


Step 12 : To begin the installation, navigate to your server's IP address at http://ip-address, or if installing locally, navigate to http://localhost, or if using a real domain, navigate to the domain. You should look at the following webpage.




Enter all the necessary information and login to wordpress dashboard .





THANK YOU !