Ubuntu 是基于 [[Debian]] 的 [[Linux]] 发行版。
安装
在安装过程中可以通过按 Ctrl + Alt + F2
切换到 tty2 终端,然后按 Ctrl + Alt + F1
切换回安装界面。
使用
配置静态 IP
sudo vim /etc/netplan/x.yaml
文件名不一定相同,到 netplan 目录后,直接按 Tab 键即可,打开后,按以下格式输入或修改:
network: version: 2 ethernets: enp4s0: addresses: - "10.1.1.42/24" routes: - to: "default" via: "10.1.1.1" wifis: wlo1: dhcp4: true access-points: "wifi-name": auth: key-management: "psk" password: "wifipassword"
如果没有 Wi-Fi,无须输入。按 :wq
保存后,使用 [[netplan]] 测试格式是否正确: netplan try
命令行
终端
apt-get update
: 更新软件源apt-get upgrade
: 更新软件
管理
dpkg -L <pack_name>
: 包安装位置 (“dpkg”是“Debian Package”的简写)lsb_release -a
: 查看版本号
镜像源
在 [[Docker]] 中运行时,需要更换镜像源:
# 先备份cp /etc/apt/sources.list /etc/apt/sources.list.bak# 注释原有配置sed -i 's/^/#/' /etc/apt/sources.list# 新增源sed -i '$a\deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse\ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse\ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse' /etc/apt/sources.list
因为使用 https 源会报错: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/jammy-security/InRelease Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown. Could not handshake: Error in the certificate verification。因此这里用的是 HTTP。
问题
missing or unsuitable terminal: xterm-ghostty
在 Ubuntu 24 会碰到,可以通过以下命令解决:
# 先切换到 rootsudo su
echo 'export TERM=xterm-256color' >> /etc/environmentsource /etc/environment