準(zhǔn)備工作:配置防火墻,開(kāi)啟80灾票、3306端口托嚣。CentOS 7.0默認(rèn)使用的是firewall作為防火墻,這里改為iptables防火墻术幔。
#停止firewall服務(wù)
systemctl stop firewalld.service
#禁止firewall開(kāi)機(jī)啟動(dòng)
systemctl disable firewalld.service
#安裝yuminstalliptables-services
#編輯防火墻配置文件 vi/etc/sysconfig/iptables加入紅色的兩行代碼,請(qǐng)注意位置一定要對(duì)應(yīng)湃密。# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport22-j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT-A INPUT -j REJECT --reject-with icmp-host-prohibited-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
#最后重啟防火墻使配置生效
systemctl restart iptables.service
#設(shè)置防火墻開(kāi)機(jī)啟動(dòng)
systemctl enable iptables.service
3. 關(guān)閉seinux
#修改配置文件vi/etc/selinux/config
#SELINUX=enforcing #注釋掉
#SELINUXTYPE=targeted #注釋掉
SELINUX=disabled #增加
:wq! #保存退出
#使配置立即生效
setenforce 0
1.檢查當(dāng)前安裝的php包?
#yum list installed | grep php
擴(kuò)展:@1檢查當(dāng)前已安裝所有安裝包 #yum list installed
? ? ? ? ? @2檢查當(dāng)前已安裝的指定安裝包 #yum list installed httpd
刪除(卸載)已安裝的包
#yum?remove?php.x86_64?php-cli.x86_64?php-common.x86_64?php-gd.x86_64?php-ldap.x86_64?php-mbstring.x86_64?php-mcrypt.x86_64?php-mysql.x86_64?php-pdo.x86_64
2.rpm包安裝(rpm命令是RPM軟件包的管理工具诅挑。)
CentOs 5.x
#rpm?-Uvh?http://mirror.webtatic.com/yum/el5/latest.rpm
CentOs?6.x
#rpm?-Uvh?http://mirror.webtatic.com/yum/el6/latest.rpm
CentOs?7.X
#rpm?-Uvh?https://mirror.webtatic.com/yum/el7/epel-release.rpm#rpm?-Uvh?https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想刪除上面安裝的包,重新安裝
#rpm -qa | grep webtatic
#rpm -e ?上面搜索到的包即可
3.查看可安裝的php版本
#yum list php*(顯示可用安裝包)
4.安裝php(以php7.0為例)
#yum -y install php70w.x86_64
安裝php-mysql擴(kuò)展
#yum install php56w-mysql
安裝mbstring擴(kuò)展
#yum install php56w-mbstring
查看php版本
#php -v
查看php安裝的模塊
#php -m
3.安裝apeach
執(zhí)行
#cd /etc/yum.repos.d
#wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
#wget http://www.hop5.in/yum/el6/hop5.repo
建議先把已安裝的卸載掉(上面已有apache2.2)
查看已安裝
#yum list installed httpd*
卸載
#yum remove httpd
查看可安裝httpd
#yum list httpd*
安裝
#yum install httpd24-httpd httpd24-httpd-devel httpd24-mod_ssl hhvm