centos docker ssh 登錄
使用ifconfig,需要安裝net-tools窃祝。
yum install -y net-tools
安裝openssl,openssh-server
yum install -y openssl openssh-server
/usr/sbin/sshd -D
sh-4.2# /usr/sbin/sshd -D
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.
創(chuàng)建秘鑰等
[root@master /]# cd
[root@master ~]# ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N ''
[root@master ~]# ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
[root@master ~]# ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key -N ''
接著修改sshd_config文件配置信息踱侣,路徑為 /etc/ssh/sshd_config
1.將 Port 22 前面的注釋去掉
2.將 PermitRootLogin 的 no 改為 yes
重新啟動sshd:命令結(jié)尾加個‘&’粪小,自動后臺運行,啟動成功會返回進程號
[root@master ~]# /usr/sbin/sshd -D &
[root@master ~]# ps aux |grep sshd
root 50 0.0 0.0 112948 7756 pts/1 S 17:50 0:00 /usr/sbin/sshd -D
root 57 0.1 0.1 155552 10024 ? Ss 17:52 0:00 sshd: root@pts/2
root 73 0.0 0.0 9104 828 pts/1 S+ 17:53 0:00 grep --color=auto sshd
重新設(shè)置root密碼等
yum install passwd
[root@master ~]# passwd
Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
查看cenos版本
sh-4.2# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
sh-4.2# uname -a
Linux master 4.14.24-qnap #1 SMP Thu Jan 7 01:26:20 CST 2021 x86_64 x86_64 x86_64 GNU/Linux
mongo 安裝
啟動
mongod --config /usr/local/mongo/etc/mongodb.conf
或者使用
systemctl start mongodb.service
mongodb 位置:/usr/local/mongodb
mongodb 配置:mongod --config /usr/local/mongo/etc/mongodb.conf
dbpath=/usr/local/mongo/data/db # 指定數(shù)據(jù)存儲目錄
logpath=/usr/local/mongo/log/mongodb.log # 指定日志文件存儲目錄
logappend=true # 使用追加方式寫日志
port=27017 # 端口
fork=true # 以守護進程方式運行
auth=true # 啟用驗證
bind_ip=0.0.0.0 # 允許任意外部地址訪問
創(chuàng)建 mongodb.service
[Unit]
Description=mongodb
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/mongo/bin/mongod --config /usr/local/mongo/etc/mongodb.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/usr/local/mongo/bin/mongod --shutdown --config /usr/local/mongo/etc/mongodb.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
#設(shè)置可執(zhí)行權(quán)限
chmod 754 mongodb.service
**啟動服務**
systemctl start mongodb.service
**關(guān)閉服務**
systemctl stop mongodb.service
**開機啟動 **
systemctl enable mongodb.service
Centos7升級openssl到1.1.1版本
一泻仙、升級openssl操作方法
1.1安裝telnet服務糕再,避免升級openssl和openssh導致主機不能遠程
1.2準備環(huán)境
yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel pcre-devel pam-devel pam* zlib*
1.3下載openssl源碼包,我這里下載的版本是openssl-1.1.1g
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
1.4操作升級openssl
解壓:tar xf openssl-1.1.1g.tar.gz
進入openssl目錄:cd openssl-1.1.1g
編譯安裝:./config --prefix=/usr/local/openssl --openssldir=/etc/ssl --shared zlib
make -j4
make install
1.5備份當前的openssl
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
1.6配置使用新版本
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
查看是否創(chuàng)建成功:ll /usr/bin/openssl;ll /usr/include/openssl
1.7更新動態(tài)鏈接庫數(shù)據(jù)
echo “/usr/local/openssl/lib” >> /etc/ld.so.conf
1.8重新加載動態(tài)鏈接庫
/sbin/ldconfig
1.9驗證openssl版本
openssl version
解決openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory錯誤
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
參考
https://blog.csdn.net/weixin_45529004/article/details/107487645