Installing crux

From MineOS Wiki
Jump to navigation Jump to search

Installing CRUX Linux

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 with these steps that will be installed afterward using the pkg-add feature, such as rdiff-backup or 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

To save time (on successive installs, etc), 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 file: 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

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 192.168.1.100/24 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 the fstab file: 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

Enabling SSH server

  1. Edit the net file: vi /etc/rc.conf
  2. Adjust the following line to include the SSH server daemon on startup: SERVICES=(net crond sshd)
  3. Save and quit: :wq
Adjusted /etc/rc.conf
  1. Edit the hosts.allow file: vi /etc/hosts.allow
  2. Insert the following line to include the allow connections to the sshd daemon.sshd: ALL
    1. 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 tailored to your hardware/VM, so before you can reboot, you must build one.

Follow the steps to build a kernel.