环境: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. linux下安装gmp遇到 configure:error:no usable m4 in$path or /user/5bin解决方案

    安装过程中遇到如下报错: 上面的报错是因为你没有安装m4,安装m4就可以了:以下两种命令人选其一: #yum install m4 或 #apt-get install m4 ps:如果遇到权限问题就 ...

  2. 终于,帮开发写了一个bug

    写在文章的开头 最近项目比较紧,尤其前端的的需求比较多,作为一名测试,也会些vue,本着加快项目进度的美好想法,就自告奋勇的向组长承接了一部分开发的任务,其中有个需求需要在我们的广告管理后台新增一个上 ...

  3. 类文件结构——深入理解Java虚拟机 笔记三

    在之前的笔记中记录过,Java程序变成可执行文件的步骤是:源代码-->经过编译变成class文件-->经过JVM虚拟机变成可执行的二进制文件.因此,为了对JVM执行程序的过程有一个好的了解 ...

  4. XShell 评估到期

    刚刚打开XShell弹出”评估到期“,点击确定后自动打开中文官网,得购买后才能使用. 当初下载的时候没留意到会有这一天.. 手头拮据的朋友可以通过下面方法绕过: 删除XShell. 到英文官网下载页找 ...

  5. 05.django 搜索与过滤

    django-filter https://github.com/carltongibson/django-filter https://django-filter.readthedocs.io/en ...

  6. 使用包时,报 xxx.default is not a function

     最近做了一个导出功能,代码如下 import request from 'request-promise-native'; export default class Form { // 导出 @po ...

  7. How To Mitigate Slow HTTP DoS Attacks in Apache HTTP Server

    http://www.acunetix.com/blog/web-security-zone/articles/slow-http-dos-attacks-mitigate-apache-http-s ...

  8. 朱刘算法 有向图定根的最小生成树poj3164

    关于为什么不能用Prim求解此类问题,如下 Prim可以看成是维护两个顶点集或者看成维护一颗不断生成的树(感觉前一种说法好一点) 倘若是有向图有三个顶点1.2.3 边的情况如下 1->2:    ...

  9. 【1-n】区间覆盖 TOJ4168+BZOJ1192

    Xiao Ming is very interesting for array. He given a sorted positive integer array and an integer n. ...

  10. poj3249 拓扑找最长路

    Test for Job Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 11230   Accepted: 2651 Des ...