事前准备
创建jailmaker用的数据集
在你随机池创建jailmaker的文件夹,名字随意,我这里直接命名为jailmaker
安装jailmaker
进入目录
cd /mnt/[池名字]/[刚刚创建的目录名]
我这里例子是 池:
tank
目录名: jailmaker
cd /mnt/tank/jailmaker curl --location --remote-name https://raw.githubusercontent.com/Jip-Hop/jailmaker/main/jlmkr.py chmod +x jlmkr.py
- PS:此时已经可以运行通过指定文件位置来运行,但是如果想在任何地方直接输入jlmkr来运行的话,可以输入下面的命令
echo alias jlmkr=\"sudo '/mnt/[池名字]/[刚刚创建的目录名]/jlmkr.py'\" >> ~/.zshrc source ~/.zshrc
添加开机启动
照抄
替换中间命令的部分
/mnt/[池名字]/[刚刚创建的目录名]/jlmkr.py startup
安装PVE!
- 命令行输入
jlmkr
- 提示你是否创建,输入
Y
按下回车
root@truenas[~]# jlmkr Create a new jail? [Y/n] y USE THIS SCRIPT AT YOUR OWN RISK! IT COMES WITHOUT WARRANTY AND IS NOT SUPPORTED BY IXSYSTEMS.
- 提示你用模板的方式。
A text editor will open so you can provide the config template. 1. Please copy your config 2. Paste it into the text editor 3. Save and close the text editor Press Enter to open the text editor.
输入
Enter
,会进入nano的输入界面,此时你需要复制下面的代码,粘贴到里面后,按下 ctrl+x
,再按 Y
再按 回车
# WARNING: EXPERIMENTAL CONFIG TEMPLATE! startup=0 # Turning off seccomp filtering improves performance at the expense of security # TODO: don't disable seccomp but specify which syscalls should be allowed seccomp=0 # Use macvlan networking to provide an isolated network namespace, # so incus can manage firewall rules # Alternatively use --network-macvlan=eno1 instead of --network-bridge # Ensure to change eno1/br1 to the interface name you want to use # You may want to add additional options here, e.g. bind mounts # TODO: don't use --capability=all but specify only the required capabilities # 注意这里的br0需要提前改成自己网络对应的网桥名字 systemd_nspawn_user_args=--network-bridge=br0 --resolv-conf=bind-host --capability=all --bind=/dev/fuse --bind=/dev/kvm --bind=/dev/vsock --bind=/dev/vhost-vsock # Script to run on the HOST before starting the jail # Load kernel module and config kernel settings required for incus pre_start_hook=#!/usr/bin/bash set -euo pipefail echo 'PRE_START_HOOK' echo 1 > /proc/sys/net/ipv4/ip_forward modprobe br_netfilter echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables modprobe vhost_vsock # Only used while creating the jail distro=debian release=bookworm # Install incus according to: initial_setup=#!/usr/bin/bash set -euo pipefail sleep 60 apt update && apt -y install ca-certificates curl wget echo "deb [arch=amd64] http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg apt update && apt full-upgrade -y apt install proxmox-ve postfix open-iscsi chrony -y # You generally will not need to change the options below systemd_run_default_args=--property=KillMode=mixed --property=Type=notify --property=RestartForceExitStatus=133 --property=SuccessExitStatus=133 --property=Delegate=yes --property=TasksMax=infinity --collect --setenv=SYSTEMD_NSPAWN_LOCK=0 systemd_nspawn_default_args=--keep-unit --quiet --boot --bind-ro=/sys/module --inaccessible=/sys/module/apparmor
- 此时提示你输入jail的名字,输入你想要的,我这里实例为
pve2
(这里的名字和后面修改hosts有关)
Enter jail name: pve2 Do you want to start this jail now (when create is done)? [Y/n] Y
并且在之后提示中按
Y
,回车此时就会进入安装环节,中间应该要漫长等待,其次需要科学,因为模板需要从lxc库拉取镜像,pve源也需要。
- 最后应该是这样子,会提示报错,但是不要慌
输入
jlmkr list
, 可以看到其实已经跑起来了sandbox内调整
- 输入下面就能进入sandbox内部命令
jlmkr shell [应用名]
- 修改hosts
echo "[PVE IP] [应用名].local [应用名]" >> /etc/hosts
- 重启pve,先输入
exit
推出sandbox命令,然后输入
jlmkr restart [应用名]
- 再次输入
jlmkr shell [应用名]
进入sandbox,输入下面
apt install proxmox-ve -y
看到setting up proxmox-ve就是安装成功了
- 桥接创建 vmbr0,ip地址不可以和TrueNAS相同
cat >> /etc/network/interfaces <<EOF auto vmbr0 iface vmbr0 inet static address [IP地址]/24 gateway [网关] bridge-ports host0 bridge-stp off bridge-fd 0 EOF
重启网络
systemctl restart networking
ui有时候会卡,显示你的网络配置是被删除的。执行下面就行了
cp /etc/network/interfaces /etc/network/interfaces.new
此时,pve的安装就完成了,通过ip地址访问ui也一切正常
但是需要此时你并不知道你pve的root密码(
输入下面命令,修改密码即可
passwd root
另外,每次启动pve时,大概需要等到60s左右去让网桥联网,这才Github的页面也有提示。
补充
挂载文件
在TrueNAS输入
jlmkr edit [应用名]
来编辑配置文件在下面一块加入
systemd_nspawn_user_args
参数中 --bind='/truenas/path/to/:/jail/path/to'
/truenas/path/to/
是TrueNAS中路径/jail/path/to
是你想要挂在到sandbox里面的路径挂载GPU
WIP