首先我们先查看下centos的版本信息
#适用于所有的linux lsb_release -a #或者 cat /etc/redhat-release #又或者 rpm -q centos-release
接下来我们先安装一台web服务器,因为是lanp,所以我们选用的是apache
yum install httpd
然后我们手动启动apache
#centos7 启动httpd apachectl start #centos6.5 启动httpd /etc/init.d/httpd start 或者 service httpd start
既然web服务器搭好了是不是就代表着可以通过web进行访问了呢?是的,浏览器直接访问你的服务器ip地址,就会打开apache的默认页面。
接下来我们设置开机启动httpd服务
#centos7 systemctl enable httpd.service
接着我们安装php5,同样很简单,一条命令即可

(因为我这边有需要,所以我安装的是php5.5,如果没有特殊需求的话,直接去掉数字就好) yum install php55 #centos7 安装好后重启apache apachectl restart #下面是安装php5.5的组件例如GD库等 yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64

如果php安装出错,我们更换掉rpm源就好,然后重新执行上面的代码
#CentOs 7.X rpm源(任选其一):
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
mysql安装
一般网上给出的资料都是
#yum install mysql #yum install mysql-server #yum install mysql-devel
安装mysql和mysql-devel都成功,但是安装mysql-server失败,如下:

CentOS 7.2/7.3搭建LAMP环境

最低0.47元/天 解锁文章
556

被折叠的 条评论
为什么被折叠?



