一、安裝環境
[root@lin_haobin ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
二、基於yum方式安裝httpd、php、mariadb
[root@lin_haobin ~]# yum -y install httpd
[root@lin_haobin ~]# yum -y install mariadb-server
[root@lin_haobin ~]# yum -y install php php-mysql
驗證安裝包
[root@lin_haobin ~]# rpm -qa|grep httpd
httpd-2.4.6-17.el7.x86_64
httpd-tools-2.4.6-17.el7.x86_64[root@lin_haobin ~]# rpm -qa|grep php
php-pdo-5.4.16-21.el7.x86_64
php-common-5.4.16-21.el7.x86_64
php-mysql-5.4.16-21.el7.x86_64
php-5.4.16-21.el7.x86_64
php-cli-5.4.16-21.el7.x86_64[root@lin_haobin ~]# rpm -qa|grep maria
mariadb-5.5.35-3.el7.x86_64
mariadb-server-5.5.35-3.el7.x86_64
mariadb-libs-5.5.35-3.el7.x86_64
啓動httpd
[root@lin_haobin ~]# systemctl start httpd
驗證httpd
[root@lin_haobin ~]# echo “The httpd is running.”>/var/www/html/index.html
在瀏覽器輸入http://localhost 出現下面的頁面則說明httpd安裝成功
啓動mariadb
[root@lin_haobin ~]# systemctl start mariadb
驗證mariadb
[root@lin_haobin ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.35-MariaDB MariaDB ServerCopyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show variables like ‘version’;
+—————+—————-+
| Variable_name | Value |
+—————+—————-+
| version | 5.5.35-MariaDB |
+—————+—————-+
1 row in set (0.01 sec)MariaDB [(none)]> exit
Bye
測試php
[root@lin_haobin ~]# echo ”
The PHP is running.
?php
phpinfo();
?>
“>/var/www/html/index.php
在瀏覽器輸入http://localhost/index.php出現下面的頁面則說明php安裝成功
三、安裝及配置Wordpress
將WordPress上傳到服務器
[root@lin_haobin Desktop]# ll
total 9032
-rw-r–r–. 1 root root 9245300 Dec 11 16:04 wordpress-4.7.4-zh_CN.zip
解壓WordPress,並解壓到/var/www/html/目錄下,並配置
[root@lin_haobin Desktop]# unzip -q wordpress-4.7.4-zh_CN.zip -d /var/www/html/
[root@lin_haobin Desktop]# cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
[root@lin_haobin Desktop]# vim /var/www/html/wordpress/wp-config.php
/* WordPress數據庫的名稱 /
define(‘DB_NAME’, ‘wordpress’);/* MySQL數據庫用戶名 /
define(‘DB_USER’, ‘admin’);/* MySQL數據庫密碼 /
define(‘DB_PASSWORD’, ‘admin’);/* MySQL主機 /
define(‘DB_HOST’, ‘localhost’);/* 創建數據表時默認的文字編碼 /
define(‘DB_CHARSET’, ‘utf8’);/* 數據庫整理類型。如不確定請勿更改 /
define(‘DB_COLLATE’, ”);
創建wordpress數據庫及用戶
[root@lin_haobin Desktop]#mysql
MariaDB [(none)]> create database wordpress character set utf8;
Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> grant all privileges on wordpress.* to ‘admin’@’localhost’ identified by ‘admin’;
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
配置wordpress
打開瀏覽器完成wordpress配置
在瀏覽器輸入http://localhost/wordpress
填寫信息,點擊安裝WordPress
輸入密碼,點擊登錄
出現上面的頁面證明WordPress已經安裝完成了。