修改于 20250921
镜像安装
debian-13.1.0-amd64-DVD-1.iso(已经更新 Debian 13 trixie 哩)
ventoy 直接刷,不用网络镜像,不要桌面环境,只留个 ssh 和基础系统工具就行。
分区方案 大小 efi 500MB # 单系统够用 / 20G # 无桌面环境 swap 4G # 不使用休眠 home 剩余空间 # 可先在 end 分出 swap 已采用新分区:500MB 的 efi,4GB 的 swap(在 ssd 上采用 swapfile),剩余全给
/过程中遇到了些问题,grub 没有被正确安装,导致 bios 认为我的硬盘没有操作系统,解决方式参考 UEFI 下 Linux 单系统启动引导失败的一些分享
- 还是先进安装镜像选
Advanced options进rescue mode - 中间忘了,好像要先
Load installer components... - 不过问题不大,能找。然后
Enter rescue mode - 点来点去来到
Enter a device you wish to use as your root root file system - 回想一下根目录
/在哪里,我的手动分的/区在/dev/sda2 Mount separate /boot/efi partitionForce GRUB installation to the EFI removable media path把 GRUB 扔到这个分区来,拔 U 盘重启就可以正常引导了。
- 还是先进安装镜像选
系统配置
初始系统还是太简洁了,我也不知道要做些什么,慢慢来吧。
ssh
# /etc/ssh/sshd_config
PasswordAuthentication yes
重启下 ssh 服务,就可以用 ssh 连接后配置了。
systemctl restart ssh
网络设置
# /etc/network/interface
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet static
address 192.168.1.xxx/24
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 223.5.5.5 223.6.6.6
# This is an autoconfigured IPv6 interface
iface enp1s0 inet6 auto
重启下网络服务。
systemctl restart networking.service
镜像源
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ trixie-backports main contrib non-free non-free-firmware
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security trixie-security main contrib non-free non-free-firmware
更新一下。
apt update && apt upgrade -y
sudo
# 普通用户登录
su -l # 进入超级用户,不能忘了 -l 不然进去没有 adduser 命令
apt update && apt upgrade
apt install sudo # Debian 最小化安装完没有 sudo 真搞吧
adduser USERNAME sudo # USERNAME 为当前用户名
exit
groups # 查看当前用户的组
WOL 网络唤醒
# 使用前先安装 ethtool
sudo ethtool -s enp1s0 wol g
# /etc/network/interfaces 添加
iface enp1s0 inet static
***
post-up /sbin/ethtool -s enp1s0 wol g
再挂载一块硬盘
# 先分区,一路默认就行,最后输入 w 写入改动
sudo fdisk /dev/xxx
# 格式化成 ext4
sudo mkfs.ext4 /dev/xxx1
mkdir /home/USERNAME/disk
sudo mount /dev/xxx1 /home/USERNAME/disk
实现开机自动挂载。
# 先看分区 id
sudo blkid /dev/sdb1
# 备份一下
sudo cp /etc/fstab /etc/fstab.bak
# /etc/fstab 添加
UUID=****** /home/USERNAME/disk ext4 defaults 0 2
# id 挂载点 文件系统 默认挂载选项 不备份 非根分区
# 检查一下
sudo mount -a
df -h /home/USERNAME/disk
软件配置
samba
# 安装
sudo apt update
sudo apt install samba
# 创建 samba 用户
sudo smbpasswd -a USERNAME
# /etc/samba/smb.conf 添加
[home]
comment = debian
path = /home/USERNAME
browseable = yes
read only = no
valid users = USERNAME
create mask = 0777
directory mask = 0777
# 重启 samba 服务
sudo systemctl restart smbd
sudo systemctl enable smbd
htop
查看进程和系统状态。
sudo apt install htop
Docker
以下内容来自 清华大学开源软件镜像站
可能会多次遇到 Permission denied,请善用 sudo
sudo apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# 把当前用户加入 docker 组
sudo usermod -aG docker USERNAME
更换镜像源请参考 Docker 学习记录
Portainer (Docker)
参考 官方文档
# 先创建命名卷
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 \
--name portainer --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data portainer/portainer-ce
DDNS-GO (Docker)
n1 在局域网内通过 hostname 获取 IPv6 有点问题,直接再开一个容器吧。
docker run -d \
--name ddns-go --restart=unless-stopped --net=host \
-v ~/.config/ddns-go:/root jeessy/ddns-go
File Browser (Docker)
涉及到目录挂载和权限问题,这里踩了坑详见 Docker 随手记
docker run -d \
--name filebrowser \
--user $(id -u):$(id -g) \
-p PORT:80 \
-v /PATH:/srv \
-v ~/.config/filebrowser/database:/database \
-v ~/.config/filebrowser/config:/config \
--restart unless-stopped \
filebrowser/filebrowser
Syncthing (Docker)
参考 README-Docker.md,再配合 Syncthing Auto Start 在 Windows 上配置自启同步。
# 默认 Web UI 端口 8384
docker run -d --network=host \
--name=syncthing \
--user 1000:1000 \
-v ~/.config/syncthing:/var/syncthing \
-v /PATH:/sync \
--restart unless-stopped \
syncthing/syncthing
qBittorrent-Enhanced-Edition (Docker)
来自 Docker-qBittorrent-Enhanced-Edition
docker run -d \
--name=qbittorrentee \
-e WEBUIPORT=8080 \
-e PUID=$(id -u) \
-e PGID=$(id -g) \
-e TZ=Asia/Shanghai \
-e ENABLE_DOWNLOADS_PERM_FIX=true \
-p 6881:6881 \
-p 6881:6881/udp \
-p 8080:8080 \
-v ~/.config/qbittorrentee/config:/config \
-v ~/disk/download:/downloads \
--restart unless-stopped \
superng6/qbittorrentee
Komga (Docker)
docker run -d \
--name=komga \
--user 1000:1000 \
-p 25600:25600 \
-v ~/.config/komga/config:/config \
-v ~/.config/komga/tmp:/tmp \
-v /PATH:/data \
--restart unless-stopped \
gotson/komga