Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install openssh with centos7 source code

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you how to install openssh centos7 source code, the content is simple and easy to understand, I hope you can learn about it, after learning, there will definitely be gains, the following let Xiaobian take you to see it.

1. Install openssl and select the latest released version: openssl-1.1.1g.tar.gz

rpm -qa | grep openssl | grep -v lib

yum -y remove openssl-1.0.1e-42.el7.x86_64

3) Installation steps:

tar -zxvfopenssl-1.1.1g.tar.gz

cdcd openssl-1.1.1g

./ config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl -Wl,-rpath,/usr/local/openssl/lib shared

make && make install

4) Create soft links

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

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

5) Update system configuration

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

/sbin/ldconfig

6) Check the version

openssl version

2, Install openssh, Use the latest release version: openssh-8.3p1.tar.gz

1) Backup the openssh configuration file of the system

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) Uninstall the openssh preinstalled in the system. This step can be omitted.

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) Backup openssh configuration file, this step can not be done

cp -r /etc/ssh /etc/ssh.bak

rm -rf /etc/ssh #This step is important and must be done

5) Installation steps

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) Create soft links

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) Restore backup configuration files

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) Check the OpenSSH version

ssh -V

9) Modify the openssh configuration file to allow root login

vi /etc/ssh/sshd_config

Change #PermitRootLogin represit-password to PermitRootLogin yes

10) Set the sshd service to boot

chkconfig sshd on

11) Restart sshd service

systemctl restart sshd && systemctl restart sshd && systemctl restart sshd && systemctl restart sshd &

At this point, the installation of openssh service is complete. If you are not assured, you can reboot the machine.

ps: The following is a look at the problem of compiling and installing openssl under Linux without generating dynamic link library.so

Using the official config command does not generate.so by default, the solution is to execute./ Add the parameter shared to config, for example:

./ config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -Wl,-rpath,/usr/local/ssl/lib shared

Then make && make install

The above is about how to install openssh content centos7 source code, if you have learned to knowledge or skills, you can share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report