Difference between revisions of "Debian 12 how to bootstrap an image"

From openQRM
(added create image tarball)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Starting from a fresh Debian 12 installation do the following;
+
[[Category:Debian]] [[Category:Tutorial]]
  
 +
'''Starting from a fresh Debian 12 installation do the following;'''
  
 
apt-get install debootstrap
 
apt-get install debootstrap
  
export MY_CHROOT=/exports/mve8.0_4
+
export MY_CHROOT=/exports/debian12
  
 
mkdir -p $MY_CHROOT/dev/pts $MY_CHROOT/proc $MY_CHROOT/var/run
 
mkdir -p $MY_CHROOT/dev/pts $MY_CHROOT/proc $MY_CHROOT/var/run
 +
 +
cd $MY_CHROOT/..
  
 
mount --bind /dev/ $MY_CHROOT/dev/
 
mount --bind /dev/ $MY_CHROOT/dev/
Line 43: Line 46:
  
 
umount $MY_CHROOT/proc
 
umount $MY_CHROOT/proc
 +
 +
 +
'''Create a tarball for this image;'''
 +
 +
export TEMPLATE_NAME="debian12"
 +
 +
cd $MY_CHROOT
 +
 +
tar --exclude=etc/hostname --exclude=var/openqrm/openqrm.conf --exclude=root/.*history --exclude=root/.joe_state --exclude=root/.ssh/* --exclude=etc/ssh/ssh_host_* --exclude=etc/dropbear/*key --exclude=etc/dropbear-initramfs/*key --exclude=usr/src --exclude=var/lib/apt/lists --exclude=usr/share/pve-edk2-firmware --exclude=usr/share/man --numeric-owner -czf ../$TEMPLATE_NAME.new.tgz .
 +
 +
cd ../
 +
 +
ls -la

Latest revision as of 09:07, 14 November 2023


Starting from a fresh Debian 12 installation do the following;

apt-get install debootstrap

export MY_CHROOT=/exports/debian12

mkdir -p $MY_CHROOT/dev/pts $MY_CHROOT/proc $MY_CHROOT/var/run

cd $MY_CHROOT/..

mount --bind /dev/ $MY_CHROOT/dev/

mount --bind /dev/pts $MY_CHROOT/dev/pts

mount --bind /proc $MY_CHROOT/proc

debootstrap --arch amd64 bookworm $MY_CHROOT/ https://deb.debian.org/debian/

cp /etc/passwd $MY_CHROOT/etc/

cp /etc/shadow $MY_CHROOT/etc/

cp /etc/group $MY_CHROOT/etc/

cp /etc/apt/sources.list $MY_CHROOT/etc/apt/

cp /usr/share/keyrings/*gpg $MY_CHROOT/etc/apt/trusted.gpg.d/

chroot $MY_CHROOT

apt-get update

apt-get install wget net-tools screen locales tzdata collectd telnet whois traceroute nfs-kernel-server jq bash dialog iptables

dpkg-reconfigure locales

dpkg-reconfigure tzdata

exit

umount $MY_CHROOT/dev/pts

umount $MY_CHROOT/dev

umount $MY_CHROOT/proc


Create a tarball for this image;

export TEMPLATE_NAME="debian12"

cd $MY_CHROOT

tar --exclude=etc/hostname --exclude=var/openqrm/openqrm.conf --exclude=root/.*history --exclude=root/.joe_state --exclude=root/.ssh/* --exclude=etc/ssh/ssh_host_* --exclude=etc/dropbear/*key --exclude=etc/dropbear-initramfs/*key --exclude=usr/src --exclude=var/lib/apt/lists --exclude=usr/share/pve-edk2-firmware --exclude=usr/share/man --numeric-owner -czf ../$TEMPLATE_NAME.new.tgz .

cd ../

ls -la