mayfrost-guides/Initiation.md

213 lines
9.2 KiB
Markdown
Raw Normal View History

2018-02-26 01:35:51 +00:00
# Initiation Rite
This guide is for those who want to install either CRUX or Source Mage GNU/Linux. It was written so it can be used by both, only diverging on the particular details.
* __CRUX__: A ports based, BSD style init scripts, distro following true KISS principles (Keep It Simple, Stupid).
* __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.
2018-02-26 01:37:22 +00:00
## START
2018-02-26 01:35:51 +00:00
Boot in UEFI mode if on UEFI, BIOS if on BIOS, and select installation media.
2018-02-26 02:05:19 +00:00
* Make sure your network is up (OPTIONAL)
`dhcpcd <NIC>`
2018-02-26 02:06:46 +00:00
* Temporarily change keyboard (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>`
2018-02-26 01:35:51 +00:00
## PARTITIONING
2018-02-26 01:35:51 +00:00
Supported filesystems by bootloaders are (if on UEFI ignore this as it only supports FAT):
* LILO: indifferent (anything?)
* SYSLINUX: ext2, ext3, ext4, btrfs, ufs 1/2, FAT16, FAT32, iso9660, udf, NTFS
* GRUB Legacy: FAT16, FAT32, minix, ext2, ext3, ext4, ReiserFS, JFS, XFS, VSTa fs, Btrfs
* GRUB 2: ext2, ext3, ext4, btrfs, zfs, ufs, minix, iso9660, udf, jfs, hfs, hfs+, afs, affs, sfs, xfs, reiserfs, tar, cpio, NTFS, FAT16, FAT32
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/drive format with mkfs.<ROOT_FILESYSTEM>, and one boot partition, later mounted to /mnt/drive/boot and format with mkfs.<BOOTLOADER_FILESYSTEM> unless is UEFI in which case mkfs.vfat is the only format available and will be mounted to /mnt/drive/boot/efi.
2018-02-26 01:54:29 +00:00
* Use parted
2018-02-26 01:45:06 +00:00
`parted /dev/sda`
2018-02-26 01:54:29 +00:00
* Inside parted, if on UEFI label the disk "gpt", but if on BIOS label it "msdos"
2018-02-26 01:45:06 +00:00
`mklabel <LABEL>
2018-02-26 01:35:51 +00:00
unit mb
mkpart primary 0g 128
mkpart primary 128 -1
toggle 1 boot
p free
2018-02-26 01:45:06 +00:00
quit`
2018-02-26 01:35:51 +00:00
2018-02-26 01:54:29 +00:00
* Make root filesystem according to your personal preference
2018-02-26 01:45:06 +00:00
`mkfs.<ROOT_FILESYSTEM> /dev/sda2
2018-02-26 01:35:51 +00:00
mkdir /mnt/drive
2018-02-26 01:45:06 +00:00
mount /dev/sda2 /mnt/drive`
2018-02-26 02:05:19 +00:00
* Make boot filesystem according to supported bootloader or just "mkfs.vfat" if on UEFI
`mkfs.<BOOTLOADER_FILESYSTEM> /dev/sda1`
2018-02-26 01:54:29 +00:00
* If on BIOS make directory and mount
2018-02-26 01:45:06 +00:00
`mkdir /mnt/drive/boot
mount /dev/sda1 /mnt/drive/boot`
2018-02-26 01:54:29 +00:00
* If on UEFI make directory and mount
2018-02-26 01:45:06 +00:00
`mkdir -p /mnt/drive/boot/efi
2018-02-26 01:35:51 +00:00
mount /dev/sda1 /mnt/drive/boot/efi
cd /mnt/drive
mount --bind /dev /mnt/drive/dev
mount --bind /sys /mnt/drive/sys
mount -t proc none /mnt/drive/proc
2018-02-26 01:45:06 +00:00
mount -t devpts none /mnt/drive/dev/pts`
2018-02-26 01:35:51 +00:00
## SETUP
2018-02-26 02:05:19 +00:00
* On CRUX run `setup`, and if on UEFI select on setup 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.
2018-02-26 01:54:29 +00:00
* On Source Mage GNU/Linux get the tarball
2018-02-26 01:45:06 +00:00
`cd /mnt/drive
2018-02-26 01:35:51 +00:00
wget -c "http://download.sourcemage.org/image/official/smgl-stable-<version>-basesystem-x86_64.<compression>"
2018-02-26 01:45:06 +00:00
tar xvf smgl-stable-<version>-basesystem-x86_64.<compression>`
2018-02-26 01:35:51 +00:00
2018-02-26 02:05:19 +00:00
### Chroot
2018-02-26 01:54:29 +00:00
* Chroot specifying Bash in case live media has another shell
2018-02-26 01:45:06 +00:00
`chroot /mnt/drive /bin/bash`
2018-02-26 01:54:29 +00:00
* Change root password in chroot (TEST IF YOUR KEYBOARD HAS ALL THE CORRECT MAPPINGS before you change the password)
2018-02-26 01:45:06 +00:00
`passwd root`
### Change the network interfaces
2018-02-26 02:05:19 +00:00
* 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
2018-02-26 01:45:06 +00:00
`auto eth0
2018-02-26 01:35:51 +00:00
allow-hotplug eth0
2018-02-26 01:45:06 +00:00
iface eth0 inet dhcp`
2018-02-26 02:05:19 +00:00
* On the `/etc/resolv.conf.head` file set your preferred DNS provider (this example is from OpenNIC)
2018-02-26 01:45:06 +00:00
`nameserver 193.41.79.236`
* Or copy the resolv.conf file from /etc to /mnt/etc BEFORE chrooting
2018-02-26 01:35:51 +00:00
2018-02-26 02:05:19 +00:00
### Edit fstab
* Change the `/etc/fstab` file with appropriate filesystems
2018-02-26 01:45:06 +00:00
`/dev/sda1 /boot <BOOTLOADER_FILESYSTEM> defaults 0 2
/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
2018-02-26 01:35:51 +00:00
2018-02-26 02:05:19 +00:00
### Edit environment
2018-02-26 01:54:29 +00:00
* On CRUX change the font, keyboard, timezone, hostname and services
2018-02-26 01:45:06 +00:00
`ls /usr/share/kbd/keymaps/
nano /etc/rc.conf`
2018-02-26 01:54:29 +00:00
* On Source Mage GNU/Linux change the keymaps
2018-02-26 01:45:06 +00:00
`ls /usr/share/keymaps/i386/qwerty
nano /etc/sysconfig/keymap`
2018-02-26 01:54:29 +00:00
* On CRUX generate locales (change interface language)
2018-02-26 01:45:06 +00:00
`localedef -i <LOCALE> -f ISO-<CODE> <LOCALE>`
2018-02-26 01:54:29 +00:00
* On Source Mage GNU/Linux generate locales (change interface language)
2018-02-26 01:45:06 +00:00
`cast -r locale`
2018-02-26 01:35:51 +00:00
## BOOTLOADER
2018-02-26 01:35:51 +00:00
* The drive where bootloaders and OSes are installed on these examples is /dev/sda, bu could be anywhere.
* The bootloader installation IS inside chroot AND with drives mounted, so this guides assumes you are inside "/mnt/drive".
* The "vmlinuz" makes reference to the kernel image, you can rename it or simlink to it in all cases, the only rule is you have to make sure the name is referenced correctly in the bootloader. By default it can have names like vmlinuz-linux, vmlinuz-<KERNEL_VERSION> and so on. The same with initramfs.img, it can be initramfs-<KERNEL_VERSION>.img and such.
* All bootloader examples have included other OS inside what is called "stanzas".
* FreeDOS and Windows stanzas are OPTIONAL.
* If dualbooting with Windows remember that it likes to be in the first partition.
2018-02-26 01:45:06 +00:00
* If on UEFI check if module is loaded by issuing `modprobe efivars`.
* On CRUX do `prt-get remove lilo` if you dont use LILO.
* On Source Mage GNU/Linux do `cast <BOOTLOADER>` to install the preferred bootloader.
2018-02-26 01:35:51 +00:00
### LILO
2018-02-26 01:54:29 +00:00
* If on UEFI use elilo and change names to /etc/elilo.conf instead of /etc/lilo.conf and elilo instead of lilo in commands
2018-02-26 01:45:06 +00:00
`nano /etc/lilo.conf`
2018-02-26 01:54:29 +00:00
* Inserting password=<PASSWORD> inside an OS stanza will protect with a password the that OS, but inserting password=<PASSWORD> just before the stanzas will protect with a password the bootloader instead (notice the space inside stanzas)
2018-02-26 01:45:06 +00:00
`boot = /dev/sda
2018-02-26 01:35:51 +00:00
image = /boot/vmlinuz
Label = CRUX
root = /dev/sda<PARTITION_NUMBER_OF_DISTRO>
other = /dev/sda<PARTITION_NUMBER_OF_FREEDOS>
table = /dev/sda
Label = FreeDos
other = /dev/sda<PARTITION_NUMBER_OF_WINDOWS>
table = /dev/sda
2018-02-26 01:45:06 +00:00
Label = Windows7`
`lilo -A /dev/sda 1
lilo`
2018-02-26 01:54:29 +00:00
* In case you used a password prevent anyone but root of reading the config file
2018-02-26 01:45:06 +00:00
`chmod 600 /etc/lilo.conf`
2018-02-26 01:35:51 +00:00
### SYSLINUX
2018-02-26 01:54:29 +00:00
* If on BIOS make directory and copy files accordingly
2018-02-26 01:45:06 +00:00
`mkdir -p /boot/syslinux
cp /usr/lib/syslinux/bios/*.c32 /boot/syslinux/`
2018-02-26 01:54:29 +00:00
* If on UEFI make directory and copy files accordingly
2018-02-26 01:45:06 +00:00
`mkdir -p /boot/efi/EFI/syslinux
cp -r /usr/lib/syslinux/efi64/* /boot/efi/EFI/syslinux/`
2018-02-26 01:54:29 +00:00
* If on BIOS setup boot entry
2018-02-26 01:45:06 +00:00
`umount /dev/sda1
2018-02-26 01:35:51 +00:00
syslinux --directory syslinux --install /dev/sda1
2018-02-26 01:45:06 +00:00
mount /dev/sda1 /boot`
2018-02-26 01:54:29 +00:00
* If on UEFI setup boot entry using efibootmgr
2018-02-26 01:45:06 +00:00
`umount /dev/sda1
2018-02-26 01:35:51 +00:00
efibootmgr -c -d /dev/sda -p 1 -l /boot/efi/EFI/syslinux/syslinux.efi -L Syslinux
2018-02-26 01:45:06 +00:00
mount /dev/sda1 /boot/efi`
* Edit /boot/syslinux/syslinux.cfg if on BIOS or /boot/efi/EFI/syslinux/syslinux.cfg if on UEFI
2018-02-26 01:54:29 +00:00
* splash.png is the splash screen image located in /boot/syslinux/ if on BIOS or /boot/efi/EFI/syslinux/ if on UEFI
2018-02-26 01:45:06 +00:00
`PROMPT 1
2018-02-26 01:35:51 +00:00
TIMEOUT 50
MENU BACKGROUND splash.png
DEFAULT CRUX
LABEL CRUX
MENU LABEL CRUX
LINUX /boot/vmlinuz
INITRD /boot/initramfs.img
LABEL FreeDOS
MENU LABEL FreeDOS
KERNEL chain.c32
APPEND sda <PARTITION_NUMBER_OF_FREEDOS>
LABEL Windows7
MENU LABEL Windows7
KERNEL chain.c32
2018-02-26 01:45:06 +00:00
APPEND sda <PARTITION_NUMBER_OF_WINDOWS>`
2018-02-26 01:35:51 +00:00
### GRUB Legacy
2018-02-26 01:54:29 +00:00
* If on BIOS setup boot entry (boot partition must be mounted)
2018-02-26 01:45:06 +00:00
`mount /dev/sda1 /boot
grub-install /dev/sda`
2018-02-26 01:54:29 +00:00
* If on UEFI setup boot entry (boot partition must be mounted)
2018-02-26 01:45:06 +00:00
`mount /dev/sda1 /boot/efi
grub-install /boot/efi`
2018-02-26 01:54:29 +00:00
* Edit configuration file
2018-02-26 01:45:06 +00:00
`nano /boot/grub/menu.lst`
`default=0
2018-02-26 01:35:51 +00:00
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title <DISTRO_NAME> (<KERNEL_VERSION>)
root (hd0,<PARTITION_NUMBER_OF_DISTRO>)
kernel /vmlinuz-<KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet
initrd /initramfs-<KERNEL_VERSION>.img
title <DISTRO_NAME_alternative_kernel> (<ANOTHER_KERNEL_VERSION>)
root (hd0,<PARTITION_NUMBER_OF_DISTRO>)
kernel /vmlinuz-<ANOTHER_KERNEL_VERSION> ro root=/dev/sda5 rhgb quiet
initrd /initramfs-<ANOTHER_KERNEL_VERSION>.img
title FreeDOS
root (hd0,<PARTITION_NUMBER_OF_FREEDOS>)
kernel /memdisk
initrd (hd0,<PARTITION_NUMBER_OF_FREEDOS>)/fdboot.img
title Windows 7
root (hd0,<PARTITION_NUMBER_OF_WINDOWS>)
2018-02-26 01:45:06 +00:00
chainloader /EFI/Microsoft/Boot/bootmgfw.efi`
2018-02-26 01:35:51 +00:00
### GRUB 2
2018-02-26 01:54:29 +00:00
* If on BIOS setup boot entry (boot partition must be mounted)
2018-02-26 01:45:06 +00:00
`mount /dev/sda1 /boot
grub-install /dev/sda`
2018-02-26 01:54:29 +00:00
* If on UEFI setup boot entry (boot partition must be mounted)
2018-02-26 01:45:06 +00:00
`mount /dev/sda1 /boot/efi
grub-install /boot/efi`
2018-02-26 01:54:29 +00:00
* If Grub does not detect your OS run "os-prober" followed by "update-grub", or add the OS manually to the Grub config file
2018-02-26 01:45:06 +00:00
`nano /etc/grub.d/40_custom`
`menuentry "FreeDOS" {
2018-02-26 01:35:51 +00:00
set root='(hd0,msdos2)'
linux16 /memdisk
initrd16 /fdboot.img
chainloader +1
}
menuentry "Windows 7" {
insmod part_msdos
insmod ntfs
insmod search_fs_uuid
insmod ntldr
search --fs-uuid --no-floppy --set=root 3482FBC382FB879E
chainloader +1
ntldr /bootmgr
2018-02-26 01:45:06 +00:00
}`
2018-02-26 01:54:29 +00:00
* Update config file
2018-02-26 01:45:06 +00:00
`grub-mkconfig -o /boot/grub/grub.cfg`