您的位置:首页 > 运维架构 > Linux

CentOS7 安装 OpenSSL 1.0.1m 和 OpenSSH 6.8p1

2015-06-11 20:20 603 查看
# 下载软件

wget http://zlib.net/zlib-1.2.8.tar.gz wget ftp://ftp.openssl.org/source/openssl-1.0.1m.tar.gz wget http://www.ftp.ne.jp/OpenBSD/OpenSSH/portable/openssh-6.8p1.tar.gz[/code] 
# 事前准备,安装 telnet 防止 ssh 登陆不了

# 具体查看这篇文章:http://blog.csdn.net/zhouzme/article/details/46461177

# 安装数据压缩函数库

tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
cd ..


# 编译安装 OpenSSL 

# 查看当前版本

# openssl version -a

tar -zxvf openssl-1.0.1m.tar.gz
cd openssl-1.0.1m/
./config --prefix=/usr shared zlib
make
make install
cd ..


# 替换旧版 指定了 --prefix=/usr 则无需下面的操作了

#mv /usr/bin/openssl /usr/bin/openssl.old

#mv /usr/include/openssl /usr/include/openssl.old

#ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

#ln -s /usr/local/ssl/include/openssl/ /usr/include/openssl

# 配置库文件搜索路径

#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

#ldconfig

# 编译安装 OpenSSH

# 若出现 PAM headers not found 错误则

# 安装 yum -y install pam pam-devel

yum -y install pam pam-devel

tar -zxvf openssh-6.8p1.tar.gz
cd openssh-6.8p1/
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam --with-zlib --with-md5-passwords
make
make install


# 补充下:安装时如果出现 公私密钥找不到等问题,如下图,请先忽略,继续执行下面的覆盖操作,sshd 重新加载配置后即可解决



# 覆盖旧配置文件
cp ./contrib/redhat/sshd.init /etc/init.d/sshd
chmod +x /etc/init.d/sshd
chkconfig –add sshd

cp sshd_config /etc/ssh/sshd_config
cp sshd /usr/sbin/sshd
cp -p ssh /usr/bin/ssh


# 重新加载配置

systemctl reload sshd


# 此时不要退出当前 ssh 窗口,先新开个窗口测试登陆若没有问题则完成

# 若登录时出现能连接去无法登录提示密码不接受之类的

# 尝试关闭 SELinux

vi /etc/selinux/config


# 将 

SELINUX=enforcing


# 修改为

SELINUX=disabled


# 执行更新

setenforce 0


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: