VagrantDebianBullseye64Box

Steps to create vagrant Debian bullseye64 box (Virtualbox) with LVM support.

Install in VM

   1 wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.7.0-amd64-netinst.iso
   2 # start Virtualbox
   3 # new
   4 # name: debianbullseye64
   5 # linux debian 64 bit next
   6 # memory size 512 next
   7 # create virtual hard disk 
   8 # create 
   9 # vdi next
  10 # dynamic allocation next 
  11 # 64 GB create
  12 # start
  13 # select startup disk
  14 # add
  15 # open choose debian-11.7.0-amd64-netinst.iso
  16 # start
  17 # graphical install
  18 # low memory mode 
  19 # region europe 
  20 # country portugal 
  21 # keymap portuguese 
  22 # hostname debian
  23 # domain name: <continue>
  24 # root password: vagrant 
  25 # full name new user: vagrant 
  26 # user name for account: vagrant 
  27 # configure clock: Lisbon 
  28 # partition disks, guided, setup lvm 
  29 # select scsi3 sda 68.7 GB 
  30 # partition scheme all files 
  31 # write the changes and configure lvm? yes 
  32 # amount of volume group 68.2 GB 
  33 # write the changes to disk? yes 
  34 # scan extra installation disk? no 
  35 # debian archive mirror country: portugal 
  36 # deb.debian.org 
  37 # proxy continue 
  38 # participate package usage survey? no 
  39 # ssh server, standard sys utilities , continue 
  40 # install GRUB loader in your primary drive ? yes 
  41 # /dev/sda 
  42 # installation complete, continue
  43 # login with root:vagrant 
  44 

Test network in VM and update VM

   1 ping www.google.com
   2 apt update 
   3 apt upgrade  

Virtualbox guest additions

   1 apt install dkms 
   2 apt install build-essential 
   3 apt install linux-headers-$(uname -r) 
   4 # Menu "Devices" followed by "Install Guest Additions". 
   5 mount /dev/cdrom /media/cdrom
   6 cd /media/cdrom
   7 sh ./VBoxLinuxAdditions.run
   8 reboot 

vagrant sudoers

login with root:vagrant

   1 /sbin/usermod -aG sudo vagrant 
   2 visudo # edit sudoers
   3  
   4 vagrant ALL=(ALL) NOPASSWD: ALL
   5 # after saving in visudo
   6 exit 
   7 login vagrant:vagrant 
   8 
   9 sudo bash # should not ask for password 
  10 exit 

UseDNS in SSH

   1 sudo bash 
   2 cd /etc/ssh 
   3 vi sshd_config 
   4 # disable line with "UseDNS" no 
   5 service ssh restart 

SSH insecure pair

   1 mkdir ~/.ssh 
   2 cd ~/.ssh 
   3 wget https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub
   4 mv vagrant.pub authorized_keys
   5 chmod 0600 authorized_keys 
   6 chmod 0700 /home/vagrant/.ssh 
   7 sudo shutdown -h now 

Virtualbox disable audio

setting vm , audio, disable

Virtualbox first network adapter a NAT one

settings vm, network 1, NAT

Create vagrant box

   1 cd /tmp
   2 vagrant package --base debianbullseye64
   3 /tmp/package.box
   4 package.box
   5  
   6 mkdir /tmp/test
   7 cd /tmp/test
   8 vagrant box add --name my-debbox C:\temp\package.box
   9 vagrant init my-debbox
  10 vagrant up
  11 vagrant ssh # connect to the box
  12 df -h
  13 # /dev/mapper/debian--vg-root   62G  1.4G   58G   3% /
  14 cd /vagrant 
  15 ls 
  16 md5sum package.box
  17 # xxx  package.box
  18 

Debian/VagrantDebianBullseye64Box (last edited 2024-07-25 23:07:35 by vitor)