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 ...
随机推荐
- ereg正则%00截断
0x01 <?php $flag = "xxx"; if (isset ($_GET['password'])) { if (ereg ("^[a-zA-Z0-9] ...
- Jmeter简单性能测试练习
项目描述: 被测网站:xqtesting.blog.51cto.com 指标:响应时间以及错误率 场景:线程数20 测试步骤: 测试计划 线程组 http请求 监听器 运行脚本 查看报告 1.添加 ...
- ql的python学习之路-day14
前言:本节主要学习时间模块time.datetime python中的几种时间表示:1)时间戳 2)格式化的字符串时间 3)struct_time元组格式的时间 time.datetime模块源码: ...
- ios上表单默认样式
摘自:http://blog.sina.com.cn/s/blog_7d796c0d0102uyd2.html 可惜不能直接转到博客园. input[type="button"], ...
- xctf-misc 新手区 wp
目录 this_is_flag pdf SimpalRAR ext3 stegano this_is_flag Most flags are in the form flag{xxx}, for ex ...
- 安卓网络编程学习(1)——java原生网络编程(2)
写在前面 该博客紧接上篇博客:https://www.cnblogs.com/wushenjiang/p/12937531.html,继续学习post请求,带参数的post和get请求以及文件上传与下 ...
- 新概念英语三 新东方主讲Lesson1
新概念二 Lesson95 词汇 ①get a shock 吓了一跳,得到一个惊喜 例:his wife got a shock get into a such mess 这么不幸搞得一片狼籍弄得这样 ...
- poj3680 最大权不相交路径
Intervals Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 8587 Accepted: 3662 Descrip ...
- CF916C
题目链接:http://codeforces.com/contest/916/problem/C 题目大意: 用\(n\)个结点,\(m\)条边(每条边的权值范围为[1, 109]) 构造出一个无向带 ...
- git简单的使用步骤
Git介绍 Git是分布式版本控制系统 集中式VS分布式,SVN VS Git 1)SVN和Git主要的区别在于历史版本维护的位置 2)这两个工具主要的区别在于历史版本维护的位置Git本地仓库包含代码 ...