openssh远程升级及rpm包构建操作

一、openssh升级

环境:centos7

1、为防止挂掉,先启用telnet
[root@cisqjserver openssh-8.1p1]# yum install -y xinetd.x86_64 telnet-server zlib-devel openssl-devel pam-devel 

[root@cisqjserver openssh-8.1p1]# systemctl start xinetd
[root@cisqjserver openssh-8.1p1]# systemctl start telnet.socket
[root@cisqjserver openssh-8.1p1]# mv /etc/securetty /etc/securettybak

chmod 0600 /etc/ssh/ssh_host_ed25519_key
chmod 0600 /etc/ssh/ssh_host_ecdsa_key
chmod 0600 /etc/ssh/ssh_host_rsa_key

2、开始升级:
[root@cisqjserver openssh-8.1p1]# ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-selinux
[root@cisqjserver openssh-8.1p1]# make
[root@cisqjserver openssh-8.1p1]# make install

3、停止telnet相关:
[root@cisqjserver openssh-8.1p1]# systemctl stop telnet.socket
[root@cisqjserver openssh-8.1p1]# systemctl stop xinetd
[root@cisqjserver openssh-8.1p1]# mv /etc/securettybak /etc/securetty

 

二、rpm包构建
源码包编译成rpm包:
[root@cisqjserver ~]#yum -y install rpm-build
[root@cisqjserver ~]# rpmbuild -ba openssh.spec
错误:stat /root/openssh.spec 失败:没有那个文件或目录
报错,但在当前目录下创建了一个rpmbuild目录,好像只能在用户的home目录下创建,在其他目录不会创建
[root@cisqjserver ~]# ls rpmbuild/
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
拷贝源码至/root/rpmbuild/SOURCES目录
[root@cisqjserver opt]# cp openssh-8.1p1.tar.gz /root/rpmbuild/SOURCES/
[root@cisqjserver opt]# cd /root/rpmbuild/SPECS/
[root@cisqjserver SPECS]# vim openssl.spec

Name:openssh
Version:8.1p1
Release:1
Summary:openssh8.1

#Group:         
License:GPL
#URL:           
Source0:openssh-8.1p1.tar.gz

#BuildRequires: 
#Requires:      

%description
This is openssh8.1

%prep
%setup -q


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


%install
make install DESTDIR=%{buildroot}


%files
%doc
/etc/ssh/moduli
/etc/ssh/ssh_config
/etc/ssh/sshd_config
/usr/bin/scp
/usr/bin/sftp

/usr/bin/ssh
/usr/bin/ssh-add
/usr/bin/ssh-agent
/usr/bin/ssh-keygen
/usr/bin/ssh-keyscan
/usr/libexec/sftp-server
/usr/libexec/ssh-keysign
/usr/libexec/ssh-pkcs11-helper
/usr/sbin/sshd
/usr/share/man/man1/scp.1.gz
/usr/share/man/man1/sftp.1.gz
/usr/share/man/man1/ssh-add.1.gz
/usr/share/man/man1/ssh-agent.1.gz
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man1/ssh-keyscan.1.gz
/usr/share/man/man1/ssh.1.gz
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/ssh_config.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/ssh-keysign.8.gz
/usr/share/man/man8/ssh-pkcs11-helper.8.gz
/usr/share/man/man8/sshd.8.gz

%changelog

开始构建:

[root@cisqjserver SPECS]# rpmbuild -ba openssl.spec

[root@cisqjserver SPECS]# cd /root/rpmbuild/RPMS/x86_64/
[root@cisqjserver x86_64]# ls
openssh-8.1p1-1.x86_64.rpm  openssh-debuginfo-8.1p1-1.x86_64.rpm
查看包信息:
[root@cisqjserver x86_64]# rpm -qpi openssh-8.1p1-1.x86_64.rpm 
Name        : openssh
Version     : 8.1p1
Release     : 1
Architecture: x86_64
Install Date: (not installed)
Group       : Unspecified
Size        : 4916914
License     : GPL
Signature   : (none)
Source RPM  : openssh-8.1p1-1.src.rpm
Build Date  : 2019年11月01日 星期五 10时07分29秒
Build Host  : cisqjserver
Relocations : (not relocatable)
Summary     : openssh8.1
Description :
This is openssh8.1

[root@cisqjserver x86_64]# rpm -qpl openssh-8.1p1-1.x86_64.rpm 
/etc/ssh/moduli
/etc/ssh/ssh_config
/etc/ssh/sshd_config
/usr/bin/scp
/usr/bin/sftp
/usr/bin/ssh
/usr/bin/ssh-add
/usr/bin/ssh-agent
/usr/bin/ssh-keygen
/usr/bin/ssh-keyscan
/usr/libexec/sftp-server
/usr/libexec/ssh-keysign
/usr/libexec/ssh-pkcs11-helper
/usr/sbin/sshd
/usr/share/man/man1/scp.1.gz
/usr/share/man/man1/sftp.1.gz
/usr/share/man/man1/ssh-add.1.gz
/usr/share/man/man1/ssh-agent.1.gz
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man1/ssh-keyscan.1.gz
/usr/share/man/man1/ssh.1.gz
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/ssh_config.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/ssh-keysign.8.gz
/usr/share/man/man8/ssh-pkcs11-helper.8.gz
/usr/share/man/man8/sshd.8.gz

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值