美文网首页
ubuntu16.04 安装apache2

ubuntu16.04 安装apache2

作者: cca1yy | 来源:发表于2019-01-18 15:49 被阅读0次

    安装apache2服务器

    直接输入命令:

    sudo apt-get install apache2
    

    出现问题:

    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    The following packages have unmet dependencies:
    apache2 : Depends: apache2-bin (= 2.4.18-2ubuntu3.9) but it is not going to be installed
    Depends: apache2-utils (>= 2.4)
    E: Unable to correct problems, you have held broken packages.

    尝试给ubuntu换源、安装依赖等都无法解决。因此按照下面的教程,手动下载安装包之后再安装。

    解决方法:

    https://chubuntu.com/questions/28453/install-apache-2-2-22-on-ubuntu-14-04.html
    其中的第2点,不是直接用命令行安装,而是下载安装包再手动配置安装。

    # 安装build-essentials包
    sudo apt-get install build-essential
    # 为了让Apache能够将输出压缩到支持它的浏览器,您需要安装zlib。从[ zlip Hompage ](http://www.zlib.net/)(写作时zlib-1.2.11.tar.gz)下载当前版本,解压缩,导航到提取文件夹,构建和安装。
    wget http://www.zlib.net/zlib-1.2.11.tar.gz
    tar -xvf zlib-1.2.11.tar.gz
    cd zlib-1.2.11/
    ./configure --prefix=/usr/local
    make
    sudo make install
    # 安装Apache 2.2
    wget http://www-eu.apache.org/dist/httpd/httpd-2.2.32.tar.gz #安装时出问题了,应该是安装包网址更新的缘故,可以直接打开该网址寻找安装包并手动下载
    tar -xvf httpd-2.2.32.tar.gz
    cd httpd-2.2.32/
    ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http
    make
    sudo make install
    # 启动Apache
    sudo /usr/local/apache2/bin/apachectl start
    

    此时,打开浏览器,在网址处输入http://localhost/,可以看到如下界面,说明apache2已经安装成功了。

    apache正常工作啦

    相关文章

      网友评论

          本文标题:ubuntu16.04 安装apache2

          本文链接:https://www.haomeiwen.com/subject/symndqtx.html