【记录】虚拟机安装Debian

Last updated on August 7, 2026 pm

观察了挺久,对于码农之外的人,pi-agent很不错。但这些agent在powershell环境下用起来总归是事倍功半,因此先虚拟机安装debian环境为搭建pi-agent做点准备。同时快照功能还能在AI删库后快速还原。

准备文件

安装注意事项

1、安装时选的镜像换源不干净,会卡住,搜教程在安装时换源,推荐阿里源
2、虚拟机不需要swap分区,分区时删掉它

sudo自动化

1
2
3
4
5
6
7
8
id -un
su
USER_NAME= id -un 的输出结果
sudo usermod -aG sudo "$USER_NAME"
cat > /etc/sudoers.d/$USER_NAME <<EOF
$USER_NAME ALL=(ALL:ALL) NOPASSWD: ALL
EOF
chmod 440 "/etc/sudoers.d/$USER_NAME"

换安全的源

  • 按安装的debian的版本改一下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sudo su
cat > /etc/apt/sources.list <<EOF
deb https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian/ trixie main contrib non-free non-free-firmware

deb https://mirrors.aliyun.com/debian-security/ trixie-security main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian-security/ trixie-security main contrib non-free non-free-firmware

deb https://mirrors.aliyun.com/debian/ trixie-updates main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian/ trixie-updates main contrib non-free non-free-firmware

deb https://mirrors.aliyun.com/debian/ trixie-backports main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian/ trixie-backports main contrib non-free non-free-firmware
EOF

exit
sudo apt update

常用的软件

1
2
sudo apt install wget curl git unzip net-tools
sudo apt install build-essential

中文输入法

1
2
3
sudo im-config -n fcitx5
sudo apt install gnome-shell-extension-appindicator
sudo reboot

配置smb

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo su
apt install samba

cat >> /etc/samba/smb.conf <<EOF
[limour]
path = /home/limour
browseable = yes
writeable = yes
valid users = limour
EOF

smbpasswd -a limour
exit
  • 宿主机挂载 \\192.168.105.128\limour,并添加到安全中心的排除项

透明代理

  • 宿主机代理开启允许局域网访问
  • 下载 dae-linux-x86_64.deb
  • 通过 smb 复制到 /home/limour/base/dae,双击安装
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
sudo su

cat > /etc/dae/config.dae <<EOF
global {
wan_interface: auto
lan_interface: auto
auto_config_kernel_parameter: true
}

node {
socks: 'socks5://192.168.105.1:7890'
}

group {
proxy {
policy: fixed(0)
}
}

routing {
pname(NetworkManager) -> direct
pname(mihomo) -> direct
dip(geoip:private) -> direct
dip(geoip:cn) -> direct
domain(geosite:cn) -> direct
fallback: proxy
}
EOF

chmod 0640 /etc/dae/config.dae
systemctl enable dae --now
systemctl status dae
exit

conda

1
bash <(curl -L https://raw.githubusercontent.com/mamba-org/micromamba-releases/main/install.sh)
  • nano ~/.local/bin/conda 写入以下内容
1
2
#!/usr/bin/env sh
exec "$HOME/.local/bin/micromamba" "$@"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
chmod +x ~/.local/bin/conda

cat >> ~/.bashrc <<EOF
alias conda='micromamba'
EOF

cat > ~/.condarc <<EOF
channels:
- conda-forge
channel_priority: strict
auto_activate_base: false
EOF

cat > ~/.config/ai-env.sh <<EOF
export PATH="$HOME/.local/bin:$PATH"
export MAMBA_EXE="$HOME/.local/bin/micromamba"
export MAMBA_ROOT_PREFIX="$HOME/micromamba"
export PI_FFF_MODE="override"
EOF
  • .bashrc 前添加下面的代码
1
[ -f "$HOME/.config/ai-env.sh" ] && . "$HOME/.config/ai-env.sh"

自动登录

  • 编辑 /etc/gdm3/daemon.conf 取消掉下面两项的注释
1
2
AutomaticLoginEnable = true
AutomaticLogin = limour

附加 端口转发

1
2
3
4
5
6
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=57002 connectaddress=192.168.110.106 connectport=57002
netsh advfirewall firewall add rule name="PortForward-57002" dir=in action=allow protocol=TCP localport=57002

netsh interface portproxy show all

netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=57002

附加 clashtui

1
2
3
bash <(curl -fsSL https://raw.githubusercontent.com/JohanChane/clashtui/refs/heads/main/installs/install) --core mihomo --is-user

ps -eo pid,comm,args | grep -Ei 'clash|mihomo'

【记录】虚拟机安装Debian
https://hexo.limour.top/installing-debian-on-vmware
Author
Limour
Posted on
July 23, 2026
Updated on
August 7, 2026
Licensed under