Install Wordpress on CentOS 7 Print

  • wordpress, wordpress centos 7, lamp centos 7
  • 348

First install and enable Remi repository using following command.

# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

We are going to use php7.3, so we need to disable php5.4 using yum-config-manager command provided by yum-utils tool.

# yum install yum-utils

# yum-config-manager --disable remi-php54

# yum-config-manager --enable remi-php73

Installing LAMP Stack on CentOS 7

Now install LAMP Stack with following commands:

# yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt nano

# systemctl start mariadb

# mysql_secure_installation

#systemctl enable mariadb

# systemctl start httpd

# systemctl enable httpd

Now Create Wordpress Mysql/MariaDB Database using following commands:

# mysql -u root -p

Enter password:

## Create database ##

CREATE DATABASE wordpress;

## Creating new user ##

CREATE USER wordpress@localhost IDENTIFIED BY "secure_password";

## Grant privileges to database ##

GRANT ALL ON wordpress.* TO wordpress@localhost;

## FLUSH privileges ##

FLUSH PRIVILEGES;

## Exit ##

exit;

Downloading and Installing Wordpress:

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

# tar -xvzf latest.tar.gz -C /var/www/html

# chown -R apache /var/www/html/wordpress

Edit Apache configuration file to create virtual host for wordpress:

# nano -w /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 [email protected]

  DocumentRoot /var/www/html/wordpress

  ServerName hosteons.com

  ServerAlias www.hosteons.com

  ErrorLog /var/log/httpd/hosteons-error-log

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

</VirtualHost>

Replace hosteons with your domain name.

Now save changes by cress CTRL-W

Restart apache with following commands:

# systemctl restart httpd

Now configure and install wordpress from web by visiting your website IP or domain (if DNS is already setup)

visit in your browser: http://VPS-IP

 


Was this answer helpful?

« Back