引言
UbuntuServer系统安装后, 默认设置用起来不太顺手,使用相关命令进行调整,包括国内镜像、关闭系统自动更新、禁用 cloud-init,以下是具体设置。

APT 国内镜像
国内镜像加快软件包下载速度
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
$ cat /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
$ sudo apt update
|
注: 24.04LTS 特征为 noble, 22.04LTS 特征为 jammy, 参考"Ubuntu 软件仓库清华源"链接
关闭系统自动更新
UbuntuServer的自动更新的内核更新会让基于Dkms的Nvidia显卡驱动失效,需要重新安装,而且会让机器频繁需要重启,这里我们停用它,手动进行控制
1
2
|
# 使用命令配置更新策略:
$ sudo dpkg-reconfigure unattended-upgrades
|
禁用 cloud-init
目前暂时用不到,这个在开机时会有检测,消耗一定的时间,这里暂时关闭
1
|
$ sudo touch /etc/cloud/cloud-init.disabled
|
参考