Difference between revisions of "Installing crux"

From MineOS Wiki
Jump to navigation Jump to search
(putty)
Line 89: Line 89:
  
 
Follow the steps to [[build a kernel]].
 
Follow the steps to [[build a kernel]].
 +
 +
== Installing/Updating LILO (the Linux bootloader) ==
 +
LILO (LInux bootLOader) allows a bootable partition to correctly recognize the kernel, loads the kernel, then passes control to the user, to log in and work. There are alternative bootloaders, such as [[Grub]] which can be used instead of LILO, but LILO will be used for simplicity right now.
 +
 +
To install LILO:
 +
 +
# Edit <tt>/etc/lilo.conf</tt>
 +
# Adjust the following lines:
 +
## boot=/dev/sda
 +
## root=/dev/sda1
 +
## append="quiet sata"
 +
# Save and quit: <tt>:wq</tt>
 +
# Type <tt>lilo</tt> to install LILO.
 +
 +
[[File:lilo.png|thumb|none|400px|Adjusted lilo.conf]]
 +
 +
== Rebooting for the first time ==
 +
 +
Normally you can reboot with the command <tt>reboot</tt>, but for the first time, you have to be sure to also unmount the CRUX Linux ISO so that the hard disk is booted from instead.  Therefore, simply execute <tt>shutdown now</tt> and wait until you receive the message: <tt>INIT: no more processes left in this runlevel</tt>. At this point, you may unmount the CRUX iso/remove the CD from the tray, and restart the computer physically.
 +
 +
== Logging in for the first time ==
 +
 +
If all went well, it should boot into Linux and look like this (the "errors" may be ignored).
 +
 +
[[File:first_login.png|thumb|none|400px|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.

Revision as of 22:22, 11 June 2011

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
    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.

Installing/Updating LILO (the Linux bootloader)

LILO (LInux bootLOader) allows a bootable partition to correctly recognize the kernel, loads the kernel, then passes control to the user, to log in and work. There are alternative bootloaders, such as Grub which can be used instead of LILO, but LILO will be used for simplicity right now.

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

Rebooting for the first time

Normally you can reboot with the command reboot, but for the first time, you have to be sure to also unmount the CRUX Linux ISO so that the hard disk is booted from instead. Therefore, simply execute shutdown now and wait until you receive the message: INIT: no more processes left in this runlevel. At this point, you may unmount the CRUX iso/remove the CD from the tray, and restart the computer physically.

Logging in for the first time

If all went well, it should boot into Linux and look like this (the "errors" may be ignored).

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.