Installing WordPress on CentOS 7

Today we are going to show you how to install WordPress on CentOS 7 using Apache web server and MySQL database.

WordPress is web software that you can use to create a beautiful website or blog. The open source CMS WordPress is often used as a blog for publishing applications using PHP and MySQL. WordPress is currently the most popular blogging platform available.

Before starting the installation, make sure you have the LAMP stack installed on your server. If not, then follow our tutorial on how to install LAMP (Linux Apache, MariaDB and PHP) on CentOS 7.

Update the system

First make sure your CentOS 7 is fully up to date using the following command:

yum update

Install WordPress

Enter a directory of your choice and download WordPress. We are using the / opt directory.

cd /opt

Install wget and unzip, which are required for further installation:

yum install wget unzip

Download WordPress using wget command:

wget http://wordpress.org/latest.zip

Install PHP-GD for working with images, install plugins, etc. …

yum install php-gd

Create a MYSQL database:

Enter MySQL as root:

mysql -u root -p

mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES on wordpress.* to 'my_user'@'localhost' identified by 'ваш_пароль';
mysql> FLUSH PRIVILEGES;
mysql> exit

Reload MySQL:

systemctl restart mysqld.service

We will now unzip the WordPress archive file to the / var / www / html / directory.

unzip -q latest.zip -d /var/www/html/

Set the appropriate permissions:

chown -R apache:apache /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress

We need to create the download directory manually:

mkdir -p /var/www/html/wordpress/wp-content/uploads

Allow the Apache web server to write to the downloads directory. Do this by assigning the owner group of this directory to the web server, which will allow Apache to create files and directories. Run the following command:

chown -R :apache /var/www/html/wordpress/wp-content/uploads

Enter the WordPress directory:

cd /var/www/html/wordpress/

Rename wp-config-sample.php to wp-config.php:

mv wp-config-sample.php wp-config.php

Open the WordPress config file with your text editor and change the database values ​​with the ones you gave when creating the database.

vim wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'my_user');

/** MySQL database password */
define('DB_PASSWORD', 'ваш_пароль');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Now you can finish installing WordPress, open your web browser and go to the following URL http: //your_ip_address/wordpress/wp-admin/install.php.

Sidebar