yum list installed | grep php #检查当前安装的PHP包
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 ....#如果有安装的PHP包,先删除他们
#配置yum源
#以下是CentOS 7.0的源。
# yum install epel-release
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#安装PHP7.x
#yum源配置好了,下一步就安装PHP7.2
yum install --enablerepo=remi --enablerepo=remi-php72 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-redis php-fpm
#从PHP5.5开始PHP代码缓存从APC变成了Zend OPcache了。
#如果想删除上面安装的包,重新安装
rpm -qa | grep webstatic
rpm -e 上面搜索到的包即可
#1、基础环境
sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config
setenforce 0
systemctl stop firewalld #我的亚马逊ec2指令是service stop firewalld
systemctl disable firewalld #ec2指令是service disable firewalld
#2、安装LAMP
#//检查当前安装的PHP,移动旧的版本
rpm -e $(yum list installed | grep php)
#//安装epel-扩展源,安装php7
sudo yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo yum install -y php72-php php72-php-gd php72-php-imap php72-php-mbstring php72-php-mysqlnd php72-php-pecl-mysql php72-php-opcache php72-php-pdo php72-php-pecl-apcu php72-php-odbc php72-php-cli php72-php-pecl-http php72-php-pecl-http-devel
#我的用php72-php*安装报错直接php72*安装ok
#安装mariadb
#启动服务器并加入开机启动
systemctl start httpd mariadb
system enable httpd mariadb
mysql_secure_installation
#DISCUZ
#1 配置discuz虚拟主机-> cat /etc/httpd/conf.d/discuz.conf
<VirtualHost *:80>
ServerName discuz.jackzz.rocks
DocumentRoot "/code/discuz"
</VirtualHost>
<Directory /code/discuz>
AllowOverride None
Require all granted
</Directory>
#2 部署代码
、、、
mkdir /soft/src;cd /soft/src
yum install git -y
git clone https://gitee.com/ComsenzDiscuz/DiscuzX.git
cp -r DiscuzX/upload/ /code/discuz
systemctl restart httpd
127.0.0.1 discuz.jackzz.rocks blog.jackzz.rocks test.jackzz.rocks#/etc/hosts #绑定hosts文件
chmod 777 -R /code/discuz/{config,data,uc_client,uc_server} #目录不可写需要授权
、、、
# 3 wordpress 部署
、、、、
cd /etc/httpd/conf.d/;cp discuz.conf wordpress.conf#复制一份配置文件内容改为wordpress的
cd /soft/src #切换到应用部署目录
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz#下载中文版wordpress
tar xf wordpress-XXX
cp -r wordpress /code/
systemctl restart httpd
http -t #检测配置
#创建wordpress数据库
mysql -uroot -pxxx#xxx是密码
create database wordpress;#需要创建数据库,坑1
chown -R apache.apache /code/wordpress/#需要授权,坑2
、、、、