#1 ssh连接的时候报Key exchange failed
原因:服务端版本高,抛弃了一些不安全的交换密钥算法,且客户端版本比较旧,不支持安全性较高的密钥交换算法。
解决方案:
- 如果是内网应用,安全要求不这么高,可以选择向服务器配置中添加老的密钥交换算法的支持
把KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
追加到/etc/ssh/sshd_config
文件的最后。 - 升级连接客户端,新版本的软件比如xshell.mobaxterm都可。
#2 Ubuntu软件安装太慢
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 备份
sudo vim /etc/apt/sources.list # 更改为清华源https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
sudo apt update # 更新软件缓存信息
#3 安装openjdk链接
https://learn.microsoft.com/zh-cn/java/openjdk/download#openjdk-8
https://adoptium.net/zh-CN/temurin/archive/?version=8
#4 时间同步
############ chrony
sudo apt install chrony # Ubuntu 同步同步软件
sudo apt install ntpdate # Ubuntu 操作时间软件
sudo vi /etc/chrony/chrony.conf # 修改NTP时间源server, 格式:server 时钟源(如:192.169.1.5) iburst minpoll 5 maxpoll 6
ntpdate xxxxx # 强制同步时间,避免因为时间差别太大,chrony追的太慢或者不同步
systemctl start chrony # 启动
systemctl enable chrony # 配置自启动
chronyc sources -v # 查看同步状态
############ ntp
sudo apt install ntpd # Ubuntu 同步同步软件
sudo apt install ntpdate # Ubuntu 操作时间软件
sudo vi /etc/ntp.conf # 修改NTP时间源server, 格式:server 时钟源(如:192.169.1.5) iburst minpoll 5 maxpoll 6
ntpdate xxxxx # 强制同步时间,避免因为时间差别太大,ntp追的太慢或者不同步
systemctl start ntpd # 启动
systemctl enable ntpd # 配置自启动
ntpq -p # 查看同步状态,带*号表示正常同步
同步时间到硬件:
在/etc/sysconfig/ntpd文件中增加:SYNC_HWCLOCK=yes
手动同步一次: hwclock -w
##### 修改时区
timedatectl # 查看当前时区
timedatectl list-timezones | grep 'Asia/Shanghai' #查看支持的时区
sudo timedatectl set-timezone Asia/Shanghai # 设置时区
#5 文件系统挂载
# 常用命令
blkid # 查看块设备的UUID
lsblk # 查看块设备情况
# 挂载配置
# 路径/uuid 挂载路径 文件系统类型 挂载配置 0 0
/dev/vg/lv_tmp /tmp ext4 defaults,nodev,nosuid 0 0
/dev/vg/lv_var /var ext4 defaults,nodev,nosuid 0 0
/dev/vg/lv_home /home ext4 defaults,nosuid 0 0
UUID=your-uuid /mnt/your-mount-point ext4 defaults,nosuid 0 0 # 用uuid来挂载
<NFS Server>:/vol /data nfs defaults,bg 0 0
nodev
含义:此选项禁止在文件系统上创建字符或块设备文件。
作用:字符和块设备文件通常用于访问硬件设备。通过设置nodev选项,可以防止通过挂载的文件系统创建恶意设备文件,从而防止潜在的设备文件创建攻击,增强系统的安全性。
nosuid
含义:此选项禁止在文件系统上设置用户ID(suid)和组ID(sgid)位。
作用:suid和sgid位允许执行文件以文件所有者的权限运行,这在某些情况下可能会导致安全漏洞。通过设置nosuid选项,可以防止执行文件获得不必要的权限,从而增强系统的安全性。
bg
使用bg选项将NFS的开机自动挂载放在后台进行,默认是fg前台进行挂载,避免启动时挂不上系统hang住
#6 docker安装
# 安装yum工具
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2 --skip-broken
# 添加阿里云的docker-ce源
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 预解析软件库
yum makecache
# 安装docker-ce
yum install -y docker-ce
# 关闭防火墙
systemctl stop firewalld
# 禁止开机启动防火墙
systemctl disable firewalld
# 启动docker
systemctl start docker
# 禁止开机启动防火墙
systemctl enable docker
# 安装完docker后,自动有个docker的组,将用户加入这个附加组,使除了root以外,普通用户也能执行docker
usermode -a -G docker xxxx
# 更换docker源
vim /etc/docker/daemon.json
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": false,
"features": {
"buildkit": true
},
"live-restore": true,
"registry-mirrors": [
"https://docker.211678.top",
"https://docker.1panel.live",
"https://hub.rat.dev",
"https://docker.m.daocloud.io",
"https://do.nark.eu.org",
"https://dockerpull.com",
"https://dockerproxy.cn",
"https://docker.awsl9527.cn/"
"https://docker-0.unsee.tech",
"https://hub.fast360.xyz",
"https://dockerpull.cn"
],
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
# 重启生效
systemctl daemon-reload && systemctl restart docker
# 测试docker
docker run hello-world