openssl 1.1.1L /1.1.1o/1.1.1t rpm包制作——筑梦之路

https://www.openssl.org/source/openssl-1.1.1l.tar.gzhttps://www.openssl.org/source/openssl-1.1.1l.tar.gz

CentOS社区源码:Overview - rpms/openssl - CentOS Git serveropenssl 1.1.1L /1.1.1o/1.1.1t rpm包制作——筑梦之路_第1张图片https://git.centos.org/rpms/openssl.git Fedora社区源码:

Overview - rpms/openssl - src.fedoraproject.orghttps://src.fedoraproject.org/rpms/openssl.git

openssl.spec文件内容
Summary: OpenSSL 1.1.1l for CentOS
Name: openssl
Version: %{?version}%{!?version:1.1.1l}
Release: 1%{?dist}
Obsoletes: %{name} <= %{version}
Provides: %{name} = %{version}
URL: https://www.openssl.org/
License: GPLv2+

Source: https://www.openssl.org/source/%{name}-%{version}.tar.gz

BuildRequires: make gcc perl perl-WWW-Curl
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%global openssldir /usr/openssl

%description
https://github.com/philyuchkoff/openssl-RPM-Builder
OpenSSL RPM for version 1.1.1l on CentOS

%package devel
Summary: Development files for programs which will use the openssl library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
OpenSSL RPM for version 1.1.1l on CentOS (development package)

%prep
%setup -q

%build
./config --prefix=%{openssldir} --openssldir=%{openssldir}
make

%install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%make_install

mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
ln -sf %{openssldir}/lib/libssl.so.1.1 %{buildroot}%{_libdir}
ln -sf %{openssldir}/lib/libcrypto.so.1.1 %{buildroot}%{_libdir}
ln -sf %{openssldir}/bin/openssl %{buildroot}%{_bindir}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%{openssldir}
%defattr(-,root,root)

%files devel
%{openssldir}/include/*
%defattr(-,root,root)

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

制作过程参考我的另一篇制作openssh rpm包的文章centos 7 制作openssh8.7/8.8 p1 rpm包升级——筑梦之路_筑梦之路-CSDN博客草稿https://blog.csdn.net/qq_34777982/article/details/120048044

#卸载旧版openssl,  切记不要删除openssl-libs
rpm -qa | grep openssl
rpm -e --justdb --nodeps 

#安装新版
rpm -ivh openssl-1.1.1l-1.el7.x86_64.rpm --nodeps

#验证
openssl version
rpm -qa | grep openssl

已经编译好的rpm包:openssl-1.1.1l-1.el7.x86_64.rpm-互联网文档类资源-CSDN下载opensslrpm包,适用于centos7redhat7系统,主要是修复系统高危漏洞进行升更多下载资源、学习资料请访问CSDN下载频道.https://download.csdn.net/download/qq_34777982/37367882

CentOS 8 制作openssl rpm包

源码:

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz

编写spec文件:

Summary: OpenSSL 1.1.1o for CentOS
Name: openssl
Version: %{?version}%{!?version:1.1.1o}
Release: 1%{?dist}
Obsoletes: %{name} <= %{version}
Provides: %{name} = %{version}
URL: https://www.openssl.org/
License: GPLv2+
 
Source: https://www.openssl.org/source/%{name}-%{version}.tar.gz
 
BuildRequires: make gcc perl
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%global openssldir /usr/openssl
 
%description
https://github.com/philyuchkoff/openssl-RPM-Builder
OpenSSL RPM for version 1.1.1o on CentOS
 
%package devel
Summary: Development files for programs which will use the openssl library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
 
%description devel
OpenSSL RPM for version 1.1.1o on CentOS (development package)
 
%prep
%setup -q
 
%build
./config --prefix=%{openssldir} --openssldir=%{openssldir}
make
 
%install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%make_install
 
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
ln -sf %{openssldir}/lib/libssl.so.1.1 %{buildroot}%{_libdir}
ln -sf %{openssldir}/lib/libcrypto.so.1.1 %{buildroot}%{_libdir}
ln -sf %{openssldir}/bin/openssl %{buildroot}%{_bindir}
 
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
 
%files
%{openssldir}
%defattr(-,root,root)
 
%files devel
%{openssldir}/include/*
%defattr(-,root,root)
 
%post -p /sbin/ldconfig
 
%postun -p /sbin/ldconfig

制作过程大同小异,这里就不再赘述
报错:
错误:空 %file 文件 /root/rpmbuild/BUILD/openssl-1.1.1o/debugsourcefiles.list

echo "%debug_package %{nil}" >> /usr/lib/rpm/macros

RPM 构建错误:
    发现已安装(但未打包的)文件:
   /usr/bin/openssl
   /usr/lib64/libcrypto.so.1.1
   /usr/lib64/libssl.so.1.1

此问题解决方案:

将未打包的文件进行打包,写入%files部分,将在下面贴出spec文件添加的部分:
%files
%{openssldir}
%defattr(-,root,root)
/usr/bin/openssl
/usr/lib64/libcrypto.so.1.1
/usr/lib64/libssl.so.1.1



参考官方的spec:
https://github.com/OpenMandrivaAssociation/openssl/blob/openssl-1.1/openssl.spec

openssl-1.1.1o_el7-x86_64_rpm.zip-Linux文档类资源-CSDN下载

#openssl  1.1.1s 版本
Name: openssl		
Version: 1.1.1s	
Release: 1%{?dist}
Summary: Utilities from the general purpose cryptography library with TLS implementation	

Group: System Environment/Libraries
License: OpenSSL
URL: http://www.openssl.org/
Source0: openssl-%{version}.tar.gz

BuildRequires: make, gcc, coreutils, krb5-devel, perl, sed, zlib-devel, perl-WWW-Curl
Requires: coreutils, make
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%global openssldir /usr/openssl

%description
The OpenSSL toolkit provides support for secure communications between
machines. OpenSSL includes a certificate management tool and shared
libraries which provide various cryptographic algorithms and
protocols.

%package devel
Summary: Development files for programs which will use the openssl library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
OpenSSL RPM for version 1.1.1s on Centos (development package)


%prep
%setup -q


%build
./config --prefix=%{openssldir} --openssldir=%{openssldir}
make


%install
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%make_install

mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
ln -sf %{openssldir}/lib/libssl.so.1.1 %{buildroot}%{_libdir}
ln -sf %{openssldir}/lib/libcrypto.so.1.1 %{buildroot}%{_libdir}
ln -sf %{openssldir}/bin/openssl %{buildroot}%{_bindir}


%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%{openssldir}
%defattr(-,root,root)
/usr/bin/openssl
/usr/lib64/libcrypto.so.1.1
/usr/lib64/libssl.so.1.1

%files devel
%{openssldir}/include/*
%defattr(-,root,root)

%post -p /sbin/ldconfig
 
%postun -p /sbin/ldconfig

openssl-1.1.1t-1.el7.x86-64.rpm-Linux文档类资源-CSDN下载

你可能感兴趣的:(linux系统运维,openssl,rpm,redhat)