编译安装httpd(CentOS-6)
准备工作:
1.关闭防火墙
6:service iptables stop;chkconfing iptables off
7:systemctl stop firewalld;systemctl disable firewalld
另外还有一种:清除所有规则来暂时停止防火墙---iptables -F
2.关闭SELinux(6和7一样)
临时:setenforce 0
长期:修改配置文件/etc/selinux/config-----SELINUX=disabled
上面的修改方法sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
yum install openssl-devel
3.执行rz命令:从windows系统“rz”到linux CentOS-6上
解压下载的bz2文件(最好解压到一个以src命名的目录----/usr/local/src/)
我这里在/root下新建一个src目录(/root/src)
4.移动httpd-2.2.34.tar.bz2到/root/src(避免干扰)
mv httpd-2.2.34.tar.bz2 /root/src
cd /root/src
5.解压httpd-2.2.34.tar.bz2到当前目录(/root/src)
tar -xvf httpd-2.2.34.tar.bz2(-C 指定路径)
可以查看相关文件----README;INSTALL
由上面帮助可以设置路径:--prefix=/app --sysconfdir=/etc/httpd2.2(除了配置文件指定放到/etc/httpd2.2外,其他都放到/app)
7.开始编译
--prefix=/app \
--sysconfdir=/etc/httpd2.2 \
编译完后会生成Makefile文件,提供给后面的make读取
8.确定编译是否成功
echo $?----(0:表示可以进行下一步)
make -j 4 && echo -e "\a" && sleep 1 && echo -e "\a" && sleep 1 && echo -e "\a"
make -j 4(指定CPU的核心数)
echo -e "\a"(提示音)
sleep 1(休眠1秒)
10.make install
11.启动服务(cat INSTALL -----PREFIX/bin/apachectl start)
建议将这个服务添加到PATH变量里面,方便以后的使用
echo "PATH=/app/bin:$PATH" >> /etc/profile.d/env.sh
source /etc/profile.d/env.sh(让更改后配置脚本生效)
echo $PATH(确定是否生效)
12.完成以上步骤正式启动
apachectl start(因为上面已经添加到PATH变量里面,所以不用写绝对路径/app/bin/apachectl start)
13.默认网页存放目录是:/app/htdocs/index.html
CentOS 7的编译安装步骤
![1.png](https://upload-images.jianshu.io/upload_images/10967676-a22e20c4cce20896.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![2.png](https://upload-images.jianshu.io/upload_images/10967676-4781d43a76be4cc8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![3.png](https://upload-images.jianshu.io/upload_images/10967676-335bcfb00ab2e0ac.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![4.png](https://upload-images.jianshu.io/upload_images/10967676-e4fb60e5d8ae7023.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![5.png](https://upload-images.jianshu.io/upload_images/10967676-1c5a25b821095a9a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![6.png](https://upload-images.jianshu.io/upload_images/10967676-73dc939778070ba7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![7.png](https://upload-images.jianshu.io/upload_images/10967676-7902de482a0d785e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![8.png](https://upload-images.jianshu.io/upload_images/10967676-f39d708e2d907976.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![9.png](https://upload-images.jianshu.io/upload_images/10967676-8ff34248a6d07622.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![10.png](https://upload-images.jianshu.io/upload_images/10967676-8222727390b79091.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
posted on
2018-08-18 20:16
圆缘
阅读(
732)
评论()
编辑
收藏
举报