linux 下源码方式安装 apache

环境:Ubuntu 10.04 + httpd-2.2.17

http://www.apache.org/dist/httpd/ 下载 httpd-2.2.17.tar.gz 文件

存至 /root/下载 目录

命令列表:

cd /root/下载

tar -zxvf httpd-2.2.17.tar.gz

cd httpd-2.2.17

 

 ./configure --prefix=/usr/local/apache2 --enable-module=so --enable-mods-shared=most

#若出现以下错误:

configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

执行命令:

apt-get install zlib1g-dev

 

 

make

make install

 

启动服务

/usr/local/apache2/bin/apachectl start

如果出现以下提示

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

在/usr/local/apache2/conf/httpd.conf 文件中添加

ServerName 127.0.0.1:80

 

配置开机自动启动

#建立链接文件链接到/usr/local/apache2/bin/apachectl

ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache2

#加载为服务 

update-rc.d apache2 defaults

你可能感兴趣的:(apache)