Installing Slackware64 15.0: Difference between revisions

From BitFolk
Jump to navigation Jump to search
(tidy up more kdei references.)
m (fix markup)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<h1>This page is a Work In Progress</h1>
<font size="+1"><b>Before you start</b></font>


=== Installing Slackware 15.0 on a Bitfolk VPS ===
The default recommended install for slackware64 15.0 is complete.
 
== Before you start ==
 
The default recommended install for slackware 15.0 is complete.
The space used can obviously be
The space used can obviously be
reduced by not installing things like X, or servers that are not going to
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
be used, but this how-to doesn't assume what you will or won't use. That
is left to <strong>you</strong> in the usual [http://www.slackware.com
is left to <strong>you</strong> in the usual [http://www.slackware.com slackware] way.
slackware] way.


If you have a set of tagfiles, you can make them available via the web for
This install is based on 25GB of VPS storage. Anything less than 25GB of storage is going to be a squeeze because you
ease of access during the installation.
are going to need some space for recompiling the kernel in addition to
all the other packages you want to install. You should have about 5.5GB free space once the installation is complete.


Anything less than 20GB of storage is going to be a squeeze because you
You can use nano to edit/create new files during this setup  process, but as ctrl-o is hooked by the xen console, you'll need to press <code>ctrl-x</code> then type <code>y</code> to save your file instead.
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.


<h2>Part 1. preparing the virtual drives</h2>
<h1>Part 1. configure the vps settings</h1>


Log in to the xen shell via ssh
Log in to the xen shell via ssh either on linux/mac or via [https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.78-installer.msi putty] on windows
<div id="code"><pre>
<div id="code"><pre>
ssh yourserver@yourserver.console.bitfolk.com
ssh yourserver@yourserver.console.bitfolk.com
Line 30: Line 22:
You will need to use the ssh key you supplied when ordering the VPS (or the
You will need to use the ssh key you supplied when ordering the VPS (or the
password if you did not provide a key).
password if you did not provide a key).
before we check the disks, we make sure the vm will be using the recommended settings
Type <div id="code"><pre>arch x86_64</pre></div>  to set the vm to 64bit
Type <div id="code"><pre>virtmode PVH</pre></div>  to set the vm virtual mode to PVH
if you are wiping and installing fresh, then shutdown the existing vm by typing <div id="code"><pre>shutdown</pre></div>


By default bitfolk allocate two virtual disks for your virtual
By default bitfolk allocate two virtual disks for your virtual
machine. xvda (the main amount) and xvdb (an amount equal to the ram
machine. xvda (the main amount) and xvdb (an amount equal to the ram
you have allocated) for swap.
you have allocated) for swap.  
(If you purchased archive space, that will show as xvdc in your vm, but will not appear in the console.)


Type <tt style="backtick">disks</tt> to view and change the arrangement of virtual drives made up out of your purchased disk space.
Type <tt style="backtick">disks</tt> to view and change the arrangement of virtual drives made up out of your purchased disk space.
Line 40: Line 38:
Current disk layout:
Current disk layout:


         1. xvda            20,480MiB
         1. xvda            25,600MiB
         2. xvdb            1,024MiB
         2. xvdb            1,024MiB
          
          
     Total disk capacity            21,504MiB
     Total disk capacity            26,624MiB
     Reserved for backups            2,048MiB
     Reserved for backups            2,048MiB
Available for allocation                0MiB
Available for allocation                0MiB
Line 52: Line 50:
get back to the xen-shell prompt and  continue....
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
For this install we are assuming at least 25GB of space allocated to the first virtual disk /dev/xvda
 
<h1>Part 2. boot to rescue image, get network settings, partitioning and format drives, mount and download the install files</h1>


<h2>Part 2. partitioning drives and obtaining the install files</h2>
<h2>boot to rescue image</h2>
<h3>Partitioning the drive</h3>
<ul><li>type <tt style="backtick">rescue</tt></li>
<ul><li>type <tt style="backtick">rescue</tt></li>
<li>log on as <tt style="backtick">user</tt> with <em>password</em> given </li>
<li>log on as <tt style="backtick">user</tt> with <em>password</em> given </li>
<li>change to root type <code>sudo su -</code> </li>
</ul>
<h2>get network settings</h2>
<ul><li>type <code>ip addr|grep "inet "|tail -n1|awk '{print $2}'|awk -F"/" '{print $1}'</code> to get your public static ip4 address. make a note of it</li>
<li>type <code>ip addr|grep "inet "|tail -n1|awk '{print $2}'|awk -F"/" '{print $2}'</code> to get your public static ip4 netmask CIDR. make a note of it</li>
<li>type <code>ip ro|grep default|awk '{print $3}'</code> to get your ip4 gateway. make a note of it</li>
<li>type <code>cat /etc/resolv.conf|awk '{print $2}'</code> to get the bitfolk nameservers. make a note of it</li>
</ul>


<li>type <tt style="backtick">sudo fdisk -l</tt>  to check the drive of the virtual machine.<br>On mine it is <strong>/dev/xvda</strong></li>
<h2>partition and format drives</h2>
<li>type <tt style="backtick">fdisk <em>/dev/xvda</em></tt></li>
<ul><li>type <code>fdisk -l|grep "Disk /dev"|grep -v "loop"</code>  to check the drives of the virtual machine.<br>Your main ssd drive is <strong>/dev/xvda</strong><br>We will be clearing the drive, partitioning and formatting, so {{Warning|any existing data will be wiped.}}</li>
<li>then <tt style="backtick">n</tt> for a new partition</li>
<li>type <code>fdisk <em>/dev/xvda</em></code></li>
<li>then <tt style="backtick">p</tt> for a primary partition</li>
<li>then <code>o</code> to set a dos partition table</li>
<li>then <tt style="backtick">1</tt> for the partition number</li>
<li>then <code>n</code> for a new partition</li>
<li>accept the default start position, and the default end position.</li>
<li>then <code>p</code> for a primary partition</li>
<li>then <tt style="backtick">a</tt> to toggle the boot status</li>
<li>then press enter to accept the default parition number (1)</li>
<li>then <tt style="backtick">1</tt> to select that partition</li>
<li>then press enter to accept the default start position</li>
<li>Finally press <tt style="backtick">w</tt> to write the changes and quit fdisk.</li>
<li>then press enter to accept the default end position.</li>
<li>type <tt style="backtick">fdisk <em>/dev/xvdb</em></tt></li>
<li>then type <code>w</code> to write the changes to the drive.</li>
<li>then <tt style="backtick">n</tt> for a new partition</li>
<li>Now for the swap drive. type <code>fdisk <em>/dev/xvdb</em></code></li>
<li>then <tt style="backtick">p</tt> for a primary partition</li>
<li>then <code>o</code> for a dos style partition table</li>
<li>then <tt style="backtick">1</tt> for the partition number</li>
<li>then <code>n</code> for a new partition</li>
<li>Accept the default start position and end position, then press <tt style="backtick">t</tt> and then <tt style="backtick">1</tt> and then <tt style="backtick">82</tt>  to set this as a swap partition</li>
<li>then <code>p</code> for a primary partition</li>
<li>Finally press <tt style="backtick">w</tt> to write the changes and quit fdisk.</li>
<li>then press enter to accept the default partition number</li>
<li>then enter to accept the default start position</li>
<li>and enter to accept the default end position<li>
<li>type <code>t</code> to specify the partion type. it will default to the only partion (1)</li>
<li>type <code>swap</code> to set it to swap type</li>
<li>type <code>w</code> to write the changes to the drive</li>
<li>if you have archive storage which is un-initialised, you can set it up now.</li>
<ul><li>type <code>fdisk <em>/dev/xvdc</em></code></li>
<li>then <code>o</code> to set a dos partition table</li>
<li>then <code>n</code> for a new partition</li>
<li>then <code>p</code> for a primary partition</li>
<li>then press enter to accept the default parition number (1)</li>
<li>then press enter to accept the default start position</li>
<li>then press enter to accept the default end position.</li>
<li>then type <code>w</code> to write the changes to the drive.</li></ul>
</ul>
</ul>


Now to format the new root partition as ext4 (or other FS as you wish)
Now to format the new ssd partition as ext4 (or other FS as you wish)<br>
<div id="code"><pre>sudo /usr/sbin/mkfs.ext4 -m 1 /dev/xvda1 -L root</pre></div>
type <code>mkfs -t ext4 /dev/xvda1</code><br>
 
and setup the swap partition<br>
Now to create a mount point
type <code>mkswap /dev/xvdb1</code><br>
<div id="code"><pre>sudo mkdir -p /mnt/slackware</pre></div>
if you have unformatted archive storage you can also type <code>mkfs -t ext4 /dev/xvdc1</code> to format it.
 
and to mount
<div id="code"><pre>sudo mount /dev/xvda1 /mnt/slackware</pre></div>
 
Lets also format and activate the swap partition we just created
<div id="code"><pre>sudo mkswap -L SWAP /dev/xvdb</pre></div>
 
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:
 
<div id="code"><pre>
sudo apt update
sudo apt install lvm2
</pre></div>
 
This will provide the necessary commands to create the phsical volumes, volume
groups and logical volumes.
 
<h3>Setting up the file structure and getting the install files</h3>


Now to create a boot point and a location for the install files
<h2>Mount and install download files</h2>
<div id="code"><pre>
create mount point for main drive and mount it
sudo mkdir -p /mnt/slackware/{boot/grub,slackdisk}
<pre>mkdir -p /mnt/slackware
sudo chown user /mnt/slackware/slackdisk
mount /dev/xvda1 /mnt/slackware
</pre></div>
mkdir -p /mnt/slackware/{boot/grub,slackdisk}</pre>
if you have archive storage, also run
<pre>mkdir -p /mnt/slackware/archive</pre> to create a mount point for it.


Now to download the slack files (this takes around 5 mins)
Now to download the slack files (this takes around 5 mins)
<div id="code"><pre>
<pre>rsync -avz --exclude source/ rsync.mirrorservice.org::ftp.slackware.com/pub/slackware/slackware64-15.0/ /mnt/slackware/slackdisk
rsync -az --exclude source/ rsync.mirrorservice.org::ftp.slackware.com/pub/slackware/slackware64-15.0/ /mnt/slackware/slackdisk
</pre>now to add the slackware installer script.
</pre></div>
<pre>
 
cd /usr/local/sbin
(If you have over 20GB of storage then you can omit the <tt style="backtick">--exclude 'source/'</tt> 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.
rsync -a rsync.mirrorservice.org::ftp.slackware.com/pub/slackware/slackware64-15.0/source/a/pkgtools/scripts/installpkg ./
chmod 0755 installpkg
</pre>


<h2>Installing the packages</h2>
<h1>Part 3. Installing the packages</h1>


When that is done we can do some more prep, and then install.
We'll now install the packages, deleting the package install files as we go, to save spaceIf your <pre>cd /mnt/slackware/slackdisk/slackware64
If you did download the source, use
for i in `ls */*.t?z`; do
<div id="code"><pre>
installpkg --root /mnt/slackware/ /mnt/slackware/slackdisk/slackware64/${i}
cp /mnt/slackware/slackdisk/source/a/pkgtools/scripts/installpkg /usr/local/sbin/
rm -r /mnt/slackware/slackdisk/slackware64/$i
</pre></div>
done</pre>
now we can remove any leftover files apart from the security patches
<pre>cd ..
rm -r `ls |grep -v patches`</pre>
we might as well copy over the DNS settings now before the next step.<br>
<code>cp -a /etc/resolv.conf /mnt/slackware/etc/</code>


Otherwise the following three lines..
now to chroot into the new file system
<div id="code"><pre>
<pre>cd /mnt/slackware
cd /usr/local/sbin
mount -t proc proc proc/
sudo rsync -a rsync.mirrorservice.org::ftp.slackware.com/pub/slackware/slackware64-15.0/source/a/pkgtools/scripts/installpkg ./
mount -t sysfs sys sys/
sudo chmod 0755 installpkg
mount -o bind /dev dev/
</pre></div>
chroot /mnt/slackware</pre>


Now you can download your tagfiles, if you have any and unpack them into
We can now apply all the security updates
/mnt/slackware/slackdisk/ (ignore the benign tar warning)
<pre>cd /slackdisk/patches/packages
upgradepkg *.t?z</pre>
now to remove all the updates except for kernel ones which we haven't applied
<pre>rm *.tx*</pre>
now for the kernel. lets remove the generic one, update the kernel packages, then remove the kernel package install files.
<pre>cd linux*
removepkg kernel-generic
upgradepkg kernel-headers*.t?z
upgradepkg kernel-modules*.t?z
upgradepkg kernel-huge*.t?z
upgradepkg kernel-source*.t?z
cd ..
rm -r lin*</pre>
At this point there will be about 7.9G free on a 25GB drive


<div id="code"><pre>
<h1>Part 4. Compiling the new kernel</h1>
cd /mnt/slackware/slackdisk
sudo apt install wget
wget https://www.example.com/slackware15.tagfiles.tar
tar xvf slackware15.tagfiles.tar -C slackware64</pre>
</div>


<strong>Note:</strong> If you have less than 20GB and did download the source files you will have to do <tt style="backtick">rm -r /mnt/slackware/slackdisk/source</tt> to delete the source files, otherwise you'll run out of space in the install.
<h2>Step A</h2>
We need to rebuild the kernel with pvh and xen support.
<pre>cd /usr/src/linux
cp .config .config.orig
make menuconfig</pre>
change the following settings
<ul><li>General setup</li>
<li><ul><li>Kernel compression mode -> change to <em>gzip</em> as xen does not support lzma</li></ul></li>
<li>Processor type and features</li>
<li><ul><li>Linux guest support</li>
<li><ul><li>Enable paravirtulization code</li>
  <li><ul><li><em>*</em> Xen guest support</li>
  <li><em>*</em> Xen PVH support</li></ul></li>
</ul></li></ul></li>
<li>Networking Support</li>
<li><ul><li>Networking options<li>
<li><ul><li><em>*</em> The IPv6 protocol</li></ul></li>
</ul></li>
<li>File systems</li>
<li><ul><li><em>*</em> Second extended fs support</li>
<li><em>*</em> The Extended 3 (ext3) file system</li>
<li><em>*</em> The Extended 4 (ext4) file system</li>
</ul></li></ul>
select <em>save</em>, then select <em>exit</em>
type
<pre>make all -j2
make modules_install -j2
make install</pre> (ignore lilo errors here)
We will create an tempory environment variable to hold the kernel version
<pre>KERNV=`ls /boot/System.map-hug*|awk -F"-" '{print $NF}'`</pre>
now to copy over our new files
<pre>cp -a .config /boot/config-$KERNV
cd /boot
mv System.map System.map-$KERNV
mv vmlinuz vmlinux-$KERNV</pre>


If your virtual storage is only 10GB then we will need to delete the install packages when they have been installed to free space
<h2>Step B</h2>
<ul><li><strong>Option 1.</strong> limited storage space (&lt;15G)
we'll now sort grub configuration.
<ul style="list-style-type:none"><li>This installs all the packages to the mount point, deleting the install packages as we go to free up space.</li>
<pre>grub-install /dev/xvda</pre> (we probably don't need this, as xen does the booting :-) )
<li><div id="code"><pre>
now to make sure that when we run grub-mkconfig we get a booting system
cd /mnt/slackware/slackdisk/slackware
<pre>sed -i 's/#GRUB_DISABLE_RECOVERY/GRUB_DISABLE_RECOVERY/g' /etc/default/grub
sed -i '/^GRUB_DEFAULT.*/c\GRUB_DEFAULT=0' /etc/default/grub
sed -i 's/#GRUB_TERMINAL/GRUB_TERMINAL/g' /etc/default/grub</pre>
create <em>/etc/grub.d/05_bitfolk</em> containing
<pre>BFKERN=`ls -t /boot/vmlinu*|grep -v huge|grep -v old|head -n1`
OSNAME=`cat /etc/*-version`
MNAME=`echo $BFKERN|awk -F"-" '{print "kernel " $2}'`
BLKID=`blkid|grep /dev/xvda1|awk -F\" '{print $2}'`
#echo entry info to stdout
echo "menuentry '$OSNAME $MNAME' {"
cat << EOF
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
EOF
echo "    search --no-floppy --fs-uuid --set=root $BLKID"
echo "    echo 'Loading $MNAME …'"
echo "    linux $BFKERN root=/dev/xvda1 ro"
echo "}"</pre>
then run <code>chmod 755 /etc/grub.d/05_bitfolk</code>


for i in `ls|grep "/"`; do
<h2>Step C</h2>
installpkg --root /mnt/slackware/ /mnt/slackware/slackdisk/slackware/${i}*.t?z
type <code>grub-mkconfig -o /boot/grub/grub.cfg</code>
rm -r /mnt/slackware/slackdisk/slackware/$i
done</pre></div></li>
<li>(this will take some while. ignore the warning about tar &gt;1.13  )</li>
</ul></li>
<li><strong>Option 2.</strong> (15G or more storage)
<ul style="list-style-type:none"><li>This just installs everything.</li>
<li><div id="code"><pre>
./installpkg --root /mnt/slackware/ /mnt/slackware/slackdisk/slackware/*/*.t?z</pre></div></li>
<li>(this will take some while. Ignore the warning about tar &gt;1.13  )</li>
</ul></li>
</ul>


The install uses about 8.5GB (assuming you choose option 1. )
{{Note|If you need to update the kernel in future, once you have downloaded the four new kernel packages and installed them (as per the end of the previous part), go through Step A and Step C of Part 4. again}}


<h2>Extra configuration</h2>
<h1>Part5. Configure os prior to first boot</h1>


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


<h3>Keymap for console access</h3>
<h2>fstab setup</h2>
We are not going to get far in the boot process without <em>/etc/fstab</em> so lets create that now, containing
<pre>/dev/xvdb1 swap swap swap 0 0
/dev/xvda1 / ext4 defaults 1 1
/dev/xvdc1 /archive ext4 defaults 1 2</pre>
(if you don't have archive storage, omit the last line)


All the keymappings can be found in
<h2>network setup</h2>
<tt>/mnt/slackware/usr/share/kbd/keymaps</tt>
edit <code>/etc/HOSTNAME</code> and put your hostname in, if you have a FQDN for your vps.
and their subdirectories. For example, the uk one is found at
eg. myvps.mydomain.com
<tt>/mnt/slackware/usr/share/kbd/keymaps/i386/qwerty/uk.map.gz</tt>  
if you have done the install and updates, you will have a new rc.inet1.conf file, so as we are setting things up for the fist time, we'll use it. type
For this example I'll use uk.map
<pre>if [ -e /etc/rc.d/rc.inet1.conf.new ]; then rm /etc/rc.d/rc.inet1.conf; mv /etc/rc.d/rc.inet1.conf.new /etc/rc.d/rc.inet1.conf; fi</pre>
now edit <code>/etc/rc.d/rc.inet1.conf</code> and find the line beginning <em>IPADDRS[0]=</em>
and put your ipaddress and CIDR mask which you recorded earlier in.
eg: IPADDRS[0]="001.001.001.001/21"
also find the line beginning <em>GATEWAY=</em> and put in your gateway ip as recorded ealier
eg:  GATEWAY="85.119.80.1"
and save the file.


<div class="code"><pre>sudo -s
<h2>keyboard mapping</h2>
cat > /mnt/slackware/etc/rc.d/rc.keymap
we need to set up the keyboard mapping. You can find a list at <em>/mnt/slackware/usr/share/kbd/keymaps</em>
#!/bin/sh
create <code>/etc/rc.d/rc.keymap</code> containing
<pre>#!/bin/sh
# Load the keyboard map.  More maps are available under /usr/share/kbd/keymaps
# Load the keyboard map.  More maps are available under /usr/share/kbd/keymaps
if [ -x /usr/bin/loadkeys ]; then
if [ -x /usr/bin/loadkeys ]; then
  /usr/bin/loadkeys uk.map
  /usr/bin/loadkeys uk.map
fi
fi</pre>
^D
then type <code>chmod 0755 /etc/rc.d/rc.keymap</code> to make it executable.
exit
sudo chmod 0755 /mnt/slackware/etc/rc.d/rc.keymap</pre></div>
 
 
<h3>Set the timezone</h3>
 
To find the name and location of your timezone, look in <tt>/mnt/slackware/usr/share/zoneinfo/xxx/yyy</tt> where xxx is the region and yyy is the city. For the uk the location is <tt>/mnt/slackware/usr/share/zoneinfo/Europe/London</tt>.
 
To apply it we type
 
<div class="code"><pre>cd /mnt/slackware/etc
sudo ln -s ../usr/share/zoneinfo/Europe/London localtime
sudo rm localtime-copied-from</pre></div>
 
 
<h2>Network settings, console access and sysctl</h2>
 
We can simply use the rescue image's DNS resolver config
<div class="code"><pre>
sudo cp /etc/resolv.conf /mnt/slackware/etc/
</pre></div>
 
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):
 
<div class="code"><pre>ip a | gawk '/scope global/ {print $2}'</pre></div>
 
This will tell you your default gateway
 
<div class="code"><code>route -n | gawk '$4 == "UG" {print $2}'</code></div>
 
<strong>Make a note of these values for later</strong>
 
Now to enter the new system for final admin work
<div class="code"><pre>chroot /mnt/slackware</pre></div>


Here we comment out the tty entries and add the xen hvc entry so we can see what happens from the virtual machine login.
<h2>timezone</h2>
<div class="code"><pre>
this setup uses London,UK as the timezone
sudo perl -pi -E '/^c6/ and say "co:12345:respawn:/sbin/agetty 38400 hvc0 linux"' /mnt/slackware/etc/inittab
<pre>cd /etc
</pre></div>
rm localtime
ln -s /usr/share/zoneinfo/Europe/London localtime</pre>
Adjust the <em>ln</em> line to link to your timezone of choice.


We also need to allow root to log in on that hcv0 xen terminal
<h2>Console access via xen hvc</h2>
<div class="code"><pre>
We need to add the xen hvc console to inittab and securetty, otherwise we will not be able to log in over the console. Type
sudo perl -pi -E '/^console/ and say "hvc0"' /mnt/slackware/etc/securetty
<pre>sed -i '/tty6/aco:12345:respawn:\/sbin\/agetty 38400 hvc0 linux' /etc/inittab
</pre></div>
sed -i '/^console/ahvc0' /etc/securetty</pre>


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


<div class="code"><pre>
<pre>vm.swappiness = 10
vm.swappiness = 10
vm.vfs_cache_pressure = 150
vm.vfs_cache_pressure = 150
vm.min_free_kbytes = 65536
vm.min_free_kbytes = 65536
</pre></div>
</pre>


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


<h2>Building a kernel so xen can boot</h2>
<h2>Denyhosts</h2>
 
As you need to ssh to your server to work on it, ssh is a prime attack target for hackers. denyhosts is a usefull system to stop them.
Now to build a kernel to support xen and to include ext2/3/4 support
We need to install a dependency first.
built in (so we don't need to bother with an initrd unless we require LVM
<pre>cd /root
or similar). There is little point in compiling the distribution kernel
wget https://slackbuilds.org/slackbuilds/15.0/python/ipaddr-py.tar.gz
now as you will almost certainly want to upgrade it very shortly anyway,
tar -xzf ipaddr-py.tar.gz
so download the source for the current (newest) kernel instead.
cd ipaddr-py
wget `cat ipaddr-py.info|grep "DOWNLOAD="|awk -F\" '{print $2}'`
./ipaddr-py.SlackBuild
cd ..
installpkg /tmp/ipaddr-py*.tgz</pre>
now to create and install the denyhosts package.
<pre>wget https://slackbuilds.org/slackbuilds/15.0/network/DenyHosts.tar.gz
tar -xzf DenyHosts.tar.gz
cd DenyHosts
wget `cat DenyHosts.info|grep "DOWNLOAD="|awk -F\" '{print $2}'`
./DenyHosts.SlackBuild
cd ..
installpkg /tmp/DenyHosts*.tgz
chmod +x /etc/rc.d/rc.denyhosts</pre>
We can now tidy up the package build directories
<code>rm -rf /root/ipaddr-py /root/DenyHosts</code>
we now need to add rc.denyhosts to rc.inet2
<pre>if [ `grep denyhosts /etc/rc.d/rc.inet2|wc -l` = 0 ]; then
  cat << EOF | sed -i '/sshd start/r /dev/stdin' /etc/rc.d/rc.inet2
fi


Go to https://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/
# Start denyhosts
and look for the directory like <tt>linux-5.15.38/</tt> (the version may be
if [ -x /etc/rc.d/rc.denyhosts ]; then
different). When you know the version you can then use this to download the
  /etc/rc.d/rc.denyhosts start
packages to your VM (change the 5.15.38 in these commands to whatever the
EOF
latest version is):
fi</pre>
we'll be a bit more lenient than the default deny after 1 failed attempt, otherwise a typo will block you
<code>sed -i 's/DENY_THRESHOLD_ROOT = 1/DENY_THRESHOLD_ROOT = 3/g' /etc/denyhosts.conf</code>


<h2>sshd setup</h2>
As we just updated sshd, we can move over the new config file.
<pre>if [ -e /etc/ssh/sshd_config.new ]; then
  rm /etc/ssh/sshd_config
  mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config
fi</pre>
We have two options.
<ul><li>option 1. allow root to log in with normal password over ssh.<br>This is less secure, but more convenient</li>
<li>option 2. use an ssh key to log in as root over ssh<br>This is more secure, but less convenient</li></ul>


<div class="code"><pre>
<h3>Option 1</h3>
sudo -s
<pre>sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config</pre>
cd /mnt/slackware/slackdisk
now we can log in as root via ssh using a password.  
wget https://mirrors.slackware.com/slackware/slackware64-15.0/patches/packages/linux-5.15.38/kernel-headers-5.15.38-x86-1.txz
Note: it is not a good idea to do this on a public server without having extra protection such as  denyhosts (as just set up), or a firewall limiting access to known ip's, such as your local public static ip, otherwise you will get hacked sooner or later. You need to make sure you have a secure long password if you choose this option.
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
</pre></div>


Now chroot into your new distro to build the kernel natively.
<h3>Option 2</h3>
<div class="code"><pre>
For improved security, you probably want to use keys for ssh-ing into your server as root. If you are connecting from a windows pc, then [https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.78-installer.msi putty] is the standard ssh client to use, and it comes with puttygen for generating keys. {{Note| use v 0.78 or higher, as earlier versions default to a v1 RSA key which is not accepted by default with slackware as it is less secure.}}
mount -o bind /dev /mnt/slackware/dev
<pre>sed -i '/^#PermitRootLogin/s/#PermitRootLogin/PermitRootLogin/' /etc/ssh/sshd_config</pre>
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
</pre></div>


There are six entries to be changed:
<h4>how to set up ssh using keys for putty client for windows</h4>
<ul><li>General setup &rarr; Kernel compression mode (Gzip) Xen can only boot gzipped kernels, not LZMA.</li>
<ul><li>on the  windows pc, run PuTTYgen, and click "Generate", move the mouse over the blank area while it generates the key. when done</li>  
<li>Processor type and features &rarr; Linux guest support &rarr;  Enable paravirtualization code &rarr; Xen guest support and Xen PVH guest support</li>
<li>click "save public key" and save it on your pc with the .pub.key extension, eg. myvps.pub.key</li>
<li>Networking support &rarr; Networking options &rarr; The IPv6 protocol</li>
<li>also click "save private key" and save it on your pc with the extension .ppk eg myvps.ppk</li>
<li>File systems &rarr; Second extended fs support (make sure this is a &lt;*&gt; not &lt;M&gt; )</li>
<li>on the vps still logged in as root on the console type<code>mkdir /root/.ssh</code></li>
<li>File systems &rarr; Ext3 journalling file system support (make sure this is a &lt;*&gt; not &lt;M&gt; )</li>
<li>Copy the public key text from PuTTYgen and paste it in a single line in <em>/root/.ssh/authorized_keys</em>, ending in a newline. (the line begins with the coding type eg. ssh-rsa then a space, then the public key lines (with newlines removed), then a space, and then the comment text)</li>
<li>File systems &rarr; The Extended 4 (ext4) filesystem (make sure this is a &lt;*&gt; not &lt;M&gt; )</li>
<li>change the permissions of the file<br><code>chmod 600 /root/.ssh/authorized_keys</code></li>
</ul>
<li>save a session in putty set up with your vps ip address. in the data set the "auto login username" to root and in the ssh section click on browse, and locate your private key you saved earlier. Then save the session again, so you don't have to put in the settings each time.</li></ul>


Obviously, make any other changes which you might want while you are there,
<h4>how to set up ssh using keys for ssh client for linux</h4>
such as for LVM support, etc. Now build it.
if you are connecting from a linux machine instead, you can
<ul><li>type <code>ssh-keygen</code> as the user you will be connecting from (the user on the client pc). follow the prompts. you can omit the passcode if you want. this will generate two files under <em>~/.ssh/</em> <em>id_rsa</em> and <em>id_rsa.pub</em>
<li>copy the full contents of <em>id_rsa.pub</em> to the the server <em>/root/.ssh/authorized_keys</em> file as a single line (there should only be one public key per single line in this file)</li>
<li>if this file did not previously exist, change the permissions on it <code>chmod 600 /root/.ssh/authorized_keys</code></li>
<li>to connect, use <code>ssh -i ~/.ssh/yourkey user@your.vps.address</code> eg. <em>ssh -i ~/.ssh/id_rsa root@mybitfolk.vps.ipaddress</em></li></ul>


<div class="code"><pre>
<h2>stop screen blanking on terminals</h2>
make all -j2
type <pre>if [ `cat /etc/rc.d/rc.setterm|grep "^/bin/setterm -blank 15"|wc -l` -gt 0 ]; then
</pre></div>
  sed -i "/^\/bin\/setterm -blank 15/s/\/bin/#\/bin/" /etc/rc.d/rc.setterm
  sed -i "/^#\/bin\/setterm -blank 0/s/#//" /etc/rc.d/rc.setterm
fi</pre>


<em>(this will take ages - think an hour or two)</em>
<h2>Set root password and another user</h2>
Now make the modules and install
We need to set the root password for our nice shiny new vps. Type
<div class="code"><pre>
<pre>passwd</pre>
make modules_install -j2
It is also good to create a non-previleged user, just in case.
make install
<br><code>adduser <em>yourpreferedusername</em></code>
</pre></div>


<em>(Ignore any errors about LILO)</em>
you'll now have about 5.5G free space on your main drive.
<div class="code"><pre>
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
</pre></div>


<h2>We are done with pre-boot setup of our VPS.</h2>
type <pre>exit</pre> to exit your chroot, then type <pre>poweroff</pre> to power down the rescue vm. now at the console, type <code>boot</code> and your nice new slackware 15.0 vps, fully updated should start up, ready to play with. You can log in at the console, or ssh in to your vps.


If you have a look at <code>/var/log/messages</code> you will see lots of blocked hackers trying to ssh into your new vps.


Aren't you glad for denyhosts.<font size="+2">&#128512;</font>


You should probably set up iptables and iptables6 to pretect your vps further, but that can be the subject of another howto.


<p style="color: red">More to follow ... </p>
Now you can configure the functionality you actually want the vps for.... enjoy.

Latest revision as of 16:37, 18 July 2024

Before you start

The default recommended install for slackware64 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 slackware way.

This install is based on 25GB of VPS storage. Anything less than 25GB 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 should have about 5.5GB free space once the installation is complete.

You can use nano to edit/create new files during this setup process, but as ctrl-o is hooked by the xen console, you'll need to press ctrl-x then type y to save your file instead.

Part 1. configure the vps settings

Log in to the xen shell via ssh either on linux/mac or via putty on windows

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).

before we check the disks, we make sure the vm will be using the recommended settings

Type

arch x86_64

to set the vm to 64bit Type

virtmode PVH

to set the vm virtual mode to PVH if you are wiping and installing fresh, then shutdown the existing vm by typing

shutdown

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. (If you purchased archive space, that will show as xvdc in your vm, but will not appear in the console.)

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

Current disk layout:

         1. xvda            25,600MiB
         2. xvdb             1,024MiB
         
     Total disk capacity            26,624MiB
    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 25GB of space allocated to the first virtual disk /dev/xvda

Part 2. boot to rescue image, get network settings, partitioning and format drives, mount and download the install files

boot to rescue image

  • type rescue
  • log on as user with password given
  • change to root type sudo su -

get network settings

  • type ip addr|grep "inet "|tail -n1|awk '{print $2}'|awk -F"/" '{print $1}' to get your public static ip4 address. make a note of it
  • type ip addr|grep "inet "|tail -n1|awk '{print $2}'|awk -F"/" '{print $2}' to get your public static ip4 netmask CIDR. make a note of it
  • type ip ro|grep default|awk '{print $3}' to get your ip4 gateway. make a note of it
  • type cat /etc/resolv.conf|awk '{print $2}' to get the bitfolk nameservers. make a note of it

partition and format drives

  • type fdisk -l|grep "Disk /dev"|grep -v "loop" to check the drives of the virtual machine.
    Your main ssd drive is /dev/xvda
    We will be clearing the drive, partitioning and formatting, so
    Warning Warning: any existing data will be wiped.
  • type fdisk /dev/xvda
  • then o to set a dos partition table
  • then n for a new partition
  • then p for a primary partition
  • then press enter to accept the default parition number (1)
  • then press enter to accept the default start position
  • then press enter to accept the default end position.
  • then type w to write the changes to the drive.
  • Now for the swap drive. type fdisk /dev/xvdb
  • then o for a dos style partition table
  • then n for a new partition
  • then p for a primary partition
  • then press enter to accept the default partition number
  • then enter to accept the default start position
  • and enter to accept the default end position
  • type t to specify the partion type. it will default to the only partion (1)
  • type swap to set it to swap type
  • type w to write the changes to the drive
  • if you have archive storage which is un-initialised, you can set it up now.
    • type fdisk /dev/xvdc
    • then o to set a dos partition table
    • then n for a new partition
    • then p for a primary partition
    • then press enter to accept the default parition number (1)
    • then press enter to accept the default start position
    • then press enter to accept the default end position.
    • then type w to write the changes to the drive.

Now to format the new ssd partition as ext4 (or other FS as you wish)
type mkfs -t ext4 /dev/xvda1
and setup the swap partition
type mkswap /dev/xvdb1
if you have unformatted archive storage you can also type mkfs -t ext4 /dev/xvdc1 to format it.

Mount and install download files

create mount point for main drive and mount it

mkdir -p /mnt/slackware
mount /dev/xvda1 /mnt/slackware
mkdir -p /mnt/slackware/{boot/grub,slackdisk}

if you have archive storage, also run

mkdir -p /mnt/slackware/archive

to create a mount point for it.

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

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

now to add the slackware installer script.

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

Part 3. Installing the packages

We'll now install the packages, deleting the package install files as we go, to save spaceIf your

cd /mnt/slackware/slackdisk/slackware64
for i in `ls */*.t?z`; do
installpkg --root /mnt/slackware/ /mnt/slackware/slackdisk/slackware64/${i}
rm -r /mnt/slackware/slackdisk/slackware64/$i
done

now we can remove any leftover files apart from the security patches

cd ..
rm -r `ls |grep -v patches`

we might as well copy over the DNS settings now before the next step.
cp -a /etc/resolv.conf /mnt/slackware/etc/

now to chroot into the new file system

cd /mnt/slackware
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
chroot /mnt/slackware

We can now apply all the security updates

cd /slackdisk/patches/packages
upgradepkg *.t?z

now to remove all the updates except for kernel ones which we haven't applied

rm *.tx*

now for the kernel. lets remove the generic one, update the kernel packages, then remove the kernel package install files.

cd linux*
removepkg kernel-generic
upgradepkg kernel-headers*.t?z
upgradepkg kernel-modules*.t?z
upgradepkg kernel-huge*.t?z
upgradepkg kernel-source*.t?z
cd ..
rm -r lin*

At this point there will be about 7.9G free on a 25GB drive

Part 4. Compiling the new kernel

Step A

We need to rebuild the kernel with pvh and xen support.

cd /usr/src/linux
cp .config .config.orig
make menuconfig

change the following settings

  • General setup
    • Kernel compression mode -> change to gzip as xen does not support lzma
  • Processor type and features
    • Linux guest support
      • Enable paravirtulization code
        • * Xen guest support
        • * Xen PVH support
  • Networking Support
    • Networking options
      • * The IPv6 protocol
  • File systems
    • * Second extended fs support
    • * The Extended 3 (ext3) file system
    • * The Extended 4 (ext4) file system

select save, then select exit type

make all -j2
make modules_install -j2
make install

(ignore lilo errors here)

We will create an tempory environment variable to hold the kernel version

KERNV=`ls /boot/System.map-hug*|awk -F"-" '{print $NF}'`

now to copy over our new files

cp -a .config /boot/config-$KERNV
cd /boot
mv System.map System.map-$KERNV
mv vmlinuz vmlinux-$KERNV

Step B

we'll now sort grub configuration.

grub-install /dev/xvda

(we probably don't need this, as xen does the booting :-) )

now to make sure that when we run grub-mkconfig we get a booting system

sed -i 's/#GRUB_DISABLE_RECOVERY/GRUB_DISABLE_RECOVERY/g' /etc/default/grub
sed -i '/^GRUB_DEFAULT.*/c\GRUB_DEFAULT=0' /etc/default/grub
sed -i 's/#GRUB_TERMINAL/GRUB_TERMINAL/g' /etc/default/grub

create /etc/grub.d/05_bitfolk containing

BFKERN=`ls -t /boot/vmlinu*|grep -v huge|grep -v old|head -n1`
OSNAME=`cat /etc/*-version`
MNAME=`echo $BFKERN|awk -F"-" '{print "kernel " $2}'`
BLKID=`blkid|grep /dev/xvda1|awk -F\" '{print $2}'`
#echo entry info to stdout
echo "menuentry '$OSNAME $MNAME' {"
cat << EOF
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
EOF
echo "    search --no-floppy --fs-uuid --set=root $BLKID"
echo "    echo 'Loading $MNAME …'"
echo "    linux $BFKERN root=/dev/xvda1 ro"
echo "}"

then run chmod 755 /etc/grub.d/05_bitfolk

Step C

type grub-mkconfig -o /boot/grub/grub.cfg

Note Note: If you need to update the kernel in future, once you have downloaded the four new kernel packages and installed them (as per the end of the previous part), go through Step A and Step C of Part 4. again

Part5. Configure os prior to first boot

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

fstab setup

We are not going to get far in the boot process without /etc/fstab so lets create that now, containing

/dev/xvdb1	swap		swap	swap		0	0
/dev/xvda1	/		ext4	defaults	1	1
/dev/xvdc1	/archive	ext4	defaults	1	2

(if you don't have archive storage, omit the last line)

network setup

edit /etc/HOSTNAME and put your hostname in, if you have a FQDN for your vps. eg. myvps.mydomain.com if you have done the install and updates, you will have a new rc.inet1.conf file, so as we are setting things up for the fist time, we'll use it. type

if [ -e /etc/rc.d/rc.inet1.conf.new ]; then rm /etc/rc.d/rc.inet1.conf; mv /etc/rc.d/rc.inet1.conf.new /etc/rc.d/rc.inet1.conf; fi

now edit /etc/rc.d/rc.inet1.conf and find the line beginning IPADDRS[0]= and put your ipaddress and CIDR mask which you recorded earlier in. eg: IPADDRS[0]="001.001.001.001/21" also find the line beginning GATEWAY= and put in your gateway ip as recorded ealier eg: GATEWAY="85.119.80.1" and save the file.

keyboard mapping

we need to set up the keyboard mapping. You can find a list at /mnt/slackware/usr/share/kbd/keymaps create /etc/rc.d/rc.keymap containing

#!/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

then type chmod 0755 /etc/rc.d/rc.keymap to make it executable.

timezone

this setup uses London,UK as the timezone

cd /etc
rm localtime
ln -s /usr/share/zoneinfo/Europe/London localtime

Adjust the ln line to link to your timezone of choice.

Console access via xen hvc

We need to add the xen hvc console to inittab and securetty, otherwise we will not be able to log in over the console. Type

sed -i '/tty6/aco:12345:respawn:\/sbin\/agetty 38400 hvc0 linux' /etc/inittab
sed -i '/^console/ahvc0' /etc/securetty

kernel tuning

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 Note: 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.

Denyhosts

As you need to ssh to your server to work on it, ssh is a prime attack target for hackers. denyhosts is a usefull system to stop them. We need to install a dependency first.

cd /root
wget https://slackbuilds.org/slackbuilds/15.0/python/ipaddr-py.tar.gz
tar -xzf ipaddr-py.tar.gz
cd ipaddr-py
wget `cat ipaddr-py.info|grep "DOWNLOAD="|awk -F\" '{print $2}'`
./ipaddr-py.SlackBuild
cd ..
installpkg /tmp/ipaddr-py*.tgz

now to create and install the denyhosts package.

wget https://slackbuilds.org/slackbuilds/15.0/network/DenyHosts.tar.gz
tar -xzf DenyHosts.tar.gz
cd DenyHosts
wget `cat DenyHosts.info|grep "DOWNLOAD="|awk -F\" '{print $2}'`
./DenyHosts.SlackBuild
cd ..
installpkg /tmp/DenyHosts*.tgz
chmod +x /etc/rc.d/rc.denyhosts

We can now tidy up the package build directories rm -rf /root/ipaddr-py /root/DenyHosts we now need to add rc.denyhosts to rc.inet2

if [ `grep denyhosts /etc/rc.d/rc.inet2|wc -l` = 0 ]; then
  cat << EOF | sed -i '/sshd start/r /dev/stdin' /etc/rc.d/rc.inet2
fi

# Start denyhosts
if [ -x /etc/rc.d/rc.denyhosts ]; then
  /etc/rc.d/rc.denyhosts start
EOF
fi

we'll be a bit more lenient than the default deny after 1 failed attempt, otherwise a typo will block you sed -i 's/DENY_THRESHOLD_ROOT = 1/DENY_THRESHOLD_ROOT = 3/g' /etc/denyhosts.conf

sshd setup

As we just updated sshd, we can move over the new config file.

if [ -e /etc/ssh/sshd_config.new ]; then
  rm /etc/ssh/sshd_config
  mv /etc/ssh/sshd_config.new /etc/ssh/sshd_config
fi

We have two options.

  • option 1. allow root to log in with normal password over ssh.
    This is less secure, but more convenient
  • option 2. use an ssh key to log in as root over ssh
    This is more secure, but less convenient

Option 1

sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config

now we can log in as root via ssh using a password. Note: it is not a good idea to do this on a public server without having extra protection such as denyhosts (as just set up), or a firewall limiting access to known ip's, such as your local public static ip, otherwise you will get hacked sooner or later. You need to make sure you have a secure long password if you choose this option.

Option 2

For improved security, you probably want to use keys for ssh-ing into your server as root. If you are connecting from a windows pc, then putty is the standard ssh client to use, and it comes with puttygen for generating keys.

Note Note: use v 0.78 or higher, as earlier versions default to a v1 RSA key which is not accepted by default with slackware as it is less secure.
sed -i '/^#PermitRootLogin/s/#PermitRootLogin/PermitRootLogin/' /etc/ssh/sshd_config

how to set up ssh using keys for putty client for windows

  • on the windows pc, run PuTTYgen, and click "Generate", move the mouse over the blank area while it generates the key. when done
  • click "save public key" and save it on your pc with the .pub.key extension, eg. myvps.pub.key
  • also click "save private key" and save it on your pc with the extension .ppk eg myvps.ppk
  • on the vps still logged in as root on the console typemkdir /root/.ssh
  • Copy the public key text from PuTTYgen and paste it in a single line in /root/.ssh/authorized_keys, ending in a newline. (the line begins with the coding type eg. ssh-rsa then a space, then the public key lines (with newlines removed), then a space, and then the comment text)
  • change the permissions of the file
    chmod 600 /root/.ssh/authorized_keys
  • save a session in putty set up with your vps ip address. in the data set the "auto login username" to root and in the ssh section click on browse, and locate your private key you saved earlier. Then save the session again, so you don't have to put in the settings each time.

how to set up ssh using keys for ssh client for linux

if you are connecting from a linux machine instead, you can

  • type ssh-keygen as the user you will be connecting from (the user on the client pc). follow the prompts. you can omit the passcode if you want. this will generate two files under ~/.ssh/ id_rsa and id_rsa.pub
  • copy the full contents of id_rsa.pub to the the server /root/.ssh/authorized_keys file as a single line (there should only be one public key per single line in this file)
  • if this file did not previously exist, change the permissions on it chmod 600 /root/.ssh/authorized_keys
  • to connect, use ssh -i ~/.ssh/yourkey user@your.vps.address eg. ssh -i ~/.ssh/id_rsa root@mybitfolk.vps.ipaddress

stop screen blanking on terminals

type

if [ `cat /etc/rc.d/rc.setterm|grep "^/bin/setterm -blank 15"|wc -l` -gt 0 ]; then
  sed -i "/^\/bin\/setterm -blank 15/s/\/bin/#\/bin/" /etc/rc.d/rc.setterm
  sed -i "/^#\/bin\/setterm -blank 0/s/#//" /etc/rc.d/rc.setterm
fi

Set root password and another user

We need to set the root password for our nice shiny new vps. Type

passwd

It is also good to create a non-previleged user, just in case.
adduser yourpreferedusername

you'll now have about 5.5G free space on your main drive.

We are done with pre-boot setup of our VPS.

type

exit

to exit your chroot, then type

poweroff

to power down the rescue vm. now at the console, type boot and your nice new slackware 15.0 vps, fully updated should start up, ready to play with. You can log in at the console, or ssh in to your vps.

If you have a look at /var/log/messages you will see lots of blocked hackers trying to ssh into your new vps. 

Aren't you glad for denyhosts.😀

You should probably set up iptables and iptables6 to pretect your vps further, but that can be the subject of another howto.

Now you can configure the functionality you actually want the vps for.... enjoy.