CentOS下LAMP环境搭建
2017-04-21 11:07
351 查看
背景:半年多没有碰代码了,现在又因为工作的原因重新拾起程序,今天先搭建了下LAMP环境,顺便也做了下记录
第一步:配置防火墙
CentOS7.0默认是使用的是Firewall作为防火墙
1,关闭firewall
systemctl stop firewalld.service
#关闭防火墙#
systemctl disable firewalld.service
#禁止防火墙开机启动#
2,关闭SELINUX
vim /etc/selinux/config
#SELINUX=enforcing#注释掉
SELINUX=disabled 在该行前增加“#”注释掉
:wq! #保存退出
setenforce 0 #使配置立即生效
(至于为什么要关闭Firewall,关闭SELINUX,只要是为了降低LINUX的安全等级,更方便操作而已,有兴趣的小伙伴可以自己查阅相关资料)!
第二步:安装Apache
yum install httpd #根据系统提示信息,输入Y安装即可
systemctl start httpd.service
#启动Apache
systemctl stop httpd.service
#停止Apache
systemctl restart httpd.service
#重启APache
systemctl enable httpd.service #设置Apace开机自启动
第三步:安装mariadb(Mysql)
yum install mariadb mariadb-server
#询问是否要自动安装,输入Y即可自动安装,知道安装完成为止
systemctl start mariadb.service
#启动mariadb
systemctl stop mariadb.service #关闭mariadb
systemctl restart mariadb.service
#重启mariadb
systemctl enable mariadb.service
#设置mariadb开机自启动
第四步:开启MySQL
mysql -u root -p#回车确定(默认没有密码)
设置mysql密码
set password for 'root'@‘localhost’=password('root');
授权mysql远程连接
grant all on *.* to root identified by 'root';
第五步:安装php及其相关组件,使PHP支持MySQL
yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash;
#选择以上安装包进行安装,根据提示输入Y回车#
systemctl restart mariadb.service
systemctl restart httpd.service
第六步:测试php是否启动
cd /var/www/html
vim indexphp
输入以下内容:
<?php
phpinfo();
?> :wq!#保存并退出在客户端浏览器输入服务器的IP,如果看到如下图信息,测环境搭建成功
第一步:配置防火墙
CentOS7.0默认是使用的是Firewall作为防火墙
1,关闭firewall
systemctl stop firewalld.service
#关闭防火墙#
systemctl disable firewalld.service
#禁止防火墙开机启动#
2,关闭SELINUX
vim /etc/selinux/config
#SELINUX=enforcing#注释掉
SELINUX=disabled 在该行前增加“#”注释掉
:wq! #保存退出
setenforce 0 #使配置立即生效
(至于为什么要关闭Firewall,关闭SELINUX,只要是为了降低LINUX的安全等级,更方便操作而已,有兴趣的小伙伴可以自己查阅相关资料)!
第二步:安装Apache
yum install httpd #根据系统提示信息,输入Y安装即可
systemctl start httpd.service
#启动Apache
systemctl stop httpd.service
#停止Apache
systemctl restart httpd.service
#重启APache
systemctl enable httpd.service #设置Apace开机自启动
第三步:安装mariadb(Mysql)
yum install mariadb mariadb-server
#询问是否要自动安装,输入Y即可自动安装,知道安装完成为止
systemctl start mariadb.service
#启动mariadb
systemctl stop mariadb.service #关闭mariadb
systemctl restart mariadb.service
#重启mariadb
systemctl enable mariadb.service
#设置mariadb开机自启动
第四步:开启MySQL
mysql -u root -p#回车确定(默认没有密码)
设置mysql密码
set password for 'root'@‘localhost’=password('root');
授权mysql远程连接
grant all on *.* to root identified by 'root';
第五步:安装php及其相关组件,使PHP支持MySQL
yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash;
#选择以上安装包进行安装,根据提示输入Y回车#
systemctl restart mariadb.service
systemctl restart httpd.service
第六步:测试php是否启动
cd /var/www/html
vim indexphp
输入以下内容:
<?php
phpinfo();
?> :wq!#保存并退出在客户端浏览器输入服务器的IP,如果看到如下图信息,测环境搭建成功
相关文章推荐
- CentOs5.4下LAMP环境搭建-问题集锦
- CentOS下用LAMP环境搭建WordPress博客系统(三)
- CentOS 5.5下LAMP环境搭建之源码安装MySQL(mysql-5.5.28)
- CentOS5.5 下搭建 PHP 环境(最佳的LAMP环境)
- CentOS 5.8 LAMP环境搭建
- CentOs5.4下LAMP环境搭建-问题集锦
- 基于centos 的Lamp环境搭建
- CentOS 5.5下LAMP环境搭建之源码安装PHP(php-5.4.8)
- CentOS、Linux搭建LAMP(Apache、MySQL、PHP)环境
- CentOS搭建LAMP环境
- CentOS下用LAMP环境搭建WordPress博客系统(一)
- CentOS6.2+LAMP环境搭建
- CentOS LAMP环境搭建和测试php与mysql的连接
- CentOS5.5 下搭建 PHP 环境(最佳的LAMP环境)
- Centos5.4 搭建LAMP环境
- CentOS下用LAMP环境搭建WordPress博客系统(二)
- LAMP环境搭建——基于VM虚拟CentOS-5.6
- LAMP环境搭建过程中出现的问题——基于VM虚拟CentOS-5.6
- [转]快速在CentOS下搭建LAMP(Apache、MySQL、PHP)环境
- 快速在CentOS下搭建LAMP(Apache、MySQL、PHP)环境