about summary refs log tree commit diff stats
path: root/linux/install.html
diff options
context:
space:
mode:
Diffstat (limited to 'linux/install.html')
-rw-r--r--linux/install.html408
1 files changed, 408 insertions, 0 deletions
diff --git a/linux/install.html b/linux/install.html
new file mode 100644
index 0000000..64fbe02
--- /dev/null
+++ b/linux/install.html
@@ -0,0 +1,408 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+    <head>
+        <meta charset='utf-8'>
+        <title>1.1. Install Crux 3.5</title>
+    </head>
+    <body>
+
+        <a href="index.html">Core OS Index</a>
+
+        <h1>1.1. Install Crux 3.5</h1>
+
+        <p>Installation of minimal Crux 3.5 Gnu\Linux system,
+        with selected packages from core, opt and contrib
+        ports. Process of installation documented can be
+        executed from iso or from existing gnu\linux installation.
+        Read
+        <a href="http://crux.nu/Main/Handbook3-5">Hand book 3.5</a>,
+        .</p>
+
+        <p>If you are booting from crux iso and is not your keyboard
+        layout of choice run;</p>
+
+        <pre>
+        # loadkeys dvorak
+        </pre>
+
+        <h2 id="step1">1.1.1. Download iso</h2>
+
+        <p>Visit crux
+        <a href="http://crux.nu/Main/Download">download page</a> for
+        more notes before downloading iso. Script
+        <a href="scripts/setup-iso.sh">setup-iso.sh</a> downloads
+        iso from master repo and checks md5sum.</p>
+
+        <pre>
+        $ curl -k -O https://serverop.de/crux/crux-3.5/iso/crux-3.5.iso
+        $ curl -k -O https://serverop.de/crux/crux-3.5/iso/crux-3.5.md5
+        $ md5sum crux-3.5.iso
+        eb0c9b75322ba240f229ec9834feddfd crux-3.5.iso
+        </pre>
+
+        <h2 id="step2">1.1.2. Prepare target</h2>
+
+        <p>Prepare disk or target location where new system will
+        be installed. Following steps describe how to create efi
+        system or msdos. Systems with bios_boot(msdos) only require
+        boot partition in the beginning of the disk, use ext4 file
+        system. For more information about gpt partitions table read
+        <a href="http://devil-detail.blogspot.com/2013/07/install-grub2-on-gpt-disk-dedicated-partition.html">devil-detail grub2 on gpt</a>. Script <a href="scripts/setup-target.sh">setup-target.sh</a> help to create partitions
+        scripts.</p>
+
+        <p>Load dm-crypt module and start parted;</p>
+
+        <pre>
+        # modprobe dm-crypt
+        # parted /dev/sda
+        </pre>
+
+        <p>Set unit size to use;</p>
+
+        <pre>
+        (parted) unit mib
+        </pre>
+
+        <h3>bios_boot</h3>
+
+        <p>If the system don't support efi, on bios_boot systems;</p>
+
+        <pre>
+        (parted) mklabel msdos
+        </pre>
+
+        <p>Boot partition. Partition with 1G provide room for kernels
+        and bootable iso's that can be directly boot from grub (without root
+        partition). Partition size ~1G;</p>
+
+        <pre>
+        (parted) mkpart primary ext4 2 1132
+        (parted) set 1 boot on
+        </pre>
+
+        <h3>efi/esp</h3>
+
+        <p>On systems that support efi;</p>
+
+        <pre>
+        (parted) mklabel gpt
+        </pre>
+
+        <p>Partition used by grub boot loader. Partition size 2M;</p>
+
+        <pre>
+        mkpart primary 2 4
+        name 1 grub
+        set 1 bios_grub on
+        </pre>
+
+        <p>EFI System Partition, ESP type EF00. Partition
+        with between 500M and 100M is recommended for standard
+        installations. Partition size 128M;</p>
+
+        <pre>
+        (parted) mkpart ESP fat32 4 132
+        (parted) name 2 efi
+        (parted) set 2 boot on
+        </pre>
+
+        <p>Boot partition. Partition with 1G provide room for kernels
+        and bootable iso's that can be directly boot from grub (without root
+        partition). Partition size ~1G;</p>
+
+        <pre>
+        (parted) mkpart primary ext4 132 1132
+        (parted) name 3 boot
+        </pre>
+
+        <h3>Encrypted lvm</h3>
+
+        <p>There are different ways to achieve disk encryption,
+        the method described uses cryptosetup to create cryptodevice
+        with <a href="../tools/lvm.html">lvm</a> inside containing
+        root and other partitions such as;
+        var, usr, swap and home.
+
+        <pre>
+        (parted) mkpart primary 1132 100%
+        </pre>
+
+        <p>Create encrypted block for lvm, partition layout of efi and bios boot systems is different.</p>
+
+        <p>On bios_boot systems partition should be  2;</p>
+
+        <pre>
+        (parted) set 4 lvm on
+        # cryptsetup luksFormat /dev/sda2
+        # cryptsetup luksOpen /dev/sda2 cryptlvm
+        </pre>
+
+        <p>Create physical group and volume group;</p>
+
+        <pre>
+        # pvcreate /dev/mapper/cryptlvm
+        # vgcreate vg_system /dev/mapper/cryptlvm
+        </pre>
+
+        <h3>/ root partition</h3>
+
+        <p>Core collection installation on root partition uses
+        approximately 2G. Partition with 8G-20G is recommended
+        for a server or desktop with dedicated ports partition
+        or using only compiled packages. Partition size 20G;</p>
+
+
+        <pre>
+        # lvcreate -L 20G -n lv_root vg_system
+        </pre>
+
+        <h3>/var partition</h3>
+
+        <p>Var partition is recommended 1G-5G depending on how
+        system is configured. Partition size 2G;</p>
+
+        <pre>
+        # lvcreate -L 2G -n lv_var vg_system
+        </pre>
+
+        <h3>Swap (ram)</h3>
+
+        <p>Swap partition general advice is to have the same size as
+        memory ram, ports system will be configured to build on ram.
+        To build firefox is necessary at least 34G. Partition size 4G;</p>
+
+        <pre>
+        # lvcreate -L 4G -n lv_swap vg_system
+        </pre>
+
+
+        <h3>/home</h3>
+
+        <p>On desktop fill the rest of disk space while on server
+        this partition can be replaced with /srv.
+        Fill the rest of disk space;</p>
+
+        <pre>
+        # lvcreate -L 120G -n lv_home vg_system
+        </pre>
+
+        <h3>Create filesystems</h3>
+
+        <pre>
+        $ sudo mkfs.fat -F 32 /dev/sda2
+        $ sudo mkfs.ext4      /dev/sda3
+        $ sudo mkfs.ext4      /dev/vg_system/lv_root
+        $ sudo mkfs.ext4      /dev/vg_system/lv_var
+        $ sudo mkswap	      /dev/vg_system/lv_swap
+        $ sudo mkfs.ext4      /dev/vg_system/lv_home
+        </pre>
+
+        <h2 id="step3">1.1.3. Prepare Install</h2>
+
+        <p>From now on script
+        <a href="scripts/setup-target.sh">setup-target.sh</a>
+        create file systems, <a href="scripts/install-core.sh">install-core.sh</a> install core packages and
+        <a href="scripts/setup-core.sh">setup-core.sh</a>
+        configure host metadata and setup ports;</p>
+
+        <p>Export target root partition;</p>
+
+        <pre>
+        $ export BLK_ROOT=/dev/vg_system/lv_root
+        </pre>
+
+        <p>Export target root directory you want to install;</p>
+
+        <pre>
+        $ export CHROOT=/mnt
+        </pre>
+
+        <p>If you are installing to a directory and not partitions you don't need to mount;</p>
+
+        <pre>
+        $ sudo mount $BLK_ROOT $CHROOT
+        </pre>
+
+        <p>Create follow directories;</p>
+
+        <pre>
+        $ sudo mkdir -p $CHROOT/boot
+        $ sudo mkdir -p $CHROOT/var
+        $ sudo mkdir -p $CHROOT/usr
+        $ sudo mkdir -p $CHROOT/media
+        $ sudo mkdir -p $CHROOT/home
+
+        $ sudo mkdir -p $CHROOT/dev
+        $ sudo mkdir -p $CHROOT/tmp
+        $ sudo mkdir -p $CHROOT/proc
+        $ sudo mkdir -p $CHROOT/sys
+        </pre>
+
+        <p>If partition layout is different or target is a directory is not necessary to mount, create only the directories;</p>
+
+        <pre>
+        $ sudo mount $BLK_BOOT $CHROOT/boot
+        $ sudo mkdir -p $CHROOT/boot/efi
+        $ sudo mount $BLK_EFI $CHROOT/boot/efi
+
+        $ sudo mount $BLK_VAR $CHROOT/var
+        $ sudo mkdir -p $CHROOT/var/lib/pkg
+
+        $ sudo mount $BLK_HOME $CHROOT/home
+        </pre>
+
+        <p>Activate Chroot;</p>
+
+        <pre>
+        $ sudo mount --bind /dev $CHROOT/dev
+        $ sudo mount -vt devpts devpts $CHROOT/dev/pts
+        $ sudo mount -vt tmpfs shm $CHROOT/dev/shm
+        $ sudo mount -vt proc proc $CHROOT/proc
+        $ sudo mount -vt sysfs sysfs $CHROOT/sys
+        </pre>
+
+        <p>Mount iso or copy packages to target /mnt directory;</p>
+
+        <pre>
+        # modprobe isofs
+        # modprobe loop
+        # mount -o loop crux-3.5.iso $CHROOT/media
+        </pre>
+
+        <h2 id="step4">1.1.4. Install Crux</h2>
+
+        <p>Create file $CHROOT/core.lst containing
+        list of binary packages present in $CHROOT/media/crux/core/;</p>
+
+        <pre>
+        $ sudo for p in $CHROOT/media/crux/core/*; do echo $p &lt;&lt; $CHROOT/core.lst; done
+        </pre>
+
+        <p>Install temporary pkgadd on $CHROOT;</p>
+
+        <pre>
+        $ sudo tar xf /media/crux/core/pkgutils#5.40-1.pkg.tar.xz usr/bin/pkgadd -O > $CHROOT/pkgadd
+        $ sudo chmod +x $CHROOT/pkgadd
+        </pre>
+
+        <p>Edit $CHROOT/core.lst with your preferences, you can remove
+        or add packages from opt collection. Remove lilo if you want
+        grub.</p>
+
+        <p>Create package database, it will contain a list of
+        installed packages files.</p>
+
+        <pre>
+        $ sudo touch $CHROOT/var/lib/pkg/db
+        </pre>
+
+        <p>Install all packages listed in $CHROOT/core.lst;</p>
+
+        <pre>
+        $ su
+        # cd $CHROOT
+        while read line; do
+                printf "Installing $line;\n"
+                $CHROOT/pkgadd -f -r $CHROOT $line
+        done &lt; core.lst
+        </pre>
+
+        <h2 id="step5">1.1.5. Install extra packages</h2>
+
+        <p>Install additional ports like wireless-tools, grub2
+        and fakeroot;</p>
+
+        <pre>
+        cp $CHROOT/media/crux/opt/* $CHROOT/usr/ports/packages
+        cp $CHROOT/media/crux/xorg/* $CHROOT/usr/ports/packages
+        </pre>
+
+        <pre>
+        # chroot $CHROOT /bin/bash
+        </pre>
+
+        <pre>
+        pkgadd /usr/ports/packages/fakeroot#*
+        pkgadd /usr/ports/packages/dbus#*
+        pkgadd /usr/ports/packages/expat#*
+        pkgadd /usr/ports/packages/libnl#*
+        pkgadd /usr/ports/packages/libpng#*
+        pkgadd /usr/ports/packages/freetype#*
+        pkgadd /usr/ports/packages/libffi#*
+        pkgadd /usr/ports/packages/sqlite3#*
+        pkgadd /usr/ports/packages/python#*
+        pkgadd /usr/ports/packages/glib#*
+        pkgadd /usr/ports/packages/grub2#*
+        pkgadd /usr/ports/packages/grub2-efi#*
+        pkgadd /usr/ports/packages/wireless-tools#*
+        pkgadd /usr/ports/packages/wpa_supplicant#*
+        pkgadd /usr/ports/packages/lvm2#*
+        pkgadd /usr/ports/packages/mdadm#*
+        pkgadd /usr/ports/packages/efivar#*
+        pkgadd /usr/ports/packages/efibootmgr#*
+        pkgadd /usr/ports/packages/dosfstools#*
+        pkgadd /usr/ports/packages/ported#*
+        pkgadd /usr/ports/packages/libgcrypt#*
+        pkgadd /usr/ports/packages/cryptsetup#*
+        pkgadd /usr/ports/packages/popt#*
+        pkgadd /usr/ports/packages/libgpg-error#*
+        pkgadd /usr/ports/packages/libevent#*
+        pkgadd /usr/ports/packages/libtirpc#*
+        pkgadd /usr/ports/packages/git#*
+        pkgadd /usr/ports/packages/tmux#*
+        pkgadd /usr/ports/packages/prt-utils#*
+        pkgadd /usr/ports/packages/elfutils#*
+        </pre>
+
+        <pre>
+        # exit
+        </pre>
+
+        <pre>
+        $ sudo rm $CHROOT/pkgadd
+        $ sudo rm $CHROOT/core.lst
+        </pre>
+
+        <h2 id="step6">1.1.6. Install extra ports</h2>
+
+        <p>Create port collection;</p>
+
+        <pre>
+        $ sudo mkdir $CHROOT/usr/ports/machine-ports
+        </pre>
+
+        <p>Copy ports from  doc/core/ports;</p>
+
+        <pre>
+        $ sudo cp -r ports/* $CHROOT/usr/ports/machine-ports/
+        </pre>
+
+        <h2 id="step7">1.1.7. DNS Resolver</h2>
+
+        <pre>
+        $ sudo cp /etc/resolv.conf $CHROOT/etc
+        </pre>
+
+        <h2 id="step8">1.1.8. Install Handbook</h2>
+
+        <pre>
+        $ sudo cp $CHROOT/media/crux/handbook.txt $CHROOT/home/root/
+        </pre>
+
+        <h2 id="step9">1.1.9. Basic Skeleton</h2>
+
+        <p>Copy skeletons from  doc/core/conf;</p>
+
+        <pre>
+        $ sudo cp -R  conf/skel $CHROOT/etc/
+        </pre>
+
+        <a href="index.html">Core OS Index</a>
+        <p>This is part of the Tribu System Documentation.
+        Copyright (C) 2020
+        Tribu Team.
+        See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
+        for copying conditions.</p>
+
+    </body>
+</html>