yum -y install httpd
启动httpd
systemctl start httpd.service
设置开机启动
systemctl enable httpd.service
安装firewall配置防火墙
yum -y install firewalld firewall-config
启动并设置开机启动
systemctl start firewalld.service
systemctl enable firewalld.service
防火墙放行http和https协议
firewall-cmd–permanent–zone=public–add-service=http
firewall-cmd–permanent–zone=public–add-service=https
开机自启
firewall-cmd–reload
在浏览器中输入自己配置的ip,查看是否配置成功,如下是正常访问
yum -y install mariadb-server mariadb
启动在进行开机自启配置
systemctl start mariadb.service
systemctl enable mariadb.service
(在进行配置mariadb时可能需要其自己分配的临时密码)
查询临时密码
grep ‘temporary password’ /var/log/mysqld.log
*root@localhost:初始密码
使用零时密码登录(记得是上面的零时密码别打错了)
mysql -uroot -p
修改密码(最好字母大小写+数字)
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘修改的密码’;
###(还可以免密码登录,修改 /etc/my.cnf,文本末端添加 skip-grant-tables,保存后直接可以登录到数据库,修改密码 GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘密码’ WITH GRANT OPTION;,设置完后执行 flush privileges;)
上述完之后再配置一遍root账户密码(密码可以不用修改)
mysql_secure_installation
然后一路输入“y”就行
重启mariadb生效
systemctl restart mariadb.service
(版本还是选择高一点的,不然有时候不支持就尴尬了)
安装php7.1
先查看php版本(版本低的话升级或者卸载)
php -v
查看当前php的安装包
yum list installed | grep php
有的话移除当前安装包,避免发生冲突
yum remove php*
下载源
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装php7.1
yum -y install php71w-fpm php71w-opcache php71w-cli php71w-gd php71w-mysqlnd php71w-mbstring php71w-pecl-mongodb php71w-pecl-redis php71w-pgsql php71w-xml php71w-xmlrpc php71w-devel mod_php71w
安装完之后再查看php版本
php -v
新建一个php页面查看组件
vi /var/www/html/info.php
编辑
重启httpd
systemctl restart httpd.service
网址输入
先登录
mysql -u root -p
建立一个数据库为wordpressdb
CREATEDATABASE wordpressdb;
密码设为123456789
CREATEUSER wordpressuser@localhost IDENTIFIED BY’123456789’;
修改权限
GRANTALLPRIVILEGESON wordpressdb.* TO wordpressuser@localhost;
生效保存退出
FLUSH PRIVILEGES;
exit
再次重启服务apache,mariadb
systemctl restart httpd.servicesystemctl restart mariadb.service
下载安装包
wget http://wordpress.org/latest.tar.gz
解压出来拷贝到/var/www/html目录下
tar xzvf latest.tar.gz
rsync -avP ~/wordpress/ /var/www/html
修改文件权限
mkdir -p /var/www/html/wordpress/wp-content/uploads
chown -R apache:apache wordpress
chmod -R777 wordpress
编辑wp-config.php文件
cd /var/www/html/wordpress
cp wp-config-sample.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’, ‘wordpressdb’);
/* MySQL database username /define(‘DB_USER’, ‘root’);
/* MySQL database password /define(‘DB_PASSWORD’, ‘123456789’);
/* MySQL hostname /define(‘DB_HOST’, ‘localhost’);