CentOS7下安装LAMP作为Web服务
时间:2014-11-25 21:03 来源:linux.it.net.cn 作者:IT
1.# yum install php
(依赖包顺便把httpd也下了)
# systemctl start httpd.service
# firewall-cmd --add-service=http
(防火墙对http服务解除封锁)
# firewall-cmd --permanent --add-service=http
(防火墙对http服务解除封锁写入配置文件)
(可查看/etc/firewalld/zones/public.xml和/usr/lib/firewalld/services/http.xml)
(此时php和httpd已经安装完成)
2.
# yum list mysql
(没有包...尴尬)
(去http://dev.mysql.com/downloads/repo/yum/找找)
# yum install wget
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql mysql-server
# systemctl start mysqld.service
# mysql_secure_installation
(根据提示设置密码,其余选项都输y即可,特殊情况自行判断)
# mysql -u root -p
(密码测试成功)
mysql> grant all privileges on *.* to 'lane'@'%' identified by '123456' with grant option;
(用户名lane密码123456允许所有ip登录给予了*.*即所有的权限,这样是很危险的,我这里是虚拟机做测试无所谓,实际生产环境,别执行这样的命令)
mysql> flush privileges;
mysql> quit;
# firewall-cmd --add-service=mysql
# firewall-cmd --permanent --add-service=mysql
# yum install php-mysql
(安装完成)
# systemctl restart httpd.service
# systemctl restart mysqld.service
(责任编辑:IT)
1.# yum install php (依赖包顺便把httpd也下了)
# systemctl start httpd.service # firewall-cmd --add-service=http (防火墙对http服务解除封锁) # firewall-cmd --permanent --add-service=http (防火墙对http服务解除封锁写入配置文件) (可查看/etc/firewalld/zones/public.xml和/usr/lib/firewalld/services/http.xml) (此时php和httpd已经安装完成) 2. # yum list mysql (没有包...尴尬) (去http://dev.mysql.com/downloads/repo/yum/找找) # yum install wget # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm # yum install mysql mysql-server # systemctl start mysqld.service
# mysql_secure_installation (根据提示设置密码,其余选项都输y即可,特殊情况自行判断) # mysql -u root -p (密码测试成功) mysql> grant all privileges on *.* to 'lane'@'%' identified by '123456' with grant option; (用户名lane密码123456允许所有ip登录给予了*.*即所有的权限,这样是很危险的,我这里是虚拟机做测试无所谓,实际生产环境,别执行这样的命令) mysql> flush privileges; mysql> quit; # firewall-cmd --add-service=mysql # firewall-cmd --permanent --add-service=mysql # yum install php-mysql (安装完成) # systemctl restart httpd.service
# systemctl restart mysqld.service |