centos 7 源码安装openssh
环境:centos 7.1.1503 最小化安装
依赖包下载: yum -y install lrzsz zlib-devel perl gcc pam-devel
1、安装openssl ,选用最新发布的版本:openssl-1.1.1g.tar.gz
1)openssl下载地址:https://www.openssl.org/source/openssl-1.1.1g.tar.gz
2)卸载系统预装的openssl ,这一步可以不做
rpm -qa | grep openssl | grep -v lib
yum -y remove openssl-1.0.1e-42.el7.x86_64

3)安装步骤:
tar -zxvf openssl-1.1.1g.tar.gz
cd cd openssl-1.1.1g
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl -Wl,-rpath,/usr/local/openssl/lib shared
make && make install
4)创建软链接
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
5)更新系统配置
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
/sbin/ldconfig
6)检查版本
openssl version

2、安装openssh,选用最新发布的版本:openssh-8.3p1.tar.gz
1)openssh下载地址:https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/openssh-8.3p1.tar.gz
2)备份系统的openssh配置文件,这一步很重要,必须做
cp -r /etc/sysconfig/sshd /etc/sysconfig/sshd.bak
cp -r /sys/fs/cgroup/systemd/system.slice/sshd.service /sys/fs/cgroup/systemd/system.slice/sshd.service.bak
cp -r /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.service.bak
cp -r /usr/lib/systemd/system/sshd.socket /usr/lib/systemd/system/sshd.socket.bak
cp -r /usr/lib/systemd/system/sshd@.service /usr/lib/systemd/system/sshd@.service.bak
cp -r /usr/lib/systemd/system/sshd-keygen.service /usr/lib/systemd/system/sshd-keygen.service.bak
3)卸载系统预装的openssh,这一步可以不做
rpm -qa | grep openssh
yum -y remove openssh-server-6.6.1p1-11.el7.x86_64 openssh-clients-6.6.1p1-11.el7.x86_64 openssh-6.6.1p1-11.el7.x86_64

4)备份openssh配置文件,这一步可以不做
cp -r /etc/ssh /etc/ssh.bak
rm -rf /etc/ssh #这一步很重要,必须做
5)安装步骤
tar -zxvf openssh-8.3p1.tar.gz
cd openssh-8.3p1
./configure --prefix=/usr/local/openssh --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/openssl/include --with-ssl-dir=/usr/local/openssl --with-zlib --with-md5-passwords --with-pam --with-ssl-engine
make && make install
6)创建软链接
ln -s /usr/local/openssh/sbin/sshd /sbin/sshd
ln -s /usr/local/openssh/bin/ssh /usr/bin/ssh
ln -s /usr/local/openssh/bin/ssh-add /usr/bin/ssh-add
ln -s /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
ln -s /usr/local/openssh/bin/ssh-keyscan /usr/bin/ssh-keyscan
7)恢复备份的配置文件
mv /etc/sysconfig/sshd.bak /etc/sysconfig/sshd
mv /sys/fs/cgroup/systemd/system.slice/sshd.service.bak /sys/fs/cgroup/systemd/system.slice/sshd.service
mv /usr/lib/systemd/system/sshd.service.bak /usr/lib/systemd/system/sshd.service
mv /usr/lib/systemd/system/sshd.socket.bak /usr/lib/systemd/system/sshd.socket
mv /usr/lib/systemd/system/sshd@.service.bak /usr/lib/systemd/system/sshd@.service
mv /usr/lib/systemd/system/sshd-keygen.service.bak /usr/lib/systemd/system/sshd-keygen.service
8)检查openssh版本
ssh -V

9)修改openssh的配置文件,允许root登录
vi /etc/ssh/sshd_config
将 #PermitRootLogin prohibit-password 修改为 PermitRootLogin yes

10)将sshd服务设为开机启动
chkconfig sshd on
11)重启sshd服务
systemctl restart sshd && systemctl restart sshd && systemctl restart sshd && systemctl restart sshd &

至此openssh服务安装完成,不放心的话可以reboot重启机器
参考文章
https://blog.csdn.net/zhang197093/article/details/79029623
centos 7 源码安装openssh的更多相关文章
- CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5
一.准备(把所有的源文件放在‘/home/yuanjun’目录下) apr http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz apr-util ...
- CentOS下源码安装vsftpd-3.0.0,并设置指定用户访问指定目录(附带完整配置文件)
1.卸载系统已经存在的ftp服务器 因为是源码安装,所以不能通过rpm -qa的方式查看是否已经安装ftp服务器,可以通过find / | grep vsftp*方式查看系统中存在哪些与vsftpd相 ...
- 在 CentOS 下源码安装 Xen
http://www.vpsee.com/2010/04/install-xen-on-centos-from-source/ 在 CentOS 源码编译安装 Xen 的过程和在 Debian 上编译 ...
- Centos下源码安装git
1.centos下git版本太久了,才1.8几,而官方更新的还是很活跃的,于是我就想源码安装一个新版本. 2.首先到: https://github.com/git/git/releases 下载最新 ...
- centos上源码安装clang 3.8
之前想在centos系统上安装clang 3.6版本,由于yum上版本太低,想通过源码编译安装.按照网上说的源码安装步骤,下好llvm.clang.clang-tools-extra和compiler ...
- centos环境源码安装postgresql9.4
源码安装简要步骤 下载PostgreSQL 源码包 下载根目录地址:http://ftp.postgresql.org/ 本人选择的是当前最新版本v9.4.1:http://ftp.postgre ...
- centos 7 源码安装gogs
gogs 是轻量级的私有git 平台,允许个人通过低配置的服务器安装私有git gogs 的官网地址是:https://gogs.io/ 安装步骤 1)源码安装mysql 2) 源码安装git 3) ...
- CentOS 下源码安装LAMP环境
一.简介 什么是LAMP LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而言都是在它所代 ...
- CentOS 7 源码安装 Zabbix 6.0
Zabbix 主要有以下几个组件组成: Zabbix Server:Zabbix 服务端,是 Zabbix 的核心组件.它负责接收监控数据并触发告警,还负责将监控数据持久化到数据库中. Zabbix ...
随机推荐
- git仓促拉去提交输入密码读取钥匙串
项目的目录执行: git config --global credential.helper osxkeychain
- input输入框直接拉起九宫格数字键盘
<input type="number" pattern="\d*">
- 1.Spring 框架概述
目录 Spring 框架概述 1 我们所说的 "Spring "是什么意思 2. Spring和Spring框架的历史 3. 设计理念 4.反馈和贡献 5.开始使用 Spring ...
- 仅需60秒,使用k3sup快速部署高可用K3s集群
作者简介 Dmitriy Akulov,连续创业者,16岁时搭建了开源CDN公共服务jsDelivr的v1版本.目前是边缘托管平台appfleet创始人. 原文链接: https://ma.ttias ...
- 聊聊Grpc使用中的坑以及怎么填
总所周知,随着云技术的发展,和业务的复杂度的上升,越来越多的系统开始拆分成独立的子模块微服务.模块之间免不了相互通信.但是随着业务量的增多,传输量也随之增大,偶发性timeout,无响应, 传输量过大 ...
- 10.02经典类的bug
#以下在python 3.6版本里已没有这个问题了1class A: def _init__(self): print ("this is A") def save(self): ...
- IE8/IE9/IE10打开网页后,自动设置浏览器模式为“IE8/IE9/IE10兼容性视图”
http://blog.snsgou.com/post-16.html 作者:SNSGOU 发布于:2013-07-17 22:23:05 分类:CSS/HTML 评论(0) 浏览(132 ...
- JavaScript高级技术总结
正则表达式 正则表达式的作用 正则表达式的作用: 匹配字符串的一种规则,正则表达式的作用主要是用于匹配字符串的 需求: 校验手机号 <!DOCTYPE html> <html la ...
- 一、环境的安装Dev-C++
1.https://sourceforge.net/projects/orwelldevcpp/?source=directory 2. 3. 4. 5.看到下面页面表示安装已完成啦
- indetityserver4-implicit-grant-types-请求流程叙述-上篇
说明:使用项目代码是这个,做了一点体力活:将 implicit grant types(简化授权类型)的页面跳转流程抓了个包. QuickstartIdentityServer 项目的发布地址:127 ...