[root@localhost ~]# free -h total used free shared buff/cache available Mem: 3.7G 712M 2.3G 25M 697M 2.7G Swap: 3.9G 0B 3.9G [root@localhost ~]# swapoff -a [root@localhost ~]# free -h total used free shared buff/cache available Mem: 3.7G 708M 2.3G 25M 697M 2.7G Swap: 0B 0B 0B
永久禁止swap启用
下面sed那个语句就是注释含有swap的配置行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@localhost ~]# sed -ri 's/.*swap.*/#&/' /etc/fstab
[root@localhost ~]# cat /etc/fstab
# # /etc/fstab # Created by anaconda on Thu May 30 04:10:42 2024 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=f6071794-cb7e-4882-ab44-ecddae691138 /boot xfs defaults 0 0 /dev/mapper/centos-home /home xfs defaults 0 0 #/dev/mapper/centos-swap swap swap defaults 0 0
[root@master ~]# kubectl get nodes NAME STATUS ROLES AGE VERSION master Ready control-plane,master 79m v1.20.9 node1 Ready <none> 23m v1.20.9 node2 Ready <none> 23m v1.20.9
# 设置清华源 sudo tee /etc/apt/sources.list <<EOF # 清华源 deb https://mirrors4.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware #deb-src https://mirrors4.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors4.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware #deb-src https://mirrors4.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors4.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware #deb-src https://mirrors4.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb https://mirrors4.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware #deb-src https://mirrors4.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware EOF
# 更新系统 sudo apt update -y && sudo apt upgrade -y
# 配置网络接口 sudo ip linkset"$shared_interface" up sudo ip addr add 192.168.2.1/24 dev "$shared_interface"