centos源码安装apache
2017-09-03 16:16
295 查看
最近在学习利用django+apache来搭建网站,需要重新用源码安装apache服务器,特根据自己遇到的问题写下此博客。
1,首先卸载原有的apache:yum remove httpd
2,下载依赖包,包括以下:
a、apr:http://mirrors.hust.edu.cn/apache//apr/apr-1.6.2.tar.gz
b、arp-uril:http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
其他下载链接可从此网站获取:http://httpd.apache.org/download.cgi#apache24
c、pcre:http://jaist.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz
d、apache:http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.gz
其他下载链接可从此网站获取:http://httpd.apache.org/download.cgi#apache24
3,安装gcc、make、gcc-c++,必须安装gcc-c++,不然编译不了pcre:
yum
-y install gcc
yum
-y install make
yum
-y install gcc-c++
4,安装apr:
tar
-zxvf apr-1.6.2.tar.gz
cd
apr-1.6.2
./configure
--prefix=/usr/loca/apr/
make
&& make install
5,安装apr-util:
tar
-zxvf apr-util-1.6.0.tar.gz
cd
apr-util-1.6.0
./configure
--prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr-util/
注:这里必须加上参数--with-apr,不然会报错,所以安装顺序也必须是apr在前面。
make && make
install
6,安装pcre:
tar-zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure --prefix=/usr/local/pcre/
make && make install
7,安装apache:
注:安装apache时必须完成以上步骤
tar -zxvf httpd-2.4.27.tar.gz
cd httpd-2.4.27
./configure --prefix=/usr/local/apache –with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/
make
&& make install
至此已经完成安装apache服务器。
还需:
8,将http添加为系统服务:
cp apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
编辑httpd,在第二行中加入信息:
# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server
这两句必须添加,不然启动httpd时提示“httpd服务不支持”;第一行3个数字参数意义分别为:哪些linux级别需要启动httpd(3,4,5);
启动序号(85);关闭序号(15)
9,添加启动信息:
chkconfig --add httpd
查看是否添加成功:
chkconfig --list
自此可通过service httpd start | stop | restart来起停服务。
参考自:http://www.linuxidc.com/Linux/2016-03/128956.htm
http://blog.csdn.net/wplblog/article/details/52172128
1,首先卸载原有的apache:yum remove httpd
2,下载依赖包,包括以下:
a、apr:http://mirrors.hust.edu.cn/apache//apr/apr-1.6.2.tar.gz
b、arp-uril:http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
其他下载链接可从此网站获取:http://httpd.apache.org/download.cgi#apache24
c、pcre:http://jaist.dl.sourceforge.net/project/pcre/pcre/8.41/pcre-8.41.tar.gz
d、apache:http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.gz
其他下载链接可从此网站获取:http://httpd.apache.org/download.cgi#apache24
3,安装gcc、make、gcc-c++,必须安装gcc-c++,不然编译不了pcre:
yum
-y install gcc
yum
-y install make
yum
-y install gcc-c++
4,安装apr:
tar
-zxvf apr-1.6.2.tar.gz
cd
apr-1.6.2
./configure
--prefix=/usr/loca/apr/
make
&& make install
5,安装apr-util:
tar
-zxvf apr-util-1.6.0.tar.gz
cd
apr-util-1.6.0
./configure
--prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr-util/
注:这里必须加上参数--with-apr,不然会报错,所以安装顺序也必须是apr在前面。
make && make
install
6,安装pcre:
tar-zxvf pcre-8.41.tar.gz
cd pcre-8.41
./configure --prefix=/usr/local/pcre/
make && make install
7,安装apache:
注:安装apache时必须完成以上步骤
tar -zxvf httpd-2.4.27.tar.gz
cd httpd-2.4.27
./configure --prefix=/usr/local/apache –with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/
make
&& make install
至此已经完成安装apache服务器。
还需:
8,将http添加为系统服务:
cp apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
编辑httpd,在第二行中加入信息:
# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server
这两句必须添加,不然启动httpd时提示“httpd服务不支持”;第一行3个数字参数意义分别为:哪些linux级别需要启动httpd(3,4,5);
启动序号(85);关闭序号(15)
9,添加启动信息:
chkconfig --add httpd
查看是否添加成功:
chkconfig --list
自此可通过service httpd start | stop | restart来起停服务。
参考自:http://www.linuxidc.com/Linux/2016-03/128956.htm
http://blog.csdn.net/wplblog/article/details/52172128
相关文章推荐
- CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5
- CentOS-6.4-minimal版中源码安装Apache-2.2.29
- CentOS 6.3下源码安装LAMP(Linux+Apache+Mysql+Php)环境
- CentOS 6.5 apache源码安装1.0版
- CentOS-6.4-minimal版中源码安装Apache-2.2.29
- Linux[Centos6.3] 源码编译安装配置 SVN+Apache
- CentOS 源码编译安装LAMP(Apache MySQL PHP)
- CentOS6.6下源码安装apache2.4.20+PHP5.6.20
- CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5
- CentOS 6.3 源码安装LAMP(Linux+Apache+Mysql+Php)环境
- 修改原CentOS 6.3下源码安装LAMP(Linux+Apache+Mysql+Php)环境产生错误
- CentOS源码安装 apache2.2.5
- CentOS以源码方式安装Apache
- centos 6.2 源码安装 apache-2.2.21
- CentOS 4.4下源码编译安装apache+php+mysql
- Centos源码安装Apache
- CentOS 6.3下源码安装LAMP(Linux+Apache+Mysql+Php)环境
- centos7.2源码安装Apache2.4
- Linux下MySQL、Apache、PHP源码安装全程实录(CentOS 6.4)
- centos下源码包安装Apache