Linux手动安装Apache2.4
由于环境没有administrator权限,但是需要安装apache服务,这样只有安装到自己的目录下,一次没有运行yum, apt-get.brew等权限。对于没有依赖包也需要手动一个一个的安装。
这个方法理论上适用于所有的 Linux,我在centos和Ubuntu试过,没有问题。
安装依赖
- 安装apr
 
下面的
xxx,均是自己的用户名,根据实际情况修改。
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
tar -xzf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=./configure --prefix=/home/xxx/bin/apr
make && make install
 
这里有可能有一个error: rm: cannot remove ‘libtoolT’: No such file or directory。
 解决方法就是参考这个,在配置文件里面加一个-f
https://stackoverflow.com/questions/18091991/error-while-compiling-apache-apr-make-file-not-found
- 安装apr-util
 
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -xzf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/home/xxx/bin/apr-util --with-apr=/home/xxx/bin/apr
make && make install
 
- 安装pcre
 
wget https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz
tar -xzf pcre-8.38.tar.gz
cd  pcre-8.38
./configure --prefix=/home/xxx/bin/pcre
make && make install
 
安装apache
安装上面的一堆依赖,就可以安装apache了。
wget http://www.apache.org/dist/httpd/httpd-2.4.41.tar.gz
tar -xzf httpd-2.4.41.tar.gz
cd httpd-2.4.41
./configure --prefix=/home/xxx/bin/apache2.4 --with-apr=/home/xxx/bin/apr --with-apr-util=/home/xxx/bin/apr-util --with-pcre=/home/xxx/bin/pcre --enable-module=so
make && make install
 
运行apache
安装上面的步骤,基本上就快完成了。还有一个一步。
cd /home/xxx/bin/apache2.4
./apachectl start
 
如果没有任何报错的花,大功告成。通过IP就可以访问了。
            
            作者:叉叉敌
            
            博客:https://chasays.github.io/
            
            微信公众号:Chasays, 欢迎关注一起吹牛逼,也可以加个人微信号「xxd_0225」互吹。
            
            本博客大多为学习笔记或读书笔记,本文如对您有帮助,还请多推荐下此文,如有错误欢迎指正,相互学习,共同进步。
        

                
            
        
浙公网安备 33010602011771号