mayfrost-guides/INITIATION.md
2018-07-11 10:19:33 +00:00

9.4 KiB

Initiation Rite

This guide is for those wanting one of the two most beautiful source based distros, either CRUX or Source Mage GNU/Linux. It was written so it can be used by both, only diverging on particular details.

  • CRUX: A ports based, BSD style init scripts, distro following true KISS principles (Keep It Simple).
  • Source Mage GNU/Linux: Without 3rd party patches, sensible defaults or masked packages, free from obfuscated and pre-configured code, use clean dependencies as they came from upstream developers and can also use flags.

NOTE:

  • This guide attempts to describe UEFI in detail side by side with BIOS. Also describes dualbooting (and triple booting) with the bootloader. If you feel overwhelmed for the amount of information don't be afraid, most of it is OPTIONAL, like password protection of the bootloader and the different filesystems the bootloaders can use.
  • For CRUX you should be using their "iso".
  • For Source Mage GNU/Linux you will be using their "chroot image" but NOT the "iso", you can use any live CD or USB provided it has the commands here mentioned.

TOC

  1. START
  2. PARTITIONING
  3. FILESYSTEM
  4. CREATING (AND MOUNTING) MAIN DIRECTORIES
  5. SETUP
    5.1. CHROOT
    5.2. CHANGE NETWORK INTERFACES
    5.3. EDIT FSTAB
    5.4. SET THE ENVIRONMENT
  6. KERNEL
  7. BOOTLOADER
    7.1. LILO
  8. THE END

START

Boot in UEFI mode if on UEFI, BIOS if on BIOS, and select installation media. Then once you have a terminal:

  • Check which NIC you are using.
    ip addr
  • Make sure your network is up.
dhcpcd <NIC>

In the case you need Wi-Fi please refer to https://github.com/mayfrost/guides/blob/master/NETWORKING.md

  • Temporarily change keyboard to your mapping (available configurations can be found in the directories "/usr/share/kbd/keymaps/" for CRUX and "/usr/share/keymaps/i386/qwerty" for Source Mage GNU/Linux).
    loadkeys <KEYMAP>

PARTITIONING

In these examples we make only two partitions but you can extend this if you know how. The partitions are one root partition, later mounted to "/mnt" with "mkfs.<ROOT_FILESYSTEM>" format, and one boot partition, later mounted to "/mnt/boot" and with "mkfs.<BOOTLOADER_FILESYSTEM>" format unless is UEFI in which case "mkfs.vfat" is the only format available and will be mounted to "/mnt/boot/efi" instead.

  • Use parted.
    parted /dev/sda
  • Inside parted, if on UEFI label the disk "gpt", but if on BIOS label it "msdos".
mklabel <LABEL>
unit mb
mkpart primary 0g 128
mkpart primary 128 -1
toggle 1 boot
p free
quit

FILESYSTEM

Choose your preferred filesystem. Common filesystem types are:

  • JFS: Good read/write performance and crash recovery, reliable for low end computers like laptops and old computers.
  • Reiser4: High performance filesystem for use in performance intensive environments like multimedia workstations and gaming rigs.
  • EXT4: The newest version of the classic Linux filesystem and the one with most support, excels at a high quantity of files and nested directories. Ideal for FTP and fileservers.
  • XFS: Popular for its good handling of large files, its best use is in big, enterprise level databases.
  • VFAT: Most recent version of the filesystem from the time of DOS, most suitable for EFI partitions than anything else.

Look into each one and decide for your use case. Next are the commands used for installation, remember to install the appropiate tools for your filesystem, like "jfsutils" for JFS.

  • Make root filesystem according to your personal preference.
    mkfs.<ROOT_FILESYSTEM> /dev/sda2
  • Make boot filesystem according to supported bootloader or just "mkfs.vfat" if on UEFI.
    mkfs.<BOOTLOADER_FILESYSTEM> /dev/sda1

CREATING (AND MOUNTING) MAIN DIRECTORIES

The two most important are the root directory ("/") and the boot directory ("/boot"), both of which need at the end of this step to be mounted. However, if you are an experienced user you may have created other partitions for other directories like "/home" or "/var", those need to be mounted too by the end of this step.

  • Make a directory for the new root directory.
    mkdir /mnt
  • Mount the new root directory.
    mount /dev/sda2 /mnt
  • If on BIOS make boot directory and mount.
    mkdir /mnt/boot
    mount /dev/sda1 /mnt/boot
  • If on UEFI make boot directory and mount.
mount /dev/sda1 /mnt/boot/efi
  • Create other directories under the new root directory.
    mkdir -p /mnt/{dev,sys,proc,tmp,usr/src,var}

Don't forget to create and mount the extra directories in the case you had created them.

SETUP

  • On CRUX run "setup", and if on UEFI during the setup select grub2-efi (if using GRUB 2), efibootmgr, and elfutils from opt (only select core, and say yes when you're asked if you want to select individual packages). And if you are not using LILO de-select it from core.
    setup
  • On Source Mage GNU/Linux download and uncompress the tarball inside the new root directory.
wget -c "http://download.sourcemage.org/image/official/smgl-stable-<VERSION>-basesystem-x86_64.tar.xz"
tar xJvf smgl-stable-<VERSION>-basesystem-x86_64.tar.xz

CHROOT

  • On CRUX you can issue the next command to mount everything else and chroot automatically.
    setup-chroot  
  • On Source Mage GNU/Linux mount everything else manually.
mount --bind /tmp /mnt/tmp
mount --bind /sys /mnt/sys
mount -t proc none /mnt/proc
mount -t devpts none /mnt/dev/pts
  • On Source Mage GNU/Linux chroot manually specifying Bash in case live media has another shell.
    chroot /mnt /bin/bash
  • Now inside chroot change root password (TEST IF YOUR KEYBOARD HAS ALL THE CORRECT MAPPINGS before you change the password).
    passwd root

CHANGE NETWORK INTERFACES

  • On CRUX modify "/etc/rc.d/net" with the rules you want (IP, gateway, domain, etc).
  • On Source Mage GNU/Linux add preferred interfaces to "/etc/network/interfaces" for example.
allow-hotplug eth0
iface eth0 inet dhcp
  • On the "/etc/resolv.conf.head" file set your preferred DNS provider (this example is from OpenNIC).
    nameserver 185.121.177.177
  • Or copy "/etc/resolv.conf" to "/mnt/etc/resolv.conf" BEFORE chrooting.

EDIT FSTAB

  • Change the "/etc/fstab" file with appropriate filesystems.
/dev/sda2    /    <ROOT_FILESYSTEM>    noatime    0 1
  • On CRUX uncomment the lines referring to "devpts", "tmp", and "shm" as some programs require it (Firefox), also "USB" and or "cdrom" if using those.
  • If on UEFI replace "/boot" with "/boot/efi".

SET THE ENVIRONMENT

  • On CRUX change the font, keyboard, timezone, hostname and services on the "/etc/rc.conf" file.
    ls /usr/share/kbd/keymaps/
  • On Source Mage GNU/Linux change keymaps on the "/etc/sysconfig/keymap" file.
    ls /usr/share/keymaps/i386/qwerty
  • On CRUX generate locales (change interface language).
    localedef -i <LOCALE> -f ISO-<CODE> <LOCALE>
  • On Source Mage GNU/Linux generate locales (change interface language).
    cast -r locale

KERNEL

Next are simple examples of compiling the kernel, for a more in depth view see: https://github.com/mayfrost/guides/blob/master/KERNEL.md

  • On CRUX.
make all modules_install install
  • On Source Mage GNU/Linux (OPTIONAL).
    cast -r linux

BOOTLOADER

Next is a simple example of setting the bootloader, for a more in depth view see: https://github.com/mayfrost/guides/blob/master/BOOTLOADER.md
NOTE: If you are on Source Mage GNU/Linux and need UEFI refer to the bootloader section and use grub2 as there is no elilo package:

LILO

  • On Source Mage GNU/Linux do "cast <BOOTLOADER>" to install the bootloader.
  • If on UEFI use elilo and change names to "/etc/elilo.conf" instead of "/etc/lilo.conf" and "elilo" instead of "lilo" in commands.
    nano /etc/lilo.conf
  • Inserting "password=<PASSWORD>" inside an OS stanza will protect with a password that OS, but inserting "password=<PASSWORD>" just before the stanzas and outside any of them will protect with a password the bootloader itself (notice the space inside stanzas).
image = /boot/vmlinuz
     Label = <DISTRO_NAME>
     root = /dev/sda<PARTITION_NUMBER_OF_ROOT>
other = /dev/sda<PARTITION_NUMBER_OF_FREEDOS>
     table = /dev/sda
     Label = FreeDOS
other = /dev/sda<PARTITION_NUMBER_OF_WINDOWS>
     table = /dev/sda
     Label = Windows7
  • Set boot entry.
lilo
  • Prevent anyone but root of reading the config file (in case you used a password).
    chmod 600 /etc/lilo.conf

THE END

  • Exit the chroot.
    exit
  • Shutdown the machine.
    shutdown -h now

And done. For more information on both distros and what to do next see: https://github.com/mayfrost/guides/blob/master/DISTROS.md
Also check the list of software alternative to bloatware and support minimalism https://github.com/mayfrost/guides/blob/master/ALTERNATIVES.md