mayfrost-guides

mirror of https://github.com/mayfrost/guides
Log | Files | Refs | README | LICENSE

INSTALLATION.md (9857B)


      1 # Installation
      2 
      3 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.
      4 * __CRUX__: A ports based, BSD style init scripts, distro following true KISS principles (Keep It Simple).  
      5 * __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.  
      6 
      7 __NOTE__:
      8 * 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.  
      9 * For __CRUX__ you should be using their "_iso_".  
     10 * 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.  
     11 
     12 
     13 ## TOC
     14 1. [START](#start)  
     15 2. [PARTITIONING](#partitioning)  
     16 3. [FILESYSTEM](#filesystem)  
     17 4. [CREATING (AND MOUNTING) MAIN DIRECTORIES](#creating-and-mounting-main-directories)  
     18 5. [SETUP](#setup)  
     19 5.1. [CHROOT](#chroot)  
     20 5.2. [CHANGE NETWORK INTERFACES](#change-network-interfaces)  
     21 5.3. [EDIT FSTAB](#edit-fstab)  
     22 5.4. [SET THE ENVIRONMENT](#setup-the-environment)  
     23 6. [KERNEL](#kernel)  
     24 7. [BOOTLOADER](#bootloader)  
     25 7.1. [LILO](#lilo)  
     26 8. [THE END](#the-end)  
     27 
     28 ## START
     29 Boot in UEFI mode if on UEFI, BIOS if on BIOS, and select installation media. Then once you have a terminal:
     30 * Check which NIC you are using.  
     31 `ip addr`  
     32 * Make sure your network is up.  
     33 ```  
     34 ip link set <NIC> up
     35 dhcpcd <NIC>  
     36 ```
     37 
     38 In the case you need Wi-Fi please refer to https://github.com/mayfrost/guides/blob/master/NETWORKING.md  
     39 
     40 * 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__).  
     41 `loadkeys <KEYMAP>`  
     42 
     43 ## PARTITIONING
     44 
     45 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.
     46 
     47 * Use parted.  
     48 `parted /dev/sda`
     49 * Inside parted, if on UEFI label the disk "_gpt_", but if on BIOS label it "_msdos_".  
     50 ```  
     51 mklabel <LABEL>
     52 unit mb
     53 mkpart primary 0g 128
     54 mkpart primary 128 -1
     55 toggle 1 boot
     56 p free
     57 quit  
     58 ```
     59 
     60 ## FILESYSTEM
     61 
     62 Choose your preferred filesystem. Common filesystem types are:  
     63 * __JFS__: Good read/write performance and crash recovery, reliable for low end computers like laptops and old computers.  
     64 * __Reiser4__: High performance filesystem for use in performance intensive environments like multimedia workstations and gaming rigs.  
     65 * __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.  
     66 * __XFS__: Popular for its good handling of large files, its best use is in big, enterprise level databases.  
     67 * __VFAT__: Most recent version of the filesystem from the time of DOS, most suitable for EFI partitions than anything else.  
     68 
     69 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__.  
     70 * Make root filesystem according to your personal preference.  
     71 `mkfs.<ROOT_FILESYSTEM> /dev/sda2`  
     72 * Make boot filesystem according to supported bootloader or just "_mkfs.vfat_" if on UEFI.  
     73 `mkfs.<BOOTLOADER_FILESYSTEM> /dev/sda1`  
     74 
     75 ## CREATING (AND MOUNTING) MAIN DIRECTORIES
     76 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.
     77 * Make a directory for the new root directory.  
     78 `mkdir /mnt`  
     79 * Mount the new root directory.  
     80 `mount /dev/sda2 /mnt`  
     81 * If on BIOS make boot directory and mount.  
     82 ```  
     83 mkdir /mnt/boot
     84 mount /dev/sda1 /mnt/boot  
     85 ```
     86 * If on UEFI make boot directory and mount.  
     87 ```  
     88 mkdir -p /mnt/boot/efi
     89 mount /dev/sda1 /mnt/boot/efi  
     90 ```
     91 * Create other directories under the new root directory.  
     92 `mkdir -p /mnt/{dev,sys,proc,tmp,usr/src,var}`  
     93 
     94 Don't forget to create and mount the extra directories in the case you had created them.
     95 
     96 ## SETUP
     97 * On __CRUX__ run "_setup_" and say yes when you're asked to select individual packages. Pre-selecting all of the core repo is advised.  
     98 `setup`  
     99 * On __CRUX__ "_setup_", if on __UEFI__ select "_grub2-efi_" (if using GRUB 2), "_efibootmgr_", and "_elfutils_" from opt, and de-select LILO from core.  
    100 * On __CRUX__ "_setup_", if using __wireless__ select "_wireless-tools_" and "_linux-firmware_".  
    101 * On __Source Mage GNU/Linux__ download and uncompress the tarball inside the new root directory.  
    102 ```  
    103 cd /mnt
    104 wget -c "http://download.sourcemage.org/image/official/smgl-stable-<VERSION>-basesystem-x86_64.tar.xz"
    105 tar xJvf smgl-stable-<VERSION>-basesystem-x86_64.tar.xz  
    106 ```
    107 
    108 ### CHROOT
    109 * On __CRUX__ you can issue the next command to mount everything else and chroot automatically.  
    110 `setup-chroot`  
    111 * On __Source Mage GNU/Linux__ mount everything else manually.  
    112 ```  
    113 mount --bind /dev /mnt/dev
    114 mount --bind /tmp /mnt/tmp
    115 mount --bind /sys /mnt/sys
    116 mount -t proc none /mnt/proc
    117 mount -t devpts none /mnt/dev/pts  
    118 ```
    119 * On __Source Mage GNU/Linux__ chroot manually specifying Bash in case live media has another shell.  
    120 `chroot /mnt /bin/bash`  
    121 * Now inside chroot change root password (TEST IF YOUR KEYBOARD HAS ALL THE CORRECT MAPPINGS before you change the password).  
    122 `passwd root`  
    123 
    124 ### CHANGE NETWORK INTERFACES
    125 * On __CRUX__ modify "_/etc/rc.d/net_" with the rules you want (IP, gateway, domain, etc).  
    126 * On __Source Mage GNU/Linux__ add preferred interfaces to "_/etc/network/interfaces_" for example.  
    127 ```  
    128 auto eth0
    129 allow-hotplug eth0
    130 iface eth0 inet dhcp  
    131 ```
    132 * On the "_/etc/resolv.conf.head_" file set your preferred DNS provider (this example is from [OpenNIC](https://servers.opennicproject.org/)).  
    133 `nameserver 185.121.177.177`  
    134 * Or copy "_/etc/resolv.conf_" to "_/mnt/etc/resolv.conf_" __BEFORE__ chrooting.  
    135 
    136 ### EDIT FSTAB
    137 * Change the "_/etc/fstab_" file with appropriate filesystems.  
    138 ```  
    139 /dev/sda1    /boot    <BOOTLOADER_FILESYSTEM>    defaults    0 2  
    140 /dev/sda2    /    <ROOT_FILESYSTEM>    noatime    0 1  
    141 ```
    142 * 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.  
    143 * If on UEFI replace "_/boot_" with "_/boot/efi_".  
    144 
    145 ### SET THE ENVIRONMENT
    146 * On __CRUX__ change the font, keyboard, timezone, hostname and services on the "_/etc/rc.conf_" file.  
    147 `ls /usr/share/kbd/keymaps/`  
    148 * On __Source Mage GNU/Linux__ change keymaps on the "_/etc/sysconfig/keymap_" file.  
    149 `ls /usr/share/keymaps/i386/qwerty`  
    150 * On __CRUX__ generate locales (change interface language).  
    151 `localedef -i <LOCALE> -f ISO-<CODE> <LOCALE>`  
    152 * On __Source Mage GNU/Linux__ generate locales (change interface language).  
    153 `cast -r locale`  
    154 
    155 ## KERNEL
    156 Next are simple examples of compiling the kernel, for a more in depth view see: https://github.com/mayfrost/guides/blob/master/KERNEL.md  
    157 * On __CRUX__ you must first configure your bootloader (as "_make install_" will call Lilo), then run.  
    158 ```  
    159 cd /usr/src/linux-<VERSION>
    160 make -j $(nproc) all modules_install install  
    161 ```
    162 
    163 * On __Source Mage GNU/Linux__ (__OPTIONAL__).  
    164 `cast -r linux`
    165 
    166 ## BOOTLOADER
    167 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  
    168 __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:
    169 
    170 ### LILO
    171 * On __Source Mage GNU/Linux__ do "_cast \<BOOTLOADER>_" to install the bootloader.  
    172 * If on UEFI use __elilo__ and change names to "_/etc/elilo.conf_" instead of "_/etc/lilo.conf_" and "_elilo_" instead of "_lilo_" in commands.  
    173 `nano /etc/lilo.conf`
    174 * 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).  
    175 ```  
    176 boot = /dev/sda
    177 image = /boot/vmlinuz
    178      Label = <DISTRO_NAME>
    179      root = /dev/sda<PARTITION_NUMBER_OF_ROOT>
    180 other = /dev/sda<PARTITION_NUMBER_OF_FREEDOS>
    181      table = /dev/sda
    182      Label = FreeDOS
    183 other = /dev/sda<PARTITION_NUMBER_OF_WINDOWS>
    184      table = /dev/sda
    185      Label = Windows7  
    186 ```
    187 * Set boot entry.  
    188 ```  
    189 lilo -A /dev/sda 1
    190 lilo  
    191 ```
    192 * Prevent anyone but root of reading the config file (in case you used a password).  
    193 `chmod 600 /etc/lilo.conf`
    194 
    195 ## THE END
    196 * Exit the chroot.  
    197 `exit`
    198 * Shutdown the machine.  
    199 `shutdown -h now`  
    200 
    201 And done. For more information on both distros and what to do next see: https://github.com/mayfrost/guides/blob/master/DISTROS.md  
    202 Also check the list of software alternative to bloatware and support minimalism https://github.com/mayfrost/guides/blob/master/ALTERNATIVES.md