centos6 安装 lamp

首先更新一下yum -y update

安装Apache 
yum install httpd httpd-devel 
安装完成后,用/etc/init.d/httpd start 启动apache 
设为开机启动:chkconfig httpd on

安装mysql 
yum install mysql mysql-server mysql-devel 
同样,完成后,用/etc/init.d/mysqld start启动mysql

#service mysqld start

#mysql

设置mysql密码 
mysql>; USE mysql; 
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root'; 
mysql>; FLUSH PRIVILEGES;

开启远程连接(root/123456):grant all privileges on *.* to root@"%" identified by "123456" with grant option; flush privileges;  测试若不能连接用下面方法检查是否防火墙开启了3306端口

安装php 
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml 
/etc/init.d/httpd start

测试一下 
在/var/www/html/新建个test.php文件,将以下内容写入,然后保存。 
<? 
phpinfo(); 
?>

若不能访问是防火墙80端口未打开

a.关闭防火墙 
service iptables stop

b.添加80端口 # vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

c.重新加载防火墙
service iptables restart

http://www.centoscn.com/CentosServer/www/2015/0829/6079.html

http://www.centoscn.com/CentosServer/www/2016/0318/6860.html

上一篇:【Python】新建自定义个数的自定义长度名字


下一篇:oracle备份信息查询