debian 制作debian chroot
1 2 apt-get install binutils debootstrap debootstrap --foreign --no-check-gpg --arch amd64 buster buster "http://mirrors.aliyun.com/debian/"
下载完成后打包并拷贝到群晖
1 tar -zcvf buster.tar.gz buster
群晖: 解压,初始化安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 mkdir -p /volume1/chrootcd /volume1/chroot && tar zxf buster.tar.gzCHROOT=/volume1/chroot/buster cp /etc/resolv.conf $CHROOT /etc/resolv.confcp /etc/hosts $CHROOT /etc/hostscp /etc/hostname $CHROOT /etc/hostnamemount -o bind /dev $CHROOT /dev mount -o bind /proc $CHROOT /proc mount -o bind /dev/pts $CHROOT /dev/pts mount -o bind /sys $CHROOT /sys chroot $CHROOT /debootstrap/debootstrap --second-stagechroot $CHROOT /bin/bashln -s /bin/true /usr/bin/ischroot
设置软件源
1 2 3 deb http://mirrors.aliyun.com/debian buster main contrib non-free deb http://mirrors.aliyun.com/debian buster-updates main contrib non-free deb http://mirrors.aliyun.com/debian-security buster/updates main
设置地区和时区
1 2 3 apt-get install locales dpkg-reconfigure locales dpkg-reconfigure tzdata
退出chroot 卸载文件系统
1 2 3 4 5 6 umount $CHROOT /dev/pts umount $CHROOT /dev umount $CHROOT /proc umount $CHROOT /sys umount $CHROOT /mnt/volume1 umount $CHROOT /mnt/volume2
在群晖系统里设置debian chroot开机启动
1 2 3 4 5 6 7 8 9 10 11 cat > /usr/local/etc/rc.d/chrootbuster.sh << EOF CHROOT=/volume1/chroot/buster mount -o bind /dev \$CHROOT/dev mount -o bind /proc \$CHROOT/proc mount -o bind /dev/pts \$CHROOT/dev/pts mount -o bind /sys \$CHROOT/sys mount -o bind /volume1 \$CHROOT/mnt/volume1 mount -o bind /volume2 \$CHROOT/mnt/volume2 EOF chmod +x /usr/local/etc/rc.d/chrootbuster.sh/usr/local/etc/rc.d/chrootbuster.sh