Installing crux

From MineOS Wiki
Jump to navigation Jump to search

Installing CRUX Linux involves numerous steps. These steps assume that two primary partitions already exist (through partitioning software such as fdisk), and each has been formatted with appropriate filesystems (such as ReiserFS or swap).

These steps cover both the x86 and x64 versions of CRUX. If you are attempting 64-bit MineOS, be sure you downloaded the x64 ISO from the CRUX Linux download page.

Mounting partitions

  1. mount /dev/sda1 /mnt
  2. swapon /dev/sda2
Mount drives and enter setup

CRUX setup

  1. setup
Select 'Install CRUX 2.X'
Accept default mount location '/mnt'
Accept default packages 'core'
Decline to select packages individually
Continue the install
Close the setup process

Left out packages

If you feel ambitious, feel free to add additional packages 'opt' and select/deselect programs on an individual basis. There are a number of programs that will not be installed initially, but will be installed afterward using the pkgmk feature at a later step. Such programs include rdiff-backup and python.

Basic configuration steps

chrooting to your new environment

  1. mount --bind /dev /mnt/dev
  2. mount --bind /tmp /mnt/tmp
  3. mount -t proc proc /mnt/proc
  4. mount -t sysfs none /mnt/sys
  5. chroot /mnt /bin/bash
chroot commands

It is recommended you type in these commands manually for the sake of repetition and learning. However, to save time, you can shortcut all five steps with: setup-chroot

Set the root password

  1. passwd
Set the root password with passwd

Auto-mount filesystems with fstab

  1. Edit the fstab: vi /etc/fstab
  2. Enter insert mode with i
  3. Uncomment and adjust the appropriate lines for your main partition and swap partition
  4. Exit insert mode with <escape>
  5. Save and quit: :wq
Adjusted fstab

Configure network routing


DHCP is absolutely emphasized in all cases. Even if you wish to have a "static"/unchanging IP, the means to do this is with STATIC DHCP--not with a strictly static ip, which is the least flexible, least forgiving, and least useful configuration. No benefits of static IPs exist that aren't included in STATIC DHCP.

  1. Edit the net file: vi /etc/rc.d/net
  2. Comment out each of the highlighted lines, except the one marked with the red line, which must be added: /sbin/dhcpcd -t 10 -h $HOSTNAME eth0
  3. Save and quit: :wq
Adjusted /etc/rc.d/net

Static IP

These settings are included simply to be comprehensive, but not recommended for use. In addition to adjusting the route add default via line, you must also adjust the #ethernet ip addr add to match your desired IP address.

  1. Edit the net file: vi /etc/rc.d/net
  2. Adjust the following line to match the desired static IP address for your server: /sbin/ip addr add 192.168.x.x/24 dev eth0 broadcast +
  3. Adjust the following line to match the IP address of your router: /sbin/ip route add default via 192.168.x.x
  4. Save and quit: :wq
Adjusted /etc/rc.d/net
  1. Edit resolv.conf: vi /etc/resolv.conf
  2. Adjust the following line to match the IP address of your router: nameserver 192.168.x.x
  3. Save and quit: :wq
Adjusted /etc/resolv.conf

Auto-starting SSH server

  1. Edit rc.conf: vi /etc/rc.conf
  2. Adjust the following line to include the SSH daemon on startup: SERVICES=(net crond sshd)
  3. Save and quit: :wq
Adjusted /etc/rc.conf
  1. Edit hosts.allow: vi /etc/hosts.allow
  2. Insert the following line to permit connections to the sshd service: sshd: ALL
    note: this allows all users from all IPs to attempt to connect to the server. This does not mean it grants them access (they still need user/pass), but this will be locked down further in the hardening steps.
  3. Save and quit: :wq
Adjusted /etc/hosts.allow

Compiling a new kernel

A kernel (the brains of Linux) does not exist that is specifically tailored to your hardware/VM, so before you can boot into linux, you must build one.

Follow the steps to build a kernel.

Installing/Updating LILO (the Linux bootloader)

LILO (LInux bootLOader) allows your computer to correctly recognize the bootable partition, load the kernel, and pass control to the user, to log in and work. There are alternative bootloaders, such as Grub which may be used instead of LILO. LILO, however, is a much more simple process for MineOS purposes.

To install LILO:

  1. Edit /etc/lilo.conf
  2. Adjust the following lines:
    1. boot=/dev/sda
    2. root=/dev/sda1
    3. append="quiet sata"
  3. Save and quit: :wq
  4. Type lilo to install LILO.
Adjusted lilo.conf
Added CRUX * to bootloader

Rebooting for the first time

Normally you can reboot with the command reboot, but during the install process, the CRUX Linux iso is still mounted. Since we wish to boot from the hard disk's master boot record instead of the mounted ISO, instead execute shutdown now. Once you receive the message: INIT: no more processes left in this runlevel, you may unmount the CRUX iso from Virtualbox/remove the CD from the tray, and restart the VM/computer physically.

Special Notice! After building/replacing the kernel, this is the most likely time (if any mistakes were made) for the kernel to not boot. If you are using virtualization software, such as Virtualbox, you can make a SNAPSHOT (Machine/Take Snapshot) which will save the state of your VM 100%. This way, if your kernel fails to boot upon restart, you can revert back to this exact moment, where you can adjust the kernel again, add the necessary built-in features, rebuild and try again. If you must go through the rescue/reboot procedure, you will have to go through the ISO to reboot/rebuild which will take extra time.

Logging in for the first time

If all went well, it should boot into Linux and look like this:

First login prompt

Congratulations! Linux in a bare-minimum state has been installed! The steps from here out are to turn a mini-Linux into a fully functional, superior hosting platform!

Next Steps

From here on, I encourage all users to connect to their Linux machines via PuTTY, which has countless advantages and is the industry standard way to connect to Linux machines remotely (even if you're working on the same machine).

See the PuTTY page for instructions on how to download, use, and improve your Linux experience with a terminal window instead of interacting with the machine directly.