构建OpenSSH 9.4的RPM安装包需要一些步骤。首先,你需要CentOS Stream 8系统,并且已经安装了必要的开发工具和库。

步骤1:准备工作环境

首先,你需要安装一些必要的软件包来编译OpenSSH。在终端中运行以下命令:

yum groupinstall 'Development Tools'
yum install zlib-devel openssl-devel krb5-devel libcom_err-devel

步骤2:获取OpenSSH源代码

访问OpenSSH的官方网站,找到最新版本的源代码,使用wget或curl下载到你的系统中。例如:

wget https://openbsd.org/openssh/portable/openssh-9.4p1.tar.gz

步骤3:解压源代码

将下载的源代码解压缩:

tar xvf openssh-9.4p1.tar.gz

步骤4:编译和安装

进入解压后的目录,然后配置,编译和安装OpenSSH:

cd openssh-9.4p1
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam
make
make install

步骤5:创建RPM包

在创建RPM包之前,我们需要安装 rpm-buildrpmbuild工具,使用以下命令安装:

yum install rpm-build

然后,我们需要创建一个SPEC文件来描述我们的包。在 ~/rpmbuild/SPECS目录下创建一个名为 openssh.spec的文件,然后添加以下内容:

Summary: OpenSSH 9.4 secure shell (SSH) server
Name: openssh
Version: 9.4
Release: 1
License: BSD
Group: Applications/Internet
Source: https://openbsd.org/openssh/portable/%{name}-%{version}.tar.gz
URL: https://openbsd.org/openssh/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: openssl-devel, zlib-devel, krb5-devel, libcom_err-devel

%description
OpenSSH is a free version of SSH (Secure Shell), a program for logging into and executing commands on a remote machine.

%prep
%setup

%build
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}

%files
/usr/sbin/sshd
/etc/ssh/sshd_config
/usr/bin/ssh
/usr/bin/scp
/usr/bin/sftp

最后,我们可以使用rpmbuild命令来创建RPM包:

rpmbuild -ba openssh.spec

这将在 ~/rpmbuild/RPMS目录下创建一个名为 openssh-9.4-1.x86_64.rpm的RPM包。

以上就是在CentOS Stream 8系统上编译OpenSSH 9.4的RPM安装包的步骤。请注意,这些步骤可能需要根据你的具体环境进行一些调整。在编译和安装过程中,如果遇到任何问题,请查阅相关文档或者寻求社区的帮助。


海外免备案云服务器链接:www.tsyvps.com

蓝易云香港五网CN2 GIA/GT精品网络服务器。拒绝绕路,拒绝不稳定。

最后修改:2023 年 09 月 17 日
如果觉得我的文章对你有用,请随意赞赏