# 1. Install build requirements as listed above. # 2. Edit version.env file if you want a specific version of openssh/openssl combination (or maybe I havn't updated to the latest). # 这里,如果需要指定版本的openssh或者是openssl。需要修改version.env版本文件。改成需要的版本就可以。
# 3. Download source packages. # if any error comes up, just manally download the source tar files into the `downloads` dir. ./pullsrc.sh
# 4. Run the script to build RPMs. ./compile.sh # For CentOS 5, the default rpmbuild didn't set the variable of `${dist}`, manually run the script with argument `./compile.sh el5`
第二步,拉取会下载如下包:
1 2 3 4 5 6 7 8
[root@node70 downloads]# ls -al total 16676 drwxr-xr-x 2 root root 114 Oct 27 21:23 . drwxr-xr-x 6 root root 146 Oct 27 22:49 .. -rw-r--r-- 1 root root 0 Oct 17 13:41 .keep -rw-r--r-- 1 root root 1843001 Oct 4 17:56 openssh-9.5p1.tar.gz -rw-r--r-- 1 root root 15198318 Sep 19 21:29 openssl-3.0.11.tar.gz -rw-r--r-- 1 root root 29229 Oct 17 13:41 x11-ssh-askpass-1.2.4.1.tar.gz
当然也可以自己下载了包,上传至download目录下。
第三步,开始编译,没有意外,编译完成会生成openssh的rpm包。检查编译是否完成。
1 2
# echo $? 0 # 返回0即可。
编译完成,生成的rpm包文件在RPMS目录下,我们看一下生成的rpm包。
1 2 3 4 5 6 7 8 9 10
[root@node70 el7]# cd RPMS/ [root@node70 RPMS]# tree . └── x86_64 ├── openssh-9.5p1-1.el7.x86_64.rpm ├── openssh-clients-9.5p1-1.el7.x86_64.rpm ├── openssh-debuginfo-9.5p1-1.el7.x86_64.rpm └── openssh-server-9.5p1-1.el7.x86_64.rpm
# 可以看到如下报错: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0640 for ‘/etc/ssh/ssh_host_rsa_key’ are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Unable to load host key “/etc/ssh/ssh_host_rsa_key”: bad permissions Unable to load host key: /etc/ssh/ssh_host_rsa_key --------- more ......