|
Size: 25
Comment:
|
Size: 7125
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| <<TableOfContents(2)>> |
|
| Line 2: | Line 4: |
Steps to create a Slackware 15 (32-bit) vagrant box with LVM support. == Get ISO and install == {{{#!highlight sh cd ~ https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware-iso/slackware-15.0-iso/slackware-15.0-install-dvd.iso sudo modprobe -r kvm_intel virtualbox & # start virtualbox # new, name: slackware32-15 # linux, other linux, other linux(32-bit) , next # 512 RAM, next # Create a virtual hard disk now, create, VDI, next, dynamically allocated, next, 64GB, create # start VM # choose slackware-15.0-install-dvd.iso # start # boot: <enter> # 1, select keyboard # qwerty/pt.map # 1 <enter> # login as root # create 2 partitions ... fdisk /dev/sda # n p 1 default 2048 +512M # n p 2 default 1050624 +63G # select Linux LVM # t 2 L 8e # p # w # LVM stuff pvcreate /dev/sda2 vgcreate sysvg /dev/sda2 lvcreate -L 62G -n root sysvg pvscan setup # go to target # /dev/sysvg/root select # quick format, ok ext 4 # select other linux partition /dev/sda1 # quick format, ext4 # select mount point for /dev/sda1 mount point /boot # fstab # /dev/sysvg/root for the root directory (/) # /dev/sda1 for /boot # mount point /boot # install from slackware cd or dvd # scanning for cd or dvd: auto # only select package A and AP # full # configure the system, yes # make usb flash boot: skip ok # install lilo, simple # configure lilo: lilo standard # optional lilo: <blank> # select lilo destination MBR # GPM configuration: no # select services: crond messagebus syslog # custom screen fonts no # hw clock set to utc no # timezone configuration: europe/lisbon # nvi classic BSD utf8 # set root password: vagrant # exit setup, go to shell #chroot /mnt # it is probably the LVM volume ! #$( /usr/share/mkinitrd/mkinitrd_command_generator.sh -r ) #KERNEL_VER=$(ls /lib/modules | head -n 1) #echo $KERNEL_VER # get file system #mkinitrd -c -k $KERNEL_VER -f ext4 -r /dev/sysvg/root -m dm-#mod:ata_piix:ahci:libata:sd_mod -L # # /boot/initrd.gz #cat /etc/lilo.conf | grep -v "#" # #nano /etc/lilo.conf #append=" " #boot = /dev/sda #compact # #prompt #timeout = 50 #change-rules # reset #vga = normal #image = /boot/vmlinuz-generic # label = LinuxTest # initrd = /boot/initrd.gz # read-only # #lilo #exit vgscan --mknodes vgchange -ay mount /dev/sysvg/root /mnt mount /dev/sda1 /mnt/boot mount -o bind /dev /mnt/dev mount -o bind /proc /mnt/proc mount -o bind /sys /mnt/sys chroot /mnt /bin/bash # in chroot mount /dev/sr0 /mnt upgradepkg --reinstall /mnt/slackware/a/kernel-modules-5.15.19*.txz ls -l /lib/modules/5.15.19/kernel/fs/ext4/ KERNEL_VER=$(ls /lib/modules | head -n 1) echo $KERNEL_VER mkinitrd -c -k $KERNEL_VER -f ext4 -r /dev/sysvg/root -m dm-mod:ext4 -L #Several modules added after mkinitrd #jdb2 mbcache ext4 dm-bufio dm-snapshot nano /etc/lilo.conf append=" " boot = /dev/sda compact prompt timeout = 50 change-rules reset vga = normal image = /boot/vmlinuz-generic label = LinuxTest initrd = /boot/initrd.gz read-only exit lilo -r /mnt exit reboot }}} == Test installation and install extra packages == {{{#!highlight sh # login root:vagrant df -h # used 1.4G # mount DVD slack iso virtualbox mount /dev/sr0 /mnt/dvd cd /mnt/dvd/slackware/ installpkg k/kernel-source*txz installpkg l/libunis*txz installpkg l/gc-8*txz installpkg l/ncurses-6*txz installpkg d/make*txz installpkg d/gcc-11.2*txz installpkg d/perl-5*txz installpkg d/guile-3*txz installpkg d/binutils*txz installpkg ap/slackpkg-15*.txz installpkg ap/sudo-*.txz installpkg n/network-scripts-15.0-noarch-18.txz installpkg n/net-tools-20181103_0eebece-x86_64-3.txz installpkg n/dhcp-4.4.2_P1-x86_64-1.txz installpkg n/iproute2*.txz installpkg n/libmnl-1*.txz installpkg n/dhcpcd-9*txz installpkg n/iputils-*.txz installpkg n/openssh-*.txz installpkg n/wget-1*.txz installpkg n/ca-certificates-2021*.txz installpkg n/openssl-1*.txz installpkg n/gnupg-1.4.23-x86_64-4.txz vi /etc/rc.d/rc.inet1.conf USE_DHCP[0]="yes" /etc/rc.d/rc.inet1 # run command, it should get an ip ping -c 3 www.google.com # should get replies cd / umount /mnt/dvd # remove in virtualbox the ISO for slack reboot # login root:vagrant ping -c 3 www.sapo.pt }}} == Install guest additions == {{{#!highlight sh umount /mnt/dvd # Menu "Devices" followed by "Insert guest additions cd image ". mount /dev/sr0 /mnt/dvd cd /mnt/dvd ./VBoxLinuxAdditions.run # unmount cd image in Virtualbox reboot # login and reboot again }}} == vagrant sudoers == login with root:vagrant {{{#!highlight sh adduser vagrant # with pwd vagrant groupadd sudo usermod -aG sudo vagrant visudo # insert after root user line vagrant ALL=(ALL) NOPASSWD: ALL 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 #UseDNS no /etc/rc.d/rc.sshd restart }}} == SSH insecure pair in vagrant == {{{#!highlight sh # in /home/vagrant folder as vagrant user mkdir ~/.ssh cd ~/.ssh wget -k 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 /sbin/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 == {{{#!highlight sh cd /tmp vagrant package --base slackware32-15 ls # package.box vagrant box add --name slack32-15-box /tmp/package.box vagrant init slack32-15-box vagrant up vagrant ssh df -h # /dev/sysvg/root 61G 3.7G 54G 7% / md5sum /vagrant/package.box xxxxx /vagrant/package.box }}} == Update Slackware == {{{#!highlight sh vagrant ssh sudo bash cd /var/log/packages grep -i -H "package location" * | grep "\/ap\/" #nano-6.0-i586-1:PACKAGE LOCATION: /var/log/mount/slackware/ap/nano-6.0-i586-1.txz #vim-8.2.4256-i586-1:PACKAGE LOCATION: /var/log/mount/slackware/ap/vim-8.2.4256-i586-1.txz export SLACK_MIRROR="https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware-15.0" cd /tmp wget -k $SLACK_MIRROR/slackware/n/openssl-1.1.1m-i586-1.txz wget -k $SLACK_MIRROR/slackware/n/ca-certificates-20211216-noarch-1.txz /sbin/installpkg ca-certificates-20211216-noarch-1.txz /sbin/installpkg openssl-1.1.1m-i586-1.txz /usr/sbin/update-ca-certificates --fresh echo "$SLACK_MIRROR/" >> /etc/slackpkg/mirrors wget $SLACK_MIRROR/slackware/n/gnupg-1.4.23-i586-4.txz /sbin/installpkg gnupg-1.4.23-i586-4.txz /usr/sbin/slackpkg update gpg /usr/sbin/slackpkg update /usr/sbin/slackpkg upgrade-all exit exit vagrant reload }}} |
Contents
VagrantSlack3215Box
Steps to create a Slackware 15 (32-bit) vagrant box with LVM support.
Get ISO and install
1 cd ~
2 https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware-iso/slackware-15.0-iso/slackware-15.0-install-dvd.iso
3 sudo modprobe -r kvm_intel
4 virtualbox &
5 # start virtualbox
6 # new, name: slackware32-15
7 # linux, other linux, other linux(32-bit) , next
8 # 512 RAM, next
9 # Create a virtual hard disk now, create, VDI, next, dynamically allocated, next, 64GB, create
10 # start VM
11 # choose slackware-15.0-install-dvd.iso
12 # start
13 # boot: <enter>
14 # 1, select keyboard
15 # qwerty/pt.map
16 # 1 <enter>
17 # login as root
18 # create 2 partitions ...
19 fdisk /dev/sda
20 # n p 1 default 2048 +512M
21 # n p 2 default 1050624 +63G
22 # select Linux LVM
23 # t 2 L 8e
24 # p
25 # w
26 # LVM stuff
27 pvcreate /dev/sda2
28 vgcreate sysvg /dev/sda2
29 lvcreate -L 62G -n root sysvg
30 pvscan
31 setup
32 # go to target # /dev/sysvg/root select
33 # quick format, ok ext 4
34 # select other linux partition /dev/sda1
35 # quick format, ext4
36 # select mount point for /dev/sda1 mount point /boot
37 # fstab
38 # /dev/sysvg/root for the root directory (/)
39 # /dev/sda1 for /boot
40 # mount point /boot
41 # install from slackware cd or dvd
42 # scanning for cd or dvd: auto
43 # only select package A and AP
44 # full
45 # configure the system, yes
46 # make usb flash boot: skip ok
47 # install lilo, simple
48 # configure lilo: lilo standard
49 # optional lilo: <blank>
50 # select lilo destination MBR
51 # GPM configuration: no
52 # select services: crond messagebus syslog
53 # custom screen fonts no
54 # hw clock set to utc no
55 # timezone configuration: europe/lisbon
56 # nvi classic BSD utf8
57 # set root password: vagrant
58 # exit setup, go to shell
59
60
61
62 #chroot /mnt # it is probably the LVM volume !
63 #$( /usr/share/mkinitrd/mkinitrd_command_generator.sh -r )
64 #KERNEL_VER=$(ls /lib/modules | head -n 1)
65 #echo $KERNEL_VER
66 # get file system
67 #mkinitrd -c -k $KERNEL_VER -f ext4 -r /dev/sysvg/root -m dm-#mod:ata_piix:ahci:libata:sd_mod -L
68 #
69 # /boot/initrd.gz
70 #cat /etc/lilo.conf | grep -v "#"
71 #
72 #nano /etc/lilo.conf
73 #append=" "
74 #boot = /dev/sda
75 #compact
76 #
77 #prompt
78 #timeout = 50
79 #change-rules
80 # reset
81 #vga = normal
82 #image = /boot/vmlinuz-generic
83 # label = LinuxTest
84 # initrd = /boot/initrd.gz
85 # read-only
86 #
87 #lilo
88 #exit
89
90 vgscan --mknodes
91 vgchange -ay
92 mount /dev/sysvg/root /mnt
93 mount /dev/sda1 /mnt/boot
94 mount -o bind /dev /mnt/dev
95 mount -o bind /proc /mnt/proc
96 mount -o bind /sys /mnt/sys
97
98 chroot /mnt /bin/bash
99 # in chroot
100 mount /dev/sr0 /mnt
101 upgradepkg --reinstall /mnt/slackware/a/kernel-modules-5.15.19*.txz
102 ls -l /lib/modules/5.15.19/kernel/fs/ext4/
103
104 KERNEL_VER=$(ls /lib/modules | head -n 1)
105 echo $KERNEL_VER
106 mkinitrd -c -k $KERNEL_VER -f ext4 -r /dev/sysvg/root -m dm-mod:ext4 -L
107
108 #Several modules added after mkinitrd
109 #jdb2 mbcache ext4 dm-bufio dm-snapshot
110
111 nano /etc/lilo.conf
112 append=" "
113 boot = /dev/sda
114 compact
115
116 prompt
117 timeout = 50
118 change-rules
119 reset
120 vga = normal
121 image = /boot/vmlinuz-generic
122 label = LinuxTest
123 initrd = /boot/initrd.gz
124 read-only
125
126 exit
127
128 lilo -r /mnt
129 exit
130 reboot
Test installation and install extra packages
1 # login root:vagrant
2 df -h # used 1.4G
3 # mount DVD slack iso virtualbox
4 mount /dev/sr0 /mnt/dvd
5 cd /mnt/dvd/slackware/
6 installpkg k/kernel-source*txz
7
8 installpkg l/libunis*txz
9 installpkg l/gc-8*txz
10 installpkg l/ncurses-6*txz
11
12 installpkg d/make*txz
13 installpkg d/gcc-11.2*txz
14 installpkg d/perl-5*txz
15 installpkg d/guile-3*txz
16 installpkg d/binutils*txz
17
18 installpkg ap/slackpkg-15*.txz
19 installpkg ap/sudo-*.txz
20
21 installpkg n/network-scripts-15.0-noarch-18.txz
22 installpkg n/net-tools-20181103_0eebece-x86_64-3.txz
23 installpkg n/dhcp-4.4.2_P1-x86_64-1.txz
24 installpkg n/iproute2*.txz
25 installpkg n/libmnl-1*.txz
26 installpkg n/dhcpcd-9*txz
27 installpkg n/iputils-*.txz
28 installpkg n/openssh-*.txz
29 installpkg n/wget-1*.txz
30 installpkg n/ca-certificates-2021*.txz
31 installpkg n/openssl-1*.txz
32 installpkg n/gnupg-1.4.23-x86_64-4.txz
33
34 vi /etc/rc.d/rc.inet1.conf
35 USE_DHCP[0]="yes"
36
37 /etc/rc.d/rc.inet1 # run command, it should get an ip
38 ping -c 3 www.google.com # should get replies
39
40 cd /
41 umount /mnt/dvd
42 # remove in virtualbox the ISO for slack
43 reboot
44
45 # login root:vagrant
46 ping -c 3 www.sapo.pt
Install guest additions
vagrant sudoers
login with root:vagrant
UseDNS in SSH
SSH insecure pair in vagrant
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
Update Slackware
1 vagrant ssh
2 sudo bash
3
4 cd /var/log/packages
5 grep -i -H "package location" * | grep "\/ap\/"
6 #nano-6.0-i586-1:PACKAGE LOCATION: /var/log/mount/slackware/ap/nano-6.0-i586-1.txz
7 #vim-8.2.4256-i586-1:PACKAGE LOCATION: /var/log/mount/slackware/ap/vim-8.2.4256-i586-1.txz
8
9
10 export SLACK_MIRROR="https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/slackware-15.0"
11 cd /tmp
12 wget -k $SLACK_MIRROR/slackware/n/openssl-1.1.1m-i586-1.txz
13 wget -k $SLACK_MIRROR/slackware/n/ca-certificates-20211216-noarch-1.txz
14 /sbin/installpkg ca-certificates-20211216-noarch-1.txz
15 /sbin/installpkg openssl-1.1.1m-i586-1.txz
16 /usr/sbin/update-ca-certificates --fresh
17
18 echo "$SLACK_MIRROR/" >> /etc/slackpkg/mirrors
19
20 wget $SLACK_MIRROR/slackware/n/gnupg-1.4.23-i586-4.txz
21 /sbin/installpkg gnupg-1.4.23-i586-4.txz
22 /usr/sbin/slackpkg update gpg
23 /usr/sbin/slackpkg update
24 /usr/sbin/slackpkg upgrade-all
25 exit
26 exit
27 vagrant reload
