Centos系统搭建LAMP
使用Centos搭建lamp環境
? ? ? 使用一臺Centos 5.5實現
?
? 軟件安裝使用yum實現,將yum源改成網易的yum源
? cd /etc/yum.repo.d
? mv /Centos-Base.repo ? /Cenytos-Base-repo.bak
? 使用wget下載網易yum源
? wget http://mirrors.163.com/.help/CentOS-Base-163.repo
? 最后更新yum緩存 ? ?yum makecache
? ? ? ? ? ? ?安裝LAMP環境
? 安裝Apache
? yum install httpd httpd-devel
? 完成后啟動Apache /etc/init.d/mysqld start
? 設置開啟啟動 ?chkconfig httpd on
? ?安裝MySQL
? ?yum install mysql mysql-server mysql-devel
? ?完成安裝后啟動MySQL ? ?/etc/init.d/mysqld start
? ?設置開機啟動 ?chkconfig httpd on
? ?
? ? ? ?
? ?設置MySQL密碼
? ?mysql -u root -p ?登陸
? ?use mysql; ? 選擇庫
? ?update user set password=password('新密碼’) where user='root';
? ?flush privileges;
?
? ?安裝php
? ?yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
? ?/etc/init.d/httpd start ?完成后啟動php
?
? ?將網站上傳到/var/www/html下,發現如下錯誤
? ?you don't have permission to access /upload on this server
? ?apache/2.2.3 (Centos) server at 127.0.0.1 port 80
? ?錯誤代碼意思是“沒有權限在此安裝此程序”
? ?解決方法:
? ?網站程序的用戶和組的權限為root,而Apache配置文件的權限為apache:apache,所以將網站程序的用戶和組都改為Apache:Apache
?
? ?檢查之后發現Centos服務器的selinux和iptables的端口都沒有開啟,在iptables上添加21和80端口允許的命令。
? ?iptables -I INPUT -p tcp --dport 80 -j ACCEPT
? ?iptables -I RH -Firewall -1 -INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
? ?iptables -I RH -Firewall -1 -INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
? ?重新加載防火墻
? ?service iptables restart
?
? ?將selinux的狀態改為SELINUX=disabled,重啟服務器。
?
? ? ?
?
轉載于:https://blog.51cto.com/1051236524/1382289
總結
以上是生活随笔為你收集整理的Centos系统搭建LAMP的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 四.jmeter代码学习, Sample
- 下一篇: Tengine ngx_http_sys