环境: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的更多相关文章

  1. 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 ...

  2. CentOS下源码安装vsftpd-3.0.0,并设置指定用户访问指定目录(附带完整配置文件)

    1.卸载系统已经存在的ftp服务器 因为是源码安装,所以不能通过rpm -qa的方式查看是否已经安装ftp服务器,可以通过find / | grep vsftp*方式查看系统中存在哪些与vsftpd相 ...

  3. 在 CentOS 下源码安装 Xen

    http://www.vpsee.com/2010/04/install-xen-on-centos-from-source/ 在 CentOS 源码编译安装 Xen 的过程和在 Debian 上编译 ...

  4. Centos下源码安装git

    1.centos下git版本太久了,才1.8几,而官方更新的还是很活跃的,于是我就想源码安装一个新版本. 2.首先到: https://github.com/git/git/releases 下载最新 ...

  5. centos上源码安装clang 3.8

    之前想在centos系统上安装clang 3.6版本,由于yum上版本太低,想通过源码编译安装.按照网上说的源码安装步骤,下好llvm.clang.clang-tools-extra和compiler ...

  6. centos环境源码安装postgresql9.4

    源码安装简要步骤 下载PostgreSQL 源码包  下载根目录地址:http://ftp.postgresql.org/  本人选择的是当前最新版本v9.4.1:http://ftp.postgre ...

  7. centos 7 源码安装gogs

    gogs 是轻量级的私有git 平台,允许个人通过低配置的服务器安装私有git gogs 的官网地址是:https://gogs.io/ 安装步骤 1)源码安装mysql 2)  源码安装git 3) ...

  8. CentOS 下源码安装LAMP环境

    一.简介 什么是LAMP    LAMP是一种Web网络应用和开发环境,是Linux, Apache, MySQL, Php/Perl的缩写,每一个字母代表了一个组件,每个组件就其本身而言都是在它所代 ...

  9. CentOS 7 源码安装 Zabbix 6.0

    Zabbix 主要有以下几个组件组成: Zabbix Server:Zabbix 服务端,是 Zabbix 的核心组件.它负责接收监控数据并触发告警,还负责将监控数据持久化到数据库中. Zabbix ...

随机推荐

  1. Spring Boot 之 Spring Batch 批处理实践

    实践内容 从 MariaDB 一张表内读 10 万条记录,经处理后写到 MongoDB . 具体实现 1.新建 Spring Boot 应用,依赖如下: <!-- Web 应用 --> & ...

  2. webpack指南(二)code spliting+懒加载

    code spliting 把代码分离到不同的 bundle 中,然后可以按需加载或并行加载这些文件. 代码分离可以用于获取更小的 bundle,以及控制资源加载优先级,如果使用合理,会极大缩减加载时 ...

  3. dockerfile文档的相关参数

    以上是用dockerfile来构建的nginx镜像示例. 一.构建stress压力测试软件镜像 ##(1) 以下是Dockerfile内容(ENTRYPOINT是运行的环境): FROM centos ...

  4. 如何在没有core文件的情况下用dmesg+addr2line定位段错误

    前言 在现网环境下,程序奔溃后不一定会留下core文件,原因有很多,比如存储空间不足就是其中一个常见的原因.此时我们只能依据linux记录的错误日志来定位问题. 涉及linux命令 本文涉及以下几条命 ...

  5. Android gradle 自定义插件

    Gradle 的插件有三种打包方式: 构建脚本:插件逻辑写在 build.gradle 中,适用于逻辑简单的任务,但是该方式实现的插件在该构建脚本之外是不可见的,只能用于当前脚本. buildSrc项 ...

  6. Text Reverse(hdu1062)

    输入方式:先输入整数,再循环输入字符串. 思考:字符串中有空格.那么要在字符串大循环输入前,首先,用"getchar()"函数读取scanf_s()函数缓冲区的空格或者空行或者换行 ...

  7. 永久激活idea

    申明:本教程 IntelliJ IDEA 破解补丁.激活码均收集于网络,请勿商用,仅供个人学习使用,如有侵权,请联系作者删除. idea版本为老版本2018版本,下载地址如下,激活方法和插件在压缩包中 ...

  8. SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'xxx' already exists

    字面意思 xxx表已存在. 在使用laravel  写同步结构的时候 最好习惯性写个if语句判定是否存在 // 判断数据表是否存在 Schema::hasTable('table'); // 判断数据 ...

  9. 需求:一个页面中需要用到多个字典数据。用于下拉选项,同时,需要将其保存为json格式。以便于key,value的相互转换。记录在实现过程中踩的坑

    本文涉及到的知识: Promise,all()的使用 js处理机制 reduce的用法 map的用法 同步异步 需求: 一个页面中需要用到多个字典数据.用于下拉选项,同时,需要将其保存为json格式. ...

  10. 【GAN】GAN设计与训练集锦

    以下内容纯属经验之谈,无公式推断!部分内容源自其他博客或课程,并已标注来源. 问题篇[1] 1.模式崩溃 在某个模式(mode)下出现大量重复样本,如左图中,生成的样本分布靠得很近,较聚集,可视化如右 ...