centos 安装 apache2.4 php5.6

1.安装之前先检查一下系统是否有默认安装的apache或者php

rpm -qa | grep httpd 
rpm -qa | grep php

2.把上面指令列出来的包删除

rpm -e * * * *(包名)

3.在安装前 ,更新一下系统

yum update

4.安装一些必备的包

yum -y install gcc 
yum -y install gcc-c++ 
yum -y install make

5.开始安装apache

yum install httpd
docker注意端口映射

6.启动httpd

找到httpd.conf文件 
find / -name httpd.conf

默认在
run/httpd

重启apahce
systemctl restart httpd.service 

开机启动
systemctl enable httpd.service 

在docker中systemctl 可能会报错

7.安装php

yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install --enablerepo=remi --enablerepo=remi-php56 php php-mbstring php-mcrypt php-mysqlnd php-gd php-curl

8.写一个测试页面

默认httpd位置 
/run/httpd/httpd

默认的html位置 
/var/www/html

配置文件 
/etc/httpd/conf/httpd.conf

修改配置
AllowOverride None —-> AllowOverride All
Options Index FollowSymLinks —-> Options FollowSymLinks 

参考文献

http://blog.csdn.net/jiaoshenmo/article/details/50923900

yum安装指定版本的方法

http://www.cnblogs.com/xiaoshi657/p/5402066.html

将yum源更换为国内的阿里云源

http://mirrors.aliyun.com/help/centos
https://yq.aliyun.com/articles/33286
http://blog.csdn.net/realghost/article/details/45949759

wget: command not found 解决办法

> http://www.linuxidc.com/Linux/2015-05/117792.htm
安装wget命令
yum -y install wget
添加rpm源
rpm --import "http://keyserver.Ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
yum-config-manager --add-repo http://jenkins.mono-project.com/repo/centos/ 

此处评论已关闭