Centos Apache安装到指定目录

本文详细介绍了在Linux环境下安装Apache服务器的步骤,包括下载和安装apr、apr-util、zlib、openssl等依赖库,以及Apache的配置、启动和停止命令。在安装过程中,特别提到了解决'libtoolT': No such file or directory错误的方法,通过修改configure文件来避免该问题。最后,验证了Apache安装成功并提供了启动、关闭和重启服务器的指令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

1.依赖库的下载及安装apr、apr-util、zlib、openssl

1.1 apr的安装

1.2 apr-util的安装

1.3 zlib的安装

1.4 openssl的安装

2.Apache的下载及安装

3.安装中问题及解决方法

3.1 rm: cannot remove 'libtoolT': No such file or directory


1.依赖库的下载及安装apr、apr-util、zlib、openssl

1.1 apr的安装

    apr下载路径:https://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz

wget https://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz
tar -zxvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/home/scott/apache2/apr
make
make install

1.2 apr-util的安装

    apr-util下载路径:https://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

wget https://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/home/scott/apache2/apr-util --with- 
apr=/home/scott/apache2/apr
make
make install

1.3 zlib的安装

    zlib下载路径:http://www.zlib.net/zlib-1.2.11.tar.gz

wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/home/scott/apache2/zlib-1.2.11
make
make install

1.4 openssl的安装

    openssl下载路径:https://www.openssl.org/source/openssl-1.1.1i.tar.gz

wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
tar -zxvf openssl-1.1.1i.tar.gz
cd openssl-1.1.1i
./config --prefix=/home/scott/apache2/openssl
make
make install

2.Apache的下载及安装

    httpd下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.46.tar.gz

wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.46.tar.gz
tar -zxvf httpd-2.4.46.tar.gz
cd httpd-2.4.46
./configure --prefix=/home/scott/apache2/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib=/home/scott/apache2/zlib --with-pcre=/home/scott/apache2/pcre --with-apr=/home/scott/apache2/apr --with-apr-util=/home/scott/apache2/apr-util --with-ssl=/home/scott/apache2/openssl --enable-modules=most --enable-mpms-shared=all 
make
make install

 将 apache 的配置文件httpd.conf(/home/scott/apache2/httpd/conf/httpd.conf)中的 ServerName 改成可用域名或如下配置  ServerName localhost:80

启动指令:  ./bin/httpd -f /home/scott/apache2/httpd/conf/httpd.conf -k start
关闭指令:  ./bin/httpd -f /home/scott/apache2/httpd/conf/httpd.conf -k start stop
重启指令:  ./bin/httpd -f /home/scott/apache2/httpd/conf/httpd.conf -k start restart

   PS:部分情况需要进入到目录 cd  /bin/, 才能执行指令httpd

启动指令:  httpd -f /home/scott/apache2/httpd/conf/httpd.conf -k start
关闭指令:  httpd -f /home/scott/apache2/httpd/conf/httpd.conf -k start stop
重启指令:  httpd -f /home/scott/apache2/httpd/conf/httpd.conf -k start restart

index.html文档路径:/home/scott/apache2/httpd/htdocs
    
    验证是否安装成功:
        浏览器输入:http://127.0.0.1:82/
        页面显示: It works!
        成功!

3.安装中问题及解决方法

3.1 rm: cannot remove 'libtoolT': No such file or directory

解决办法
            使用如下命令打开configure文件
            sudo vi configure
            找到RM='$RM'修改为RM='$RM -f'
            参考博客:https://blog.youkuaiyun.com/github_38336924/article/details/89372771
            

参考博客:https://blog.youkuaiyun.com/sforiz/article/details/81532151

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值