centos 7.3搭建wordpressphp
一、先安裝apache
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# firewall-cmd --permanent --add-service=http
[root@localhost ~]# firewall-cmd –reload
打開瀏覽器測試
html
二、安裝MariaDB數據庫
[root@localhost ~]# yum -y install mariadb-server mariadb
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# systemctl enable mariadb
對數據庫進行設置
[root@localhost ~]# mysql_secure_installation
提示輸入數據庫密碼,第一個先回車,接下來設置密碼
接下來默認選y至結束
mysql
三、安裝php
特別注意,用yum install -y php php-mysql安裝的php版本是php5.4,而安裝wordpress是須要php5.6,因此換一個方法進行安裝
先安裝php軟件yun庫
[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
[root@localhost ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安裝php5.6
[root@localhost ~]# yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-mysql php56w-intl php56w-mbstring
重啓一下apache服務
root@localhost ~]# systemctl restart httpd
測試一下php
[root@localhost ~]# vim /var/www/html/info.php
<?php
phpinfo();
?>
打開瀏覽器測試一下
web
四、安裝phpMyAdmin
先安裝epel
[root@localhost ~]# yum install -y epel-release,再安裝phpMyAdmin
[root@localhost ~]# yum -y install phpmyadmin
phpMyAdmin的httpd設置,配置文件爲/etc/httpd/conf.d/phpMyAdmin.conf
[root@localhost ~]# vim /etc/httpd/conf.d/phpMyAdmin.conf
修改後如圖
Wq保存好後重啓apache服務
[root@localhost ~]# systemctl restart httpd
打開瀏覽器測試
sql
五、建立wordpress數據庫
登陸數據庫
[root@localhost ~]# mysql -u root –p
建立數據庫
MariaDB [(none)]> CREATE DATABASE wordpress;
設置數據庫用戶名與密碼
MariaDB [(none)]> CREATE USER wordpressuser@localhost IDENTIFIED BY 'wordress_password';
設置wordpressuser訪問wordpress數據庫權限
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'wordress_password';數據庫
刷新數據庫設置
MariaDB [(none)]> FLUSH PRIVILEGES;apache
六、安裝wordpress
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# mkdir opt
[root@localhost html]# mkdir wordpress
[root@localhost html]# cd opt
[root@localhost opt]# wget https://cn.wordpress.org/wordpress-4.9.1-zh_CN.tar.gz
[root@localhost opt]# tar xzvf wordpress-4.9.1-zh_CN.tar.gz -C /var/www/html/wordpress/
[root@localhost opt# cd /var/www/html/wordpress/wordpress/
[root@localhost wordpress]# cp wp-config-sample.php wp-config.php
編輯wp-config.php
[root@localhost wordpress]# vim wp-config.php
vim
打開瀏覽器
輸入http://192.168.11.137/wordpress/wordpress/wp-admin/install.phpcentos
此刻,centos 7.3搭建wordpress完成。瀏覽器
未完,待續~