= VagrantDebianBullseye64Box =
<<TableOfContents(2)>>
Steps to create vagrant Debian bullseye64 box (Virtualbox) with LVM support.

== Install in VM ==
{{{#!highlight sh
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.7.0-amd64-netinst.iso
# start Virtualbox
# new
# name: debianbullseye64
# linux debian 64 bit next
# memory size 512 next
# create virtual hard disk 
# create 
# vdi next
# dynamic allocation next 
# 64 GB create
# start
# select startup disk
# add
# open choose debian-11.7.0-amd64-netinst.iso
# start
# graphical install
# low memory mode 
# region europe 
# country portugal 
# keymap portuguese 
# hostname debian
# domain name: <continue>
# root password: vagrant 
# full name new user: vagrant 
# user name for account: vagrant 
# configure clock: Lisbon 
# partition disks, guided, setup lvm 
# select scsi3 sda 68.7 GB 
# partition scheme all files 
# write the changes and configure lvm? yes 
# amount of volume group 68.2 GB 
# write the changes to disk? yes 
# scan extra installation disk? no 
# debian archive mirror country: portugal 
# deb.debian.org 
# proxy continue 
# participate package usage survey? no 
# ssh server, standard sys utilities , continue 
# install GRUB loader in your primary drive ? yes 
# /dev/sda 
# installation complete, continue
# login with root:vagrant 
}}}

== Test network in VM and update VM ==
{{{#!highlight sh
ping www.google.com
apt update 
apt upgrade  
}}}

== Virtualbox guest additions ==
{{{#!highlight sh
apt install dkms 
apt install build-essential 
apt install linux-headers-$(uname -r) 
# Menu "Devices" followed by "Install Guest Additions". 
mount /dev/cdrom /media/cdrom
cd /media/cdrom
sh ./VBoxLinuxAdditions.run
reboot 
}}}

== vagrant sudoers ==
login with root:vagrant 

{{{#!highlight sh
/sbin/usermod -aG sudo vagrant 
visudo # edit sudoers
 
vagrant ALL=(ALL) NOPASSWD: ALL
# after saving in visudo
exit 
login vagrant:vagrant 

sudo bash # should not ask for password 
exit 
}}}

== UseDNS in SSH ==
{{{#!highlight sh
sudo bash 
cd /etc/ssh 
vi sshd_config 
# disable line with "UseDNS" no 
service ssh restart 
}}}

== SSH insecure pair ==
{{{#!highlight sh
mkdir ~/.ssh 
cd ~/.ssh 
wget https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub
mv vagrant.pub authorized_keys
chmod 0600 authorized_keys 
chmod 0700 /home/vagrant/.ssh 
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 ==
{{{#!highlight sh
cd /tmp
vagrant package --base debianbullseye64
/tmp/package.box
package.box
 
mkdir /tmp/test
cd /tmp/test
vagrant box add --name my-debbox C:\temp\package.box
vagrant init my-debbox
vagrant up
vagrant ssh # connect to the box
df -h
# /dev/mapper/debian--vg-root   62G  1.4G   58G   3% /
cd /vagrant 
ls 
md5sum package.box
# xxx  package.box
}}}