環境:CentOS 6.5php
# 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 --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT#add -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT#add -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
保存退出後重啓IPtableshtml
[root@evilxr ~]# /etc/init.d/iptables restart
vi /etc/selinux/config #SELINUX=enforcing #註釋掉 #SELINUXTYPE=targeted #註釋掉 SELINUX=disabled #增長 :wq #保存,關閉 shutdown -r now #重啓系統
yum install httpd #根據提示,輸入Y安裝便可成功安裝 /etc/init.d/httpd start (service httpd start)#啓動Apache 備註:Apache啓動以後會提示錯誤: 正在啓動httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName 解決辦法: vi /etc/httpd/conf/httpd.conf #編輯 找到 #ServerName www.example.com:80 修改成ServerName www.evilxr.com:80 #設置爲你本身的域名,若是沒有域名,能夠設置爲localhost :wq! #保存退出 chkconfig httpd on #設爲開機啓動 /etc/init.d/httpd restart (service httpd restart)#重啓Apache
4.1安裝MySQLpython
yum install mysql mysql-server #詢問是否要安裝,輸入Y便可自動安裝,直到安裝完成 /etc/init.d/mysqld start #啓動MySQL chkconfig mysqld on #設爲開機啓動 cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷貝配置文件(注意:若是/etc目錄下面默認有一個my.cnf,直接覆蓋便可)
4.2爲root用戶設置密碼mysql
mysql_secure_installation(運行mysql的安全模式) 回車,根據提示輸入Y 輸入2次密碼,回車 根據提示一路輸入Y 最後出現:Thanks for using MySQL! MySql密碼設置完成,從新啓動 MySQL: /etc/init.d/mysqld restart #重啓 /etc/init.d/mysqld stop #中止 /etc/init.d/mysqld start #啓動
5.安裝PHP5linux
yum install php 根據提示輸入Y直到安裝完成 安裝PHP組件,使 PHP5 支持 MySQL yum install php-mysqlphp-gdlibjpeg* php-imapphp-ldapphp-odbcphp-pear php-xml php-xmlrpcphp-mbstringphp-mcryptphp-bcmathphp-mhashlibmcrypt 這裏選擇以上安裝包進行安裝 根據提示輸入Y回車 /etc/init.d/mysqld restart #重啓MySql /etc/init.d/httpd restart #重啓Apche
6.測試sql
cd /var/www/html vi index.php #輸入下面內容 <?php phpinfo(); ?> :wq! #保存退出 注意:apache默認的程序目錄是/var/www/html 權限設置:chownapache.apache -R /var/www/html