在HyperV服務(wù)器中安裝Centos6.8-x64-minimal,安裝步驟,略。
使用命令配置網(wǎng)絡(luò):
vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes //默認(rèn)為NO,指明在系統(tǒng)啟動(dòng)時(shí)是否激活網(wǎng)卡
BOOTPROTO=static //默認(rèn)為DHCP,指明使用靜態(tài)IP
IPADDR=172.16.109.11 //設(shè)置IP地址
NETMASK=255.255.255.0 //設(shè)置子網(wǎng)掩碼
GATEWAY=172.16.109.254 //設(shè)置網(wǎng)關(guān)
DNS1=202.96.128.166 //設(shè)置DNS
DNS2=202.96.128.86
重啟網(wǎng)絡(luò)服務(wù):
service network restart
安裝wget,vim
yum install –y gwet //網(wǎng)絡(luò)下載工具,從指定的URL下載文件
yum install –y vim //vi的升級(jí)版,重點(diǎn)是能夠語法高亮顯示。
安裝LAMP環(huán)境:
yum install –y httpd mysql mysql-server php php-mysql php-gd php-xml php-mbstring
啟動(dòng)httpd,mysql服務(wù):
service httpd start
service mysqld start
設(shè)置開機(jī)啟動(dòng)httpd,mysql服務(wù):
chkconfig httpd on
chkconfig mysqld on
MySQL數(shù)據(jù)庫設(shè)置:
mysql_secure_installation // mysql配置腳本
Set root password? [Y/n] //設(shè)置root密碼(最好自己設(shè)置密碼,選Y)
anonymous users? [Y/n] //刪除匿名用戶(選Y)
Disallow root login remotely? [Y/n] //禁止root用戶遠(yuǎn)程登錄(選n)
Remove test database and access to it? [Y/n] //刪除默認(rèn)的 test 數(shù)據(jù)庫(選Y)
Reload privilege tables now? [Y/n] //是否馬上應(yīng)用最新的設(shè)置(選Y)mysql –u root –p //登陸MySQL數(shù)據(jù)庫
mysql> create database wordpress; //創(chuàng)建wordpress數(shù)據(jù)庫
配置防火墻,開放80端口:
iptables –I INPUT –p tcp –dport 80 –j ACCEPT
service iptables save
service iptables restart
下載WordPress安裝包并解壓:
wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz //下載中文版wordpress
tar –xzvf wordpress-4.8.1-zh_CN.tar.gz //解壓
cp –r wordpress/* /var/www/html/ //把wordpress文件復(fù)制到apache主目錄
設(shè)置wordpress的配置文件:
cd /var/www/html/wordpress/ //進(jìn)入wordpress文件夾下
cp wp-config-sample.php wp-config.php //復(fù)制配置文件
vim wp-config.php //編輯wordpress的配置文件
/** WordPress 數(shù)據(jù)庫的名稱 /
define(‘DB_NAME’, ’wordpress’); //使用剛剛創(chuàng)建的wordpress數(shù)據(jù)庫
/* MySQL 數(shù)據(jù)庫的用戶 /
define(‘DB_USER’, ‘root’); //設(shè)置數(shù)據(jù)庫的用戶名
/* MySQL 數(shù)據(jù)庫密碼 /
define(‘DB_PASSWORD’, ‘123456’); //設(shè)置數(shù)據(jù)庫的用戶密碼
/* MySQL 主機(jī) */
define(‘DB_HOST’, ‘localhost’); //一般默認(rèn)為localhost,無需修改