VagrantSlack6415Box

Steps to create a Slackware64 15 vagrant box with LVM support.

Get ISO and install

   1 cd ~
   2 wget https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware-iso/slackware64-15.0-iso/slackware64-15.0-install-dvd.iso
   3 # start virtualbox 
   4 # new, name: slackware64-15
   5 # linux other linux 64-bit , next 
   6 # 512 RAM, next 
   7 # Create a virtual hard disk now, create, VDI, next,  dynamically allocated, next,  64GB, create 
   8 # start VM 
   9 # choose slackware64-15.0-install-dvd.iso
  10 # start 
  11 # boot: <enter>
  12 # 1, select keyboard 
  13 # qwerty/pt.map 
  14 # 1 <enter>
  15 # login as root 
  16 # create 2 partitions ...
  17 fdisk /dev/sda 
  18 # n p 1 default 2048 +512M
  19 # n p 2 default 1050624 +63G
  20 # t 2 L 8e 
  21 # p
  22 # w
  23 # LVM stuff 
  24 pvcreate /dev/sda2
  25 vgcreate sysvg /dev/sda2
  26 lvcreate -L 62G -n root sysvg
  27 pvscan 
  28 setup 
  29 # target # /dev/sysvg/root select 
  30 # quick format, ok ext 4
  31 # select other linux partition /dev/sda1 
  32 # quick format, ext4 
  33 # mount point /boot 
  34 # fstab 
  35 # /dev/sysvg/root for the root directory (/) 
  36 # /dev/sda1 for /boot 
  37 # mount point /boot 
  38 # install from slackware cd or dvd 
  39 # auto 
  40 # package A
  41 # full 
  42 # configure the system, yes 
  43 # make usb flash boot: skip ok 
  44 # install lilo, simple 
  45 # lilo standard 
  46 # optional <blank> 
  47 # select lilo dstination MBR 
  48 # gpm configuration: no 
  49 # services crond messagebus syslog 
  50 # custom screen fonts no 
  51 # hw clock set to utc no 
  52 # europe/lisbon 
  53 # nvi classic BSD utf8 
  54 # set root passw vagrant 
  55 # exit shell 
  56 
  57 chroot /mnt 
  58 $( /usr/share/mkinitrd/mkinitrd_command_generator.sh -r )
  59 # /boot/initrd.gz 
  60 cat /etc/lilo.conf | grep -v "#"
  61 
  62 vi /etc/lilo.conf
  63 # comment root 
  64 # root=
  65 image = /boot/vmlinuz-generic
  66 timeout=50
  67 initrd=/boot/initrd.gz 
  68 label=Linuxtest
  69 
  70 lilo
  71 exit 
  72 reboot 

Test installation and install extra packages

   1 # login root:vagrant 
   2 df -h # used 1.4G 
   3 # error while loading libunistring.so.2 
   4 mount DVD slack iso virtualbox 
   5 mount /dev/sr0 /mnt/dvd 
   6 cd /mnt/dvd/slackware64/
   7 installpkg l/libunis*txz 
   8 installpkg k/kernel-source*txz 
   9 installpkg d/make-4.3*txz 
  10 installpkg d/gcc-11.2*txz 
  11 installpkg d/perl-5*txz 
  12 installpkg d/guile-3*txz 
  13 installpkg l/gc-8*txz 
  14 installpkg d/binutils*txz 
  15 installpkg ap/slackpkg-15*.txz 
  16 installpkg l/ncurses-6*txz
  17 installpkg n/network-scripts-15.0-noarch-18.txz
  18 installpkg n/net-tools-20181103_0eebece-x86_64-3.txz
  19 installpkg n/dhcp-4.4.2_P1-x86_64-1.txz
  20 installpkg n/iproute2*.txz
  21 installpkg n/libmnl-1*.txz
  22 installpkg n/dhcpcd-9*txz
  23 installpkg n/iputils-*.txz
  24 installpkg ap/sudo-*.txz
  25 installpkg n/openssh-*.txz
  26 installpkg n/wget-1*.txz
  27 installpkg n/ca-certificates-2021*.txz
  28 installpkg n/openssl-1*.txz
  29 installpkg n/gnupg-1.4.23-x86_64-4.txz
  30 
  31 vi /etc/rc.d/rc.inet1.conf 
  32 USE_DHCP[0]="yes" 
  33 
  34 /etc/rc.d/rc.inet1 
  35 cd / 
  36 umount /mnt/dvd  
  37 reboot 
  38 
  39 # login root:vagrant 
  40 ping -c3 www.sapo.pt 
  41 ping www.sapo.pt 

Install guest additions

   1 umount /mnt/dvd 
   2 # Menu "Devices" followed by "Insert guest additions cd image ". 
   3 mount /dev/sr0 /mnt/dvd
   4 cd /mnt/dvd 
   5 ./VBoxLinuxAdditions.run 
   6 # unmount cd image in Virtualbox
   7 reboot 
   8 # login and reboot again 
   9 

vagrant sudoers

login with root:vagrant

   1 adduser vagrant # com pwd vagrant 
   2 groupadd sudo 
   3 
   4 usermod -aG sudo vagrant 
   5 visudo
   6 
   7 vagrant ALL=(ALL) NOPASSWD: ALL
   8 
   9 exit 
  10 login vagrant:vagrant 
  11 
  12 sudo bash # should not ask for password 
  13 exit 

UseDNS in SSH

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

SSH insecure pair in vagrant

   1 mkdir ~/.ssh 
   2 cd ~/.ssh 
   3 wget --no-check-certificate 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 shutdown -h now 

Disable audio in Virtualbox

Virtualbox, vm settings, audio, disable

Set first network adapter as a NAT one

Virtualbox, settings vm, adapter 1, NAT

Remove optical devices

Virtualbox, settings, storage, remove mounted optical drives

Create vagrant box

   1 cd /tmp 
   2 vagrant package --base slackware64-15
   3 ls
   4 # package.box
   5 vagrant box add --name slack64-15-box /tmp\package.box
   6 vagrant init slack64-15-box
   7 vagrant up
   8 vagrant ssh
   9 df -h
  10 # /dev/mapper/sysvg-root   61G  3.0G   55G   6% /
  11 md5sum /vagrant/package.box
  12 xxxxx  /vagrant/package.box

Update Slackware 64

   1 vagrant ssh 
   2 sudo bash 
   3 cd /tmp 
   4 wget --no-check-certificate  https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware64-15.0/slackware64/n/openssl-1.1.1m-x86_64-1.txz
   5 wget --no-check-certificate  https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware64-15.0/slackware64/n/ca-certificates-20211216-noarch-1.txz
   6 /sbin/installpkg ca-certificates-20211216-noarch-1.txz
   7 /sbin/installpkg openssl-1.1.1m-x86_64-1.txz
   8 /usr/sbin/update-ca-certificates --fresh
   9 echo "https://mirror.slackbuilds.org/slackware/slackware64-15.0/" >>  /etc/slackpkg/mirrors
  10 wget  https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware64-15.0/slackware64/n/gnupg-1.4.23-x86_64-4.txz
  11 /sbin/installpkg gnupg-1.4.23-x86_64-4.txz
  12 /usr/sbin/slackpkg update gpg 
  13 /usr/sbin/slackpkg update
  14 /usr/sbin/slackpkg upgrade-all

Slackware/VagrantSlack6415Box (last edited 2024-07-25 23:09:38 by vitor)