openeuler:20.03 rpmbuild -tb 编译rpm安装 Apache httpd

目录

说明

1、安装依赖包

2、源码下载

3、编译安装 apr apr-util【可选yum install apr apr-util 安装】

1.apr-1.7.5编译安装

修改部分文件,临时解决下面的编译错误问题

2. apr-util-1.6.1编译安装

4.httpd-2.4.51.tar.bz2编译安装 

编译 httpd rpm

安装 httpd rpm

启动 httpd 服务

查看版本信息

5、docker 容器运行


说明

因为目前openeuler:20.03容器yum install httpd有问题,所以自己做一个镜像方便调试,操作过程已openeuler/openeuler:20.03 为基础。编译好的镜像已经发布到Docker Hub,可以直接使用。

1、安装依赖包

yum install -y wget apr-devel apr-util-devel pcre-devel gcc make tar gcc-c++ lua-devel \
    pcre openssl openssl-devel zlib unzip cmake ncurses-devel expat-devel libjpeg openldap-devel \
    libjpeg-devel libpng libxml2 libxml2-devel curl-devel libtool libtool-ltdl libtool-ltdl-devel \
    libevent libevent-devel zlib-static zlib-devel autoconf gd perl freetype freetype-devel \
    doxygen libuuid-devel python rpm-build libdb-devel mysql5-devel nss-devel postgresql-devel sqlite-devel unixODBC-devel

2、源码下载

apr 、apr-util下载列表 Index of /apache/apr 【可选yum install apr apr-util 安装】

 ​​​​httpd列表 Index of /dist/httpd

本文使用的版本

apr-1.7.0  https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.bz2

apr-util 1.6.1https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2

httpd-2.4.51 http://archive.apache.org/dist/httpd/httpd-2.4.51.tar.bz2

下载源码

wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.bz2 && \
wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.bz2  && \
wget http://archive.apache.org/dist/httpd/httpd-2.4.9.tar.bz2

3、编译安装 apr apr-util【可选yum install apr apr-util 安装】

1.apr-1.7.5编译安装

修改部分文件,临时解决下面的编译错误问题

testlfs             : |Line 349: LFS support a no-op in 64-bit builds
testsockets         : /Line 131: Could not bind socket (99): Cannot assign requested address

-Line 189: Condition is false, but expected true

操作步骤

tar jxf apr-1.7.0.tar.bz2                            #解压
cd apr-1.7.0                                         #进入apr目录

 #修改configure文件

sed -i "/RM='\$RM'/c\\\t\\tRM='\$RM -f'" configure

#修改test/testlfs.c文件 注释错误行 373

sed -i "/abts_run_test(suite, test_nolfs, NULL);/c\//\\tabts_run_test(suite, test_nolfs, NULL);" test/testlfs.c

#修改test/testsockets.c 文件 注释错误行 131

sed -i "/APR_ASSERT_SUCCESS(tc, \"Could not bind socket\", rv);/c\//\\tAPR_ASSERT_SUCCESS(tc, \"Could not bind socket\", rv);"  test/testsockets.c
cd ..                                                #退回上级目录
rm apr-1.7.0.tar.bz2                                 #删除老压缩包
tar cjvf apr-1.7.0.tar.bz2 apr-1.7.0                 #重新打包

 编译

rpmbuild -tb apr-1.7.0.tar.bz2

安装

yum localinstall -y /root/rpmbuild/RPMS/x86_64/apr-*.rpm

2. apr-util-1.6.1编译安装

rpmbuild -tb apr-util-1.6.1.tar.bz2

 

说明缺少依赖包 

这里的db4-devel mysql-devel 在openeuler:20.03版本中没有找到替换成libdb-devel mysql5-devel

yum install -y  libdb-devel mysql5-devel nss-devel postgresql-devel sqlite-devel unixODBC-devel
tar jxf apr-util-1.6.1.tar.bz2                         #解压
cd apr-util-1.6.1                                      #进入apr目录

 修改apr-util.spec文件 db4-devel => libdb-devel

sed -i "s/db4-devel/libdb-devel/" apr-util.spec

 修改apr-util.spec文件 mysql-devel => mysql5-devel

sed -i "s/mysql-devel/mysql5-devel/" apr-util.spec

重新打包文件 

cd ..
rm  apr-util-1.6.1.tar.bz2
tar cjvf  apr-util-1.6.1.tar.bz2 apr-util-1.6.1

 重新编译 

rpmbuild -tb apr-util-1.6.1.tar.bz2

 

安装

yum localinstall -y /root/rpmbuild/RPMS/x86_64/apr-util-*.rpm

4.httpd-2.4.51.tar.bz2编译安装 

编译 httpd rpm

rpmbuild -tb httpd-2.4.51.tar.bz2

安装 httpd rpm

yum localinstall -y /root/rpmbuild/RPMS/x86_64/*.rpm

Usage: service httpd {start|stop|restart|condrestart|reload|status|graceful|help|configtest}

启动 httpd 服务

service httpd start

查看版本信息

httpd -V

 

5、docker 容器运行

为方便调用已经制作docker容器,引用 FROM openeuler/openeuler:20.03

运行方式

docker run -p 9980:80 -tid lsqtzj/openeuler_httpd

浏览器打开localhost:9980

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值