First need to set up some of the background software. To do so, you will need to install three things before installing WordPress. The first one is a dynamic content processor, the second is a webserver, and the last one is a database server. To get these things, you will download Apache, MySQL, and PHP before downloading WordPress.
Install Pre-requsites as below
# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# yum install yum-utils
# yum-config-manager –disable remi-php54
# yum-config-manager –enable remi-php73
# yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt
# systemctl start mariadb
# mysql_secure_installation
# systemctl enable mariadb
# systemctl start httpd
# systemctl enable httpd
Creating WordPress MySQL Database
# mysql -u root -p
Enter password:
## Create database ##
CREATE DATABASE wordpress;
## Creating new user ##
CREATE USER wordpress@localhost IDENTIFIED BY “Password”;
## Grant privileges to database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;
## FLUSH privileges ##
FLUSH PRIVILEGES;
## Exit ##
exit
Preparing WordPress Installation
Now we are ready to download the latest WordPress archive:
# cd /tmp && wget http://wordpress.org/latest.tar.gz
Next extract the archive in our web directory:
# tar -xvzf latest.tar.gz -C /var/www/html
The above will create the following directory, which will contain our WordPress script:
/var/www/html/wordpress
Now change the ownership of that directory to user “apache”:
# chown -R apache /var/www/html/wordpress
Creating Apache Virtual Host for WordPress
We will create a separate virtual host for our WordPress install. Open /etc/httpd/conf/httpd.conf with your favorite text editor:
# vim /etc/httpd/conf/httpd.conf
And add the following code at the bottom of the file and replace the marked text with the information related to your installation:
<VirtualHost *:80>
ServerAdmin wordpress
DocumentRoot /var/www/html/wordpress
ServerName wordpress
ServerAlias wordpress
ErrorLog /var/log/httpd/tecminttest-error-log
CustomLog /var/log/httpd/tecminttest-acces-log common
</VirtualHost>
Save your changes and restart Apache:
# systemctl restart httpd
Installing WordPress on Website
Then run the following commands for reload and stop the service.
systemctl disable firewalld.service
systemctl stop firewalld.service
Configuring WordPress Installation
Copy default wp-config-sample.php to wp-config.php to configure WordPress installation.
# cd /var/www/html/wordpress
# cp wp-config-sample.php wp-config.php
Open wp-config.php file.
# vi wp-config.php
Modify the following database settings as we created in the Step #3 above.
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘database_name_here’);
/** MySQL database username */
define(‘DB_USER’, ‘username_here’);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘password_here’);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);
/** Database Charset to use in creating database tables. */
define(‘DB_CHARSET’, ‘utf8’);
/** The Database Collate type. Don’t change this if in doubt. */
define(‘DB_COLLATE’, ”);
Finishing WordPress Installation
Open your browser and type any of the following address.
Now , launch the web WordPress by http://localhost/wp-admin/install.php
Enter the Database details on Next Screen.
After that you need to enter a username, password, and an email address for your admin account.
Click on Install WordPress once details are entered.
You can login to your website by going to /localhost/website1/wp-admin page and use the username / password that you entered during installation to login.