Ubuntu下apache安装

安装环境:Ubuntu 10.04 LTS

第一步,下载相关软件

 由于apache的安装需要依赖apr,apr-util,pcre,故这些软件需要一起下载,如下:

 1、apr-1.5.1.tar.gz          下载地址:http://apache.fayea.com/apache-mirror/apr/

 2、apr-util-1.5.3.tar.gz    下载地址:同上

 3、pcre-8.35.tar.gz   下载地址:http://ftp.exim.llorien.org/pcre/

          4、httpd-2.4.9.tar.gz  下载地址:http://apache.fayea.com/apache-mirror/httpd/

第二步,安装软件

 1、安装apr

                # tar -zxf apr-1.5.1.tar.gz

                # ./configure --prefix=/opt/apr

                # make

                # sudo make install

 2、安装apr-util

                # tar -zxf apr-util-1.5.3.tar.gz

                # ./configure --prefix=/opt/apr-util

                # make

                # sudo make install

 3、安装pcre

                # tar -zxf pcre-8.35.tar.gz

                # ./configure --prefix=/opt/pcre

                # make

                # sudo make install

 4、安装httpd

                # tar -zxf httpd-2.4.9.tar.gz

                # ./configure --prefix=/opt/apache2 --with-apr=/opt/apr --with-apr-util=/opt/apr-util --with-pcre=/opt/pcre

                # make

                # sudo make install

 

第三步:启动apache

          1、启动

                 # cd /opt/apache2/bin

                 # sudo ./apachectl start

           2、浏览器中输入http://localhost/,如果返回It works!就说明安装成功了!

安装过程中几个可能碰到的问题:

1、安装pcre时,提示"You need a C++ compiler for C++ support“,产生这个问题是由于Ubuntu默认是不带C++编译器的,可以执行如下apt-get install命令安装

# sudo apt-get install build-essential

      2、下载build-essential时可能遇到“无法连接上cn.archive.ubuntu.com:80“错误,可能是这个源有问题,可以增加一个新的源,打开/etc/apt/sources.list,追加如下内容,然后运行# sudo apt-get update即可

deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
    deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
    deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
    deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
    deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
    deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
    deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
    deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
    deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
    deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted

相关推荐