Install the WordPress program on Centos7
After the LAMP environment is set up in Centos7, various services can be installed. The author takes the most popular open-source blog system WordPress as an example to test and test the platform we have set up.
1. Database deployment
Create a database with the username 360 readuser and password 360readpsd for the Wordpress program.
Log on to the database: mysql-uroot-p
Create database 360 read;
Create user 360readuser @ localhost identified by '360readpsd ';
Grant all permissions TO the user: grant all privileges on 360read. * TO 360readuser @ localhost;
Refresh takes effect: flush privileges;
Exit: exit
Restart the service: systemctl restart mariadb. service
Systemctl restart httpd. service
2. install WordPress
1> create a temporary folder and download the latest version of Wordpress3.92, both Chinese and English.
Mkdir/tmp/wp
Cd/tmp/wp
Wget http://wordpress.org/latest.zip
Decompress the package to the root directory of the Website: unzip-q latest.zip-d/var/www/html/
2> change the owner of the wordpree Folder: chown-R apache: apache/var/www/html/wordpress
Change wordpress folder permissions: chmod-R 755/var/www/html/wordpress
Create an upload directory that can be uploaded and change the owner to apache:
Mkdir-p/var/www/html/wordpress/wp-content/uploads
Chown-R: apache/var/www/html/wordpress/wp-content/uploads
3> modify the configuration file so that you can access the database
Cd/var/www/html/wordpress/
Cp wp-config-sample.php wp-config.php
Vim wp-config.php to modify the red font section:
/** The name of the database for WordPress */
Define ('db _ name', '360read ');
/** MySQL database username */
Define ('db _ user', '360readuser ');
/** MySQL database password */
Define ('db _ password', '360readpsd '); after modification, wq!
4> enter http: // 192.168.1.108/wordpress/wp-admin/install in the browser. after php, you can perform the final login and installation, enter the site name, login account name, password, and mailbox to complete Wordpress installation!
If the following error occurs: Your PHP installation appears to be missing the MySQL extension which is require
This may be caused by the loss of the PHP-mysql module. Restart the yum install php-mysql and restart the mariadb and httpd services.
5> enable fixed link modification and redirection.
Edit the main configuration file: vi/etc/httpd/conf/httpd. conf
... AllowOverride None to AllowOverride All...
Then restart the service: systemctl restart httpd. service
Create a. htaccess file: touch/var/www/html/wordpress/. htaccess
Edit: vim/var/www/html/wordpress/. htaccess. Add the following content to automatically generate the website.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/wordpress/
RewriteRule ^ index \. php $-[L]
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
RewriteRule./wordpress/index. php [L]
</IfModule>
Modify the permission of the. htaccess file: chmod 664/var/www/html/wordpress/. htaccess. If it is modified to 664, the website can be automatically updated or changed to 644.
So far, Wordpress has been fully installed on Centos7. You can use it to build any website you want.