[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:slackware_admin:install_slackware_on_a_online.net_dedibox_baremetal_server [2018/05/02 07:58 (UTC)] – [14. Finalising the installation] atelszewskihowtos:slackware_admin:install_slackware_on_a_online.net_dedibox_baremetal_server [2018/05/03 14:33 (UTC)] (current) – [14. Finalising the installation] atelszewski
Line 130: Line 130:
   $ parted /dev/sda set 1 boot on   $ parted /dev/sda set 1 boot on
  
-Having the ///boot// //[/dev/sda1]// partition in place, you can partition the remaining space in the way that suits your needs. I'm going to use LVM2 to manage the disk, so I create one big partition [///dev/sda2//] that is going to be passed to LVM2. The setup procedure for enabling LVM2 is described in //Appendix A//. The following parted command will create the required partition:+Having the ///boot// //[/dev/sda1]// partition in place, you can partition the remaining space in the way that suits your needs. I'm going to use LVM2 to manage the disk, so I create one big partition [///dev/sda2//] that is going to be passed to LVM2. The setup procedure for enabling LVM2 is described in [[#A. Setting up LVM2 disk management|Appendix A]]. The following parted command will create the required partition:
   $ # Passing "-a optimal" automatically aligns at the last sectors of the disk.   $ # Passing "-a optimal" automatically aligns at the last sectors of the disk.
   $ # The start and end offsets have to be given explicitly:   $ # The start and end offsets have to be given explicitly:
Line 297: Line 297:
  
 ====== 14. Finalising the installation ====== ====== 14. Finalising the installation ======
-We're done with the installation and initial configuration of the Slackware Linux. ;-) You can now prepare the system for reboot and, well, reboot. Before doing that, you might also consider looking at the //Appendix B//, where I explain how to prepare the SSH stuff, so that after rebooting, you can connect to the server with SSH right away. (Otherwise, you will have to log in over serial console to perform the other configuration tasks).+We're done with the installation and initial configuration of the Slackware Linux. ;-) You can now prepare the system for reboot and, well, reboot. Before doing that, you might also consider looking at the [[#B. SSH server configuration (before rebooting)|Appendix B]], where I explain how to prepare the SSH stuff, so that after rebooting, you can connect to the server with SSH right away. (Otherwise, you will have to log in over serial console to perform the other configuration tasks).
  
 First, prepare the hard disk to safely survive the reboot phase. Note that, I only (u)mount ///mnt/boot// and ///mnt// partitions as these are the only hard disk partitions I have. If you have more mounted disk partitions, you should umount them too: First, prepare the hard disk to safely survive the reboot phase. Note that, I only (u)mount ///mnt/boot// and ///mnt// partitions as these are the only hard disk partitions I have. If you have more mounted disk partitions, you should umount them too:
Line 316: Line 316:
  
 ====== A. Setting up LVM2 disk management ====== ====== A. Setting up LVM2 disk management ======
 +<note important>The following instructions will destroy the data on the disk.</note>
 +
 +Before continuing to LVM2 partitioning, if the disk is already under LVM2 control, it has to be first deactivated. I use the following set of commands to do so:
 +  $ lvscan
 +  $ ( cd /dev/mapper && lvchange -an $(pvs --noheadings -o vg_name) )
 +  $ vgscan
 +  $ vgchange -an $(pvs --noheadings -o vg_name)
 +  $ pvscan
 +  $ pvremove -ffy $(pvs --noheadings -o pv_name)
 +  $ partprobe
 +
 +<note tip>To find out more about LVM2, go to https://wiki.archlinux.org/index.php/LVM</note>
 +
 +Remember that the disk has already been partitioned using MBR in the "Partitioning" chapter and ///dev/sda2// already exists. The following set of commands will activate LVM2 on ///dev/sda2// and create the partitions (the LVM2 partitions are going to sit on top of ///dev/sda2// partition):
 +  $ pvcreate /dev/sda2
 +  $ pvdisplay
 +  $ vgcreate vg0 /dev/sda2
 +  $ vgdisplay
 +  $ # Create the partitions (logical volumes):
 +  $ lvcreate -L 12G vg0 -n rootfs
 +  $ lvdisplay
 +  $ vgchange -ay
 +
 +NOTE:
 +  * The good thing about LVM2 is that you can easily add more partitions later on.
 +  * I have chosen partition sizes that suit my current needs, leaving significant free space. LVM2 can easily grow the sizes later on if needed.
 +  * I haven't created the swap partition. The server has more than enough of RAM. But if needed, it can be easily added later on.
 +
 ====== B. SSH server configuration (before rebooting) ====== ====== B. SSH server configuration (before rebooting) ======
 +<note>You have to be in the //chroot// of the freshly installed Slackware system to perform the configuration steps detailed below.</note>
 +
 +If you enabled the //sshd// service during //setup//, it'll be automatically started the next time the Slackware system boots. Unfortunately, you won't be able to connect to it for two reasons: 
 +  - the host keys are not generated yet, so you won't be able to verify host's authenticity and of course you don't want to connect without being able to verify it,
 +  - user's public key authentication is not set up and of course you don't want to be logging in using password  authentication.
 +
 +To solve the first issue, we need to manually perform the task that would normally be done by the Slackware init scripts when the system boots for the first time. Generating the host keys basically boils down to the following command:
 +  $ ssh-keygen -A
 +
 +And then to obtain the host's key fingerprint (I stick to RSA):
 +  $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key
 +
 +Setting up public key authentication is a bit more cumbersome, but still far from being rocket science. :-^ First, you need to upload your public key from your workstation to the server. Run the following command on the workstation:
 +  $ scp -i ./login_key ~/.ssh/id_rsa.pub user@x.y.z.w:~
 +
 +NOTE: The above command uploads //~/.ssh/id_rsa.pub// public key, but for the transfer authentication, it uses the very same key you uploaded earlier using the Web interface.
 +
 +Now, back to the server, create the required //~/.ssh// directory:
 +  $ mkdir ~/.ssh
 +
 +I told you to use the //screen// program at the beginning, right? :-) Now we will make use of it. The public key that you uploaded above has been placed in the //user// home directory of the Ubuntu rescue OS. We need to rename it to the //authorized_keys// file in the //~/.ssh// directory of the fresh Slackware installation:
 +  $ # Detach from screen session, you'll be dropped to Ubuntu rescue OS:
 +  (keyboard) Ctrl+a d
 +  $ # Login as root:
 +  $ sudo su -
 +  $ mv /home/user/id_rsa.pub /root/slackware-chroot/mnt/root/.ssh/authorized_keys
 +  $ # Exit root login:
 +  $ exit
 +  $ Re-attach to screen session:
 +  $ screen -r
 +
 +Ensure correct ownership and permissions, otherwise //sshd// won't let us in:
 +  $ chown root:root ~/.ssh
 +  $ chown root:root ~/.ssh/authorized_keys
 +  $ chmod 0700 ~/.ssh
 +  $ chmod 0600 ~/.ssh/authorized_keys
 +
 +NOTE:
 +  - If you haven't used //screen//, you would just open second SSH connection to perform the above task. Alternatively, you could exit all the //chroots// and then run them again, but who would want to do that? ;-)
 +  - Remember that the correct server's network configuration has to be in place for you to be able to connect over SSH after reboot.
 +
 +At this point, all the pieces should be in place and you should be able to successfully login to your fresh Slackware installation after the server is rebooted.
 +
 +NOTE: I know I allow for root login over SSH. I have to live with that. :-^
  
 +===== Sources =====
 +  * Originally written by [[wiki:user:atelszewski | Andrzej Telszewski]]
 <!-- Please do not modify anything below, except adding new tags.--> <!-- Please do not modify anything below, except adding new tags.-->
 <!-- You must remove the tag-word "template" below before saving your new page --> <!-- You must remove the tag-word "template" below before saving your new page -->
-{{tag>howtos template}}+{{tag>howtos author_atelszewski}}
 howtos:slackware_admin:install_slackware_on_a_online.net_dedibox_baremetal_server ()