This is a step-by-step guide to using CRI as a Linux installer. Currently, CRI
supports the installation of the following distributions:

* AlmaLinux OS
  https://almalinux.org/

* Debian GNU/Linux
  https://www.debian.org/

* Devuan Linux
  https://devuan.org/

* Fedora Server
  https://fedoraproject.org/server/

* PLD Linux
  https://pld-linux.org/

* Rocky Linux
  https://rockylinux.org/

* TLD Linux
  https://tld-linux.org/

* Ubuntu Linux
  https://ubuntu.com/

You can also use CRI as a rescue/recovery disk for any Linux distribution.

----------------------------------
| Step 1: Pre-Installation Tasks |
----------------------------------

Before proceeding with the installation, you must prepare your target devices.
CRI does not provide wizards for managing storage devices, so you will have to
do everything by hand.

Start by partitioning your drives with cfdisk, fdisk, gdisk or parted. If you
have devices larger than 2TB, be sure to choose a utility that supports GPT
partition tables.

Once your partitions are ready, you may want to create RAID, LVM, or LUKS
volumes. The following are quick guides to some basic commands.

Software RAID
-------------

Partitions for RAID devices must be of type FD or FD00 (raid auto-detect).

To create a RAID array, you must specify the array device, the RAID level, the
number of RAID devices, and a list of partitions to be used as RAID devices.
For example, to create a RAID 1 mirror /dev/md0 with two devices /dev/sda1 and
/dev/sdb1, run the following command:

# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

To manually assemble an existing RAID array, for example, RAID 5 array /dev/md1
with three devices /dev/vda3, /dev/vdb3, and /dev/vdc3, you must run the
following command:

# mdadm --assemble /dev/md1 /dev/vda3 /dev/vdb3 /dev/vdc3

You can also try to automatically assemble all existing arrays if for some
reason they were not assembled at boot time:

# mdadm --assemble --scan

LVM
---

To create a new LVM volume, you must first create physical volumes for your LVM
configuration. You can do this with the 'pvcreate' command:

# pvcreate /dev/md1

The next step is to create LVM volume groups using the 'vgcreate' command:

# vgcreate lvm_storage /dev/md1

Once the volume group is created, you can create logical volumes within it. For
example, to create a 10 GB volume for the root filesystem and 20 GB for /home:

# lvcreate -L 10G -n root lvm_storage
# lvcreate -L 20G -n home lvm_storage

If you have an existing LVM configuration, you can activate it manually if it
wasn't activated automatically during the boot process:

# vgchange -a y

LUKS
----

To create an encrypted LUKS volume, use cryptsetup's luksFormat command:

# cryptsetup -v luksFormat /dev/md2

To access the contents of the LUKS volume, you must use cryptsetup's
luksOpen command:

# cryptsetup -v luksOpen /dev/md2 encrypted_raid

Your encrypted device will be available as /dev/mapper/encrypted_raid.

Creating file systems
--------------------

When your devices are ready, create file systems of your choice. For example:

# mkswap /dev/lvm_storage/swap
# mkfs.ext4 /dev/md0
# mkfs.ext4 /dev/lvm_storage/root
# mkfs.ext4 /dev/lvm_storage/home
# mkfs.xfs /dev/mapper/encrypted_raid

If you are installing a distribution that uses older versions of e2fsprogs or
xfsprogs, you may need to disable some file system features. For example:

# mkfs.ext4 -O ^orphan_file,^metadata_csum_seed /dev/md0
# mkfs.xfs -m crc=0 -m finobt=0 /dev/md0

If the installed distribution does not support all the features of the file
systems, it will not be able to mount them and may fail to boot. The GRUB
boot loader will also fail to install if the filesystem uses unsupported
features.

------------------------
| Step 2: Installation |
------------------------

You are almost ready to install your chosen Linux distribution. Please mount
all your target devices to some directory. For example:

# mount -t ext4 /dev/lvm_storage/root /chroot
# mkdir /chroot/{boot,crypt,home}
# mount -t ext4 /dev/md0 /chroot/boot
# mount -t ext4 /dev/lvm_storage/home /chroot/home
# mount -t xfs /dev/mapper/ecrypted_raid /chroot/crypt

For network-based installations, you will need to configure your network
devices. You can easily do this with the 'netconfig' command. It is a simple
wizard that will help you configure ethernet and wireless interfaces. It also
supports the creation of VLAN, bonding and bridge interfaces.

After that, run the installation procedure using the "sysinstall" command.
Specify the directory path (where the system will be installed) as a parameter,
e.g:

# sysinstall /chroot

You will be prompted for basic system configuration such as hostname, timezone,
root password, first user account, boot loader installation, etc. After that,
you need to select the installation source and the system and/or version you
want to install.

That's it. Confirm the installation and wait patiently for it to finish. When
finished, CRI will tell you if the installation was successful or not.

Note: The system images used by sysinstall may be out of date. Be sure to
update your system after booting.

Installation Notes
------------------

There are a few issues/restrictions you should be aware of before installing
your chosen Linux distribution:

1. Some boot loaders require the RAID partition used for /boot to use a
specific metadata format. Be sure to verify this or your system may not boot.
Also, make sure the RAID level used for /boot is RAID 1 (mirror).

2. If you are using GPT, don't forget to create a BIOS partition for GRUB. It
must be at least 1MB in size and of type EF02. Without this partition, GRUB
will fail to install.

3. If you are installing on a UEFI system, don't forget to create an EFI
partition of type EF00. It should be large enough to hold EFI boot images and
formatted as FAT32.

4. If you used encrypted LUKS volumes for your installation, remember that your
system will be waiting for someone to type a decryption password on a local
console. If you do not want this to happen, be sure to configure your installed
system to automatically unlock encrypted devices before rebooting. Note: CRI
supports crypttab entries for LUKS volumes only.

5. On some hardware, initrd/initramfs created with CRI may not contain all the
necessary modules (e.g. raid or crypto). If your system does not boot, try
forcing these modules to be added to initrd/initramfs.
