Installing Slackware64 15.0: Difference between revisions

From BitFolk
Jump to navigation Jump to search
(tidy up more kdei references.)
mNo edit summary
Line 194: Line 194:


<div class="code"><pre>cd /mnt/slackware/etc
<div class="code"><pre>cd /mnt/slackware/etc
sudo rm localtime
sudo ln -s ../usr/share/zoneinfo/Europe/London localtime
sudo ln -s ../usr/share/zoneinfo/Europe/London localtime
sudo rm localtime-copied-from</pre></div>
sudo rm localtime-copied-from</pre></div>

Revision as of 14:04, 16 May 2023

This page is a Work In Progress

Installing Slackware 15.0 on a Bitfolk VPS

Before you start

The default recommended install for slackware 15.0 is complete. The space used can obviously be reduced by not installing things like X, or servers that are not going to be used, but this how-to doesn't assume what you will or won't use. That is left to you in the usual [http://www.slackware.com slackware] way.

If you have a set of tagfiles, you can make them available via the web for ease of access during the installation.

Anything less than 20GB of storage is going to be a squeeze because you are going to need some space for recompiling the kernel in addition to all the other packages you want to install. You might just about be able to get away with 10GB but that will require a lot of maintenance to keep it under control.

Part 1. preparing the virtual drives

Log in to the xen shell via ssh

ssh yourserver@yourserver.console.bitfolk.com

You will need to use the ssh key you supplied when ordering the VPS (or the password if you did not provide a key).

By default bitfolk allocate two virtual disks for your virtual machine. xvda (the main amount) and xvdb (an amount equal to the ram you have allocated) for swap.

Type disks to view and change the arrangement of virtual drives made up out of your purchased disk space.

Current disk layout:

         1. xvda            20,480MiB
         2. xvdb             1,024MiB
         
     Total disk capacity            21,504MiB
    Reserved for backups             2,048MiB
Available for allocation                 0MiB

Unless you have specific requirements to alter this, it should be fine as is. When you are happy with the virtual disk allocation, you can get back to the xen-shell prompt and continue....

For this install we are assuming at least 20GB of space allocated to the first virtual disk /dev/xvda

Part 2. partitioning drives and obtaining the install files

Partitioning the drive

  • type rescue
  • log on as user with password given
  • type sudo fdisk -l to check the drive of the virtual machine.
    On mine it is /dev/xvda
  • type fdisk /dev/xvda
  • then n for a new partition
  • then p for a primary partition
  • then 1 for the partition number
  • accept the default start position, and the default end position.
  • then a to toggle the boot status
  • then 1 to select that partition
  • Finally press w to write the changes and quit fdisk.
  • type fdisk /dev/xvdb
  • then n for a new partition
  • then p for a primary partition
  • then 1 for the partition number
  • Accept the default start position and end position, then press t and then 1 and then 82 to set this as a swap partition
  • Finally press w to write the changes and quit fdisk.

Now to format the new root partition as ext4 (or other FS as you wish)

sudo /usr/sbin/mkfs.ext4 -m 1 /dev/xvda1 -L root

Now to create a mount point

sudo mkdir -p /mnt/slackware

and to mount

sudo mount /dev/xvda1 /mnt/slackware

Lets also format and activate the swap partition we just created

sudo mkswap -L SWAP /dev/xvdb

Note that if you want to use any LVM partitions during the installation you will need to install the lvm2 system in the rescue environment:

sudo apt update
sudo apt install lvm2

This will provide the necessary commands to create the phsical volumes, volume groups and logical volumes.

Setting up the file structure and getting the install files

Now to create a boot point and a location for the install files

sudo mkdir -p /mnt/slackware/{boot/grub,slackdisk}
sudo chown user /mnt/slackware/slackdisk

Now to download the slack files (this takes around 5 mins)

rsync -az --exclude source/ rsync.mirrorservice.org::ftp.slackware.com/pub/slackware/slackware64-15.0/ /mnt/slackware/slackdisk

(If you have over 20GB of storage then you can omit the --exclude 'source/' to include the source code as well. This will increase the space used from 2.5G to 6.1G at this point of the installation.

Installing the packages

When that is done we can do some more prep, and then install. If you did download the source, use

cp /mnt/slackware/slackdisk/source/a/pkgtools/scripts/installpkg /usr/local/sbin/

Otherwise the following three lines..

cd /usr/local/sbin
sudo rsync -a rsync.mirrorservice.org::ftp.slackware.com/pub/slackware/slackware64-15.0/source/a/pkgtools/scripts/installpkg ./
sudo chmod 0755 installpkg

Now you can download your tagfiles, if you have any and unpack them into /mnt/slackware/slackdisk/ (ignore the benign tar warning)

cd /mnt/slackware/slackdisk
sudo apt install wget
wget https://www.example.com/slackware15.tagfiles.tar
tar xvf slackware15.tagfiles.tar -C slackware64

Note: If you have less than 20GB and did download the source files you will have to do rm -r /mnt/slackware/slackdisk/source to delete the source files, otherwise you'll run out of space in the install.

If your virtual storage is only 10GB then we will need to delete the install packages when they have been installed to free space

  • Option 1. limited storage space (<15G)
    • This installs all the packages to the mount point, deleting the install packages as we go to free up space.
    • cd /mnt/slackware/slackdisk/slackware
      
      for i in `ls|grep "/"`; do
      installpkg --root /mnt/slackware/ /mnt/slackware/slackdisk/slackware/${i}*.t?z
      rm -r /mnt/slackware/slackdisk/slackware/$i
      done
    • (this will take some while. ignore the warning about tar >1.13 )
  • Option 2. (15G or more storage)
    • This just installs everything.
    • ./installpkg --root /mnt/slackware/ /mnt/slackware/slackdisk/slackware/*/*.t?z
    • (this will take some while. Ignore the warning about tar >1.13 )

The install uses about 8.5GB (assuming you choose option 1. )

Extra configuration

Because we are not using the slackware main setup installer, we will have to manually do a little bit of extra configuration.

Keymap for console access

All the keymappings can be found in /mnt/slackware/usr/share/kbd/keymaps and their subdirectories. For example, the uk one is found at /mnt/slackware/usr/share/kbd/keymaps/i386/qwerty/uk.map.gz For this example I'll use uk.map

sudo -s
cat > /mnt/slackware/etc/rc.d/rc.keymap
#!/bin/sh
# Load the keyboard map.  More maps are available under /usr/share/kbd/keymaps
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys uk.map
fi
^D
exit
sudo chmod 0755 /mnt/slackware/etc/rc.d/rc.keymap


Set the timezone

To find the name and location of your timezone, look in /mnt/slackware/usr/share/zoneinfo/xxx/yyy where xxx is the region and yyy is the city. For the uk the location is /mnt/slackware/usr/share/zoneinfo/Europe/London.

To apply it we type

cd /mnt/slackware/etc
sudo rm localtime
sudo ln -s ../usr/share/zoneinfo/Europe/London localtime
sudo rm localtime-copied-from


Network settings, console access and sysctl

We can simply use the rescue image's DNS resolver config

sudo cp /etc/resolv.conf /mnt/slackware/etc/

Let's check the network settings for later. This will tell you your assigned ip public addresses and netmasks (just in case you forgot them):

ip a | gawk '/scope global/ {print $2}'

This will tell you your default gateway

route -n | gawk '$4 == "UG" {print $2}'

Make a note of these values for later

Now to enter the new system for final admin work

chroot /mnt/slackware

Here we comment out the tty entries and add the xen hvc entry so we can see what happens from the virtual machine login.

sudo perl -pi -E '/^c6/ and say "co:12345:respawn:/sbin/agetty 38400 hvc0 linux"' /mnt/slackware/etc/inittab

We also need to allow root to log in on that hcv0 xen terminal

sudo perl -pi -E '/^console/ and say "hvc0"' /mnt/slackware/etc/securetty

We can tune some kernel settings to our preference with sysctl. Create a file at /mnt/slackware/etc/sysctl.d/vm.conf with these contents:

vm.swappiness = 10
vm.vfs_cache_pressure = 150
vm.min_free_kbytes = 65536

Note that the MariaDB documentation at https://mariadb.com/kb/en/configuring-swappiness/ suggests a swappiness of 1 so if your VM is primarily a database server, consider using this value instead.

Building a kernel so xen can boot

Now to build a kernel to support xen and to include ext2/3/4 support built in (so we don't need to bother with an initrd unless we require LVM or similar). There is little point in compiling the distribution kernel now as you will almost certainly want to upgrade it very shortly anyway, so download the source for the current (newest) kernel instead.

Go to https://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/ and look for the directory like linux-5.15.38/ (the version may be different). When you know the version you can then use this to download the packages to your VM (change the 5.15.38 in these commands to whatever the latest version is):


sudo -s
cd /mnt/slackware/slackdisk
wget https://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/linux-5.15.38/kernel-headers-5.15.38-x86-1.txz
wget https://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/linux-5.15.38/kernel-source-5.15.38-noarch-1.txz
installpkg --tagfile /dev/null --root /mnt/slackware/ ./kernel-headers-5.15.38-x86-1.txz ./kernel-source-5.15.38-noarch-1.txz
removepkg kernel-headers-5.15.19-x86-2

Now chroot into your new distro to build the kernel natively.

mount -o bind /dev /mnt/slackware/dev
mount -o bind /proc /mnt/slackware/proc
mount -o bind /sys /mnt/slackware/sys
chroot /mnt/slackware
cd /usr/src/linux
cp -p .config{,.orig}
make menuconfig

There are six entries to be changed:

  • General setup → Kernel compression mode (Gzip) Xen can only boot gzipped kernels, not LZMA.
  • Processor type and features → Linux guest support → Enable paravirtualization code → Xen guest support and Xen PVH guest support
  • Networking support → Networking options → The IPv6 protocol
  • File systems → Second extended fs support (make sure this is a <*> not <M> )
  • File systems → Ext3 journalling file system support (make sure this is a <*> not <M> )
  • File systems → The Extended 4 (ext4) filesystem (make sure this is a <*> not <M> )

Obviously, make any other changes which you might want while you are there, such as for LVM support, etc. Now build it.

make all -j2

(this will take ages - think an hour or two) Now make the modules and install

make modules_install -j2
make install

(Ignore any errors about LILO)

cp -a .config /boot/config-5.15.38
cd /boot
mv System.map{,-5.15.38}
mv vmlinuz{,-5.15.38}
grub-install /dev/xvda
grub-mkconfig -o /boot/grub/grub.cfg



More to follow ...