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 ...
随机推荐
- python中的字典dict
字典的常用操作及方法 增: dic[key]=value 有则修改,无则添加 dic.setdefault( ) 有则不变,无则添加:有键无值则值为None, 删: dic.pop(key) 删除后 ...
- Django之MTV模式
MTV与MVC+url控制器 MVC框架: · M:model.py 就是和数据库打交道用的,创建表等操作 · V:View 视图(视图函数:逻辑处理响应函数,ht ...
- poj2449第K小路径问题
Remmarguts' Date Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 30017 Accepted: 8159 ...
- 解决使用IDEA启动Tomcat成功但localhost:8080无法访问的问题
解决使用IDEA启动Tomcat成功但localhost:8080无法访问的问题
- python 日期、时间
1.字符类型的时间 转为 时间数组 t1 = '2013-10-10 23:40:00'timeArray = time.strptime(t1, "%Y-%m-%d %H:%M:%S&qu ...
- ubuntu 安装 swftoos
一:下载依赖: freetype下载地址 : http://ftp.twaren.net/Unix/NonGNU/freetype/ jpegsrc:下载地址 http://www.ijg.org/f ...
- SOFA入门
简介 scalable open financial architecture stack , 可扩展开放的金融架构栈: github: https://github.com/sofastack/so ...
- G1 垃圾回收器简单调优
G1: Garbage First 低延迟.服务侧分代垃圾回收器. 详细介绍参见:JVM之G1收集器,这里不再赘述. 关于调优目标:延迟.吞吐量 一.延迟,单次的延迟 单次的延迟关系到服务的响应时延, ...
- [JavaWeb基础] 030.dom4j读取xml的4种方法
通常我们在项目开发的过程中经常要操作到xml文件,在JAVA这边,我们会很自然的联想到Dom4J这个apache的开源插件,那么我们使用Dom4J如何来读取xml文件呢?下面我们来看看以下4种方法 1 ...
- [JavaWeb基础] 013.Struts2 自定义类型转换器
很多时候,我们在做web开发的时候经常要用到时间的转换器,Struts2给我们提供了一种类型转换器的接口.下面我们讲讲怎么实现吧. 1.首先我们要定义一个类型转换的类,继承自com.babybus.s ...