centos7 builds wordpress blog

Posted by pedroteixeira07 on Mon, 11 May 2020 19:01:44 +0200

Install apache

yum install -y httpd

Start apache

systemctl start httpd

Set apache to power on automatically

systemctl enable httpd

Access public network address to check whether apache is normal

Install MySQL database

wget -i http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql-community-server

Start MySQL database

systemctl start mysqld.service

View MySQL operation

systemctl status mysqld.service

View MySQL initial password

grep "password" /var/log/mysqld.log

Log in to the database

mysql -uroot -p

Modify MySQL default password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassWord1.';

Create wordpress database

create database wordpress; 

Check whether the database is created successfully

show databases;


Exit MySQL database

exit

Install php7

Your server is running PHP version 5.4.16 but WordPress 5.4.1 requires at least 5.6.20. An error is reported

 rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm 
 
 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install -y php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-fpm

Install php expansion

	yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-mbstring php-devel php-soap php-cli php-pdo
    
	yum -y install php-mcrypt php-tidy php-xml php-xmlrpc php-pear
    
	yum -y install php-pecl-memcache php-eaccelerator

Restart httpd

 #Restart httpd service
 systemctl restart httpd.service
 
 #Set the startup mode. If the server is not set, it will not go to the website if the server is restarted. 
 systemctl enable httpd.service

Create php test page

echo "<?php phpinfo(); ?>" >   /var/www/html/phpinfo.php

Access the public network address / phpinfo() to test whether the php server is normal

Install wordpress

Download the latest wordpress

wget https://cn.wordpress.org/latest-zh_CN.tar.gz

decompression

tar xzvf latest.tar.gz

Copy to / var/www/html/wordpress directory

 cp -a  wordpress/* /var/www/html/wordpress

Edit wp-config.php

# Switch to wordpress directory
cd /var/www/html/wordpress

# Copy wp-config.php file
cp wp-config-sample.php wp-config.php

# Edit the wp-config.php file
sudo vim wp-config.php
// **MySQL settings - specific information from the host you are using * *//
/** WordPress Name of the database */
define( 'DB_NAME', 'wordpress' );                                                                                       
/** MySQL Database user name */
define( 'DB_USER', 'root' );                                                                                            
/** MySQL Database password */
define( 'DB_PASSWORD', 'NewPassWord1.' );

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

/** Default text encoding when creating a data table */
define( 'DB_CHARSET', 'utf8' );

/** Database collation type. Do not change if you are not sure */
define( 'DB_COLLATE', '' );

/** Set Chinese */
define( 'WPLANG' , 'zh_CN' );

Create a wordpress account

Log in to the public network address / wordpress/wp-admin/install.php and create an account as prompted
After the creation, the backstage is just like this

Topics: Linux PHP MySQL Database yum