安装iso镜像
镜像可在 debian.org 上下载。
中国大陆可用的镜像站:
中国大陆: 兰州大学debian镜像站
中国大陆: 网易debian镜像站
一般选 iso-dvd 下的 iso 镜像。
下面均以 debian 12 为例。
分配磁盘:至少两个分区(建议),一个 efi 分区(Fat32),选作 保留的boot引导分区。另外一个ext4分区,用作系统根目录。
不要选择使用网络镜像。软件选择那里不勾选桌面,勾选ssh服务端(建议)。
安装完成后重启即可。
apt换源
切换到root用户,执行nano /etc/apt/sources.list。
换成清华源(北京市):
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
|
或者是中科大源(安徽省):
1
2
3
4
5
6
7
8
9
|
# 默认注释了源码仓库,如有需要可自行取消注释
deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
# backports 软件源,请按需启用
# deb http://mirrors.ustc.edu.cn/debian bookworm-backports main contrib non-free non-free-firmware
# deb-src http://mirrors.ustc.edu.cn/debian bookworm-backports main contrib non-free non-free-firmware
|
系统更新与软件安装
apt update && apt upgrade
首次配置一定要大更新一下系统软件,在配置好服务之后,就不要轻易执行 apt upgrade 了。
再安装一些常用软件:
apt install sudo
apt install git openssl gh
apt install build-essential
apt install screen
配置sshd
apt-get install openssh-server
配置端口转发:
(可选,便于vscode远程插件连接)
编辑 /etc/ssh/sshd_config
增加或修改:
GatewayPorts yes
TCPKeepAlive yes
重启sshd:
sudo systemctl restart sshd
配置sudo
添加用户至sudo文件:
nano \etc\sudoer
添加一行:
ztc ALL=(ALL:ALL) NOPASSWD:ALL
或者将用户加入到 sudo 用户组中(推荐):
安装Python12.7
参考:Linux编译Python
安装Docker
参考: Docker安装教程
Docker换源
修改配置文件,没有则新增这个文件
nano /etc/docker/daemon.json
1
2
3
4
5
6
7
8
9
10
|
{
"registry-mirrors": [
"https://hub.xdark.top",
"https://hub.littlediary.cn",
"https://dockerpull.org",
"https://hub.crdz.gq",
"https://docker.1panel.live",
"https://docker.unsee.tech"
]
}
|
保存后重启一下Docker:sudo systemctl daemon-reload && sudo systemctl restart docker
查看是否生效:sudo docker info
末尾如果显示了替换的Hub源,说明换源成功了。
安装Docker管理界面Portainer
参考: Portainer安装