zoukankan      html  css  js  c++  java
  • cent os 7.5 离线安装gcc 升级openssh openssh-8.4p1

    一.本机系统:

    [root@localhost test]# cat /etc/redhat-release
    CentOS Linux release 7.5.1804 (Core) 
    [root@localhost test]# 
    

      

    二.安装gcc

    1.你要下载一个CentOS7的系统镜像(https://www.centos.org/download/) 或者本地有之前的安装镜像的话解压,

      解压出来会有一个Packages 这个文件,

     2.在服务器上新建一个gcc文件夹,从Packages中挑选出需要安装gcc文件,下面8个文件就可以了

         

    3.可以输入并执行以下命令,查看是否缺少gcc.环境安装包!

     rpm  -qa|grep  gcc

     4.执行gcc 文件夹下执行一下命令

     rpm -Uvh *.rpm --nodeps --force
    

    5.此时就安装成功,可以用 以下命令检查版本

    [root@localhost ~]# gcc -v
    使用内建 specs。
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
    目标:x86_64-redhat-linux
    配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
    线程模型:posix
    gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
    

     

    二.. 升级openSSh 到 OpenSSH_8.4p1

    1. 下载,需要下载以下三个文件,下载地址如下

    https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.4p1.tar.gz
    
    http://www.zlib.net/zlib-1.2.11.tar.gz
    
    https://www.openssl.org/source/openssl-1.1.1g.tar.gz
    

    2.解压升级包

    tar -zxvf zlib-1.2.11.tar.gz -C /usr/local
    tar -zxvf openssh-8.4p1.tar.gz -C /usr/local
    tar -zxvf openssl-1.1.1g.tar.gz -C /usr/local
    

    3.编译安装zlib

    cd zlib-1.2.11
    ./configure --prefix=/usr/local/zlib
    make && make install
    

    4.编译安装 openssl

    cd openssl-1.1.1g
    ./config --prefix=/usr/local/ssl -d shared
    make && make install
    echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
    ldconfig -v
    

    5. 编译安装openssh

    cd openssh-8.4p1
    ./configure --prefix=/usr/local/openssh --with-zlib=/usr/local/zlib --with-ssl-dir=/usr/local/ssl
    make && make install
    

    6.sshd_config文件修改

    echo 'PermitRootLogin yes' >>/usr/local/openssh/etc/sshd_config
    echo 'PubkeyAuthentication yes' >>/usr/local/openssh/etc/sshd_config
    echo 'PasswordAuthentication yes' >>/usr/local/openssh/etc/sshd_config
    

    7. 备份原有文件,并将新的配置复制到指定目录

    mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
    cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
    mv /usr/sbin/sshd /usr/sbin/sshd.bak
    cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
    mv /usr/bin/ssh /usr/bin/ssh.bak
    cp /usr/local/openssh/bin/ssh /usr/bin/ssh
    mv /usr/bin/ssh-keygen /usr/bin/ssh-keygen.bak
    cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
    mv /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub.bak
    cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
    

    8.启动sshd

    [root@localhost ~]# systemctl daemon-reload 
    [root@localhost ~]# service sshd restart
    Restarting sshd (via systemctl):                           [  确定  ]
    

    9.查看版本ssh版本

    [root@localhost ~]# ssh -V
    OpenSSH_8.4p1, OpenSSL 1.1.1g  21 Apr 2020
    

     

    亲测,有效,若有不恰当处,还望及时提醒!!!

    参考文案:

    https://blog.csdn.net/White_Black007/article/details/81357234

    https://www.cnblogs.com/tongchengbin/p/13809096.html

  • 相关阅读:
    训练总结
    图论--最短路--SPFA模板(能过题,真没错的模板)
    图论--最短路-- Dijkstra模板(目前见到的最好用的)
    The 2019 Asia Nanchang First Round Online Programming Contest B Fire-Fighting Hero(阅读理解)
    关于RMQ问题的四种解法
    The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 K题 center
    The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 XKC's basketball team
    The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 D Carneginon
    ZOJ 3607 Lazier Salesgirl (枚举)
    ZOJ 3605 Find the Marble(dp)
  • 原文地址:https://www.cnblogs.com/moon-yyl/p/13827366.html
Copyright © 2011-2022 走看看