wordpress安裝教程如下:

mysql安裝可以參考我的部落格園Centos構建Java環境:https://www.cnblogs.com/youcong/p/9118753.html

1.安裝apache
yum install httpd

systemctl start httpd

2.安裝php

yum install -y php php-mysql
systemctl restart httpd

vim /var/www/html/info.php

<?php phpinfo(); ?>

3.安裝phpmyadmin(補充說明:安裝mysql教程不論是centos還是ubuntu,可以參考我的部落格文章)
yum install -y epel-release
yum install -y phpmyadmin

vim /etc/httpd/conf.d/phpMyAdmin.conf

配置檔案內容如下:

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8 <IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory> <Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
</Directory>

重啟httpd伺服器
systemctl restart httpd

安裝完phpmyadmin一定要輸入對應的地址進入phpMyAdmin管理平臺
進入該平臺進行使用者新增和資料新增
也可以通過命令列的形式:
例如:
# 登入資料庫
mysql -u root -p
# 建立資料庫
CREATE DATABASE wordpress;
# 建立資料庫使用者和密碼
CREATE USER wordpressuser@localhost IDENTIFIED BY '123456';
# 設定wordpressuser訪問wordpress資料庫許可權
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY '123456';
# 重新整理資料庫設定
FLUSH PRIVILEGES;
# 退出資料庫
exit

4.安裝wordpress
http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz

解壓後並在當前目錄下執行:sudo rsync -avP ~/wordpress/ /var/www/html/wordpress/

# 切換到wordpress目錄
cd /var/www/html/wordpress
# 複製wp-config.php檔案
cp wp-config-sample.php wp-config.php
# 編輯wp-config.php檔案
sudo 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', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
/** MySQL hostname */
define('DB_HOST', 'localhost'); 將其修改為: // ** 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', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', '123456');
/** MySQL hostname */
define('DB_HOST', 'localhost');

完成後在瀏覽器輸入地址:www.example.com/wordpress/wp-admin/install.php
按照步驟來,一步一步安裝。