Thu Nov 3 20:17:59 2022 UTC

The install-nutyx script

Introduction

The script can be started from an already installed NuTyX, a 'LIVE' ISO or from another distribution.

Make sure you are using Bash interpreter otherwise the script will fail.

If you use another distribution, make sure your distribution is running a compatible glibc version otherwise the script will fail.

It must be executed from the root account.

This script allows the installation of a base NuTyX in a folder.

It's signature can be verified by downloading the http://download.nutyx.org/install-nutyx.md5sum file.

[Important] This script does not allow you to overwrite another distribution or a NuTyX already installed in the target folder (/mnt/hd by default). And so if you have to restart the script it is important to delete the contents of the target folder first.

Let's start with a simple example

The traditionnal example to show how simple it is.

The script can install a Base NuTyX in the /mnt/hd by default. The command is as simple as:

bash install-nutyx

The installation will start immediatly.

Configuration variables

The use of variables allows the adaptation of the script to different scenarios: :
LFS The installation path. Ok in most cases.
CHROOT The list of packages to install prior the chroot of install-nutyx itself. Need to be used when trying from another distribution.
URL The url adress of the mirror where are the binaries located (remote or local). We can use our own server.
VERSION The version to be installed (testing or rolling). The version is not checked by the script.

We can then install any version as long it exist on the server.

KERNEL As per default they are no kernel installed, up to you to choose one. Available kernel names:

kernel-49, kernel-414, kernel-419, kernel-54, kernel-510, kernel-515, kernel or linux-mainline.

DEPOT The local path of the downloaded binaries. This variable can be used in case you want to mount the depot directory (see the MOUNT variable).
MOUNT The local path of the packages depot to used for installation Allows us to install an NuTyX without the need of a network connection.
ISO If we want to generate an ISO from this installation, we can specify the name of the ISO to generate via this variable. See below.

The script will analyse the /etc/install-nutyx.conf file if it exist and used defined variables in it. Here is a summary example of the /etc/install-nutyx.conf file:

URL="http://localhost"
DEPOT="/DEPOT"
LFS="/mnt/lfs"
VERSION="rolling"

Typical example of the script: Install a NuTyX from the 'LIVE' iso

  • Open a terminal and switch to the root account if not yet set:
    sudo bash
  • Make sure the network is working.
    ping nutyx.org
  • Create the needed partitions for NuTyX:
    cfdisk /dev/sda
    • For an 'UEFI' machine: Choose a 'GPT' partition table. Define the first partition as 'EFI System'. The size of the partition needs to be 50 Mbytes minimum if you plan to install NuTyX in a virtual machine. In case you install on a real machine, be aware that the space needed on this partition is below 400 Kbytes, so a 515 Kbytes 'EFI System' partition will be enought. This partition needs to be format in vfat.
    • For a 'BIOS' machine: Choose a 'GPT' or 'msdos' partition table. No other restriction.
  • Reserve a 4 Gbytes if you have 2 Gbyte or more of RAM. Otherwise double the size of your RAM.
  • Format all the partitions, in our example, we have 3 or 2 partitions depending of the machine (UEFI or BIOS):
    • For the 'UEFI' machine:
      mkfs.vfat /dev/sda1
      mkswap /dev/sda2
      mkfs.ext4 /dev/sda3
    • For the 'BIOS' machine:
      mkswap /dev/sda1
      mkfs.ext4 /dev/sda2
  • Mount the destination partitions
    • For the 'UEFI' machine:
      mount /dev/sda3 /mnt/hd 
      mkdir -p /mnt/hd/boot/efi
      mount /dev/sda1 /mnt/hd/boot/efi
    • For the 'BIOS' machine:
      mount /dev/sda2 /mnt/hd
  • Activate the swap partition
    • For the 'UEFI' machine:
      swapon /dev/sda2
    • For the 'BIOS' machine:
      swapon /dev/sda1
  • Install the base NuTyX with the last kernel:

    If you use a NuTyX ISO:

    KERNEL=kernel install-nutyx

    If you use another distribution:

    CHROOT="coreutils" SHELL=/bin/bash KERNEL=kernel install-nutyx
  • Once the installation is done, enter into the freshly installed NuTyX via the command:
    install-nutyx -ec
  • For the 'UEFI' machine, install the 'efibootmgr' package:
    cards install efibootmgr
  • Make the NuTyX bootable
    • For the 'UEFI' machine:
      grub-install --target=x86_64-efi /dev/sda
      or
      grub-install --target=i386-efi /dev/sda
    • For the 'BIOS' machine:
      grub-install --target=i386-pc /dev/sda
  • See this article if you want tochange the default init system.

    Create the /boot/grub/grub.cfg file:

    grub-mkconfig -o /boot/grub/grub.cfg
  • Exit and umount partitions
    exit
    umount -Rv /mnt/hd
    
  • Remove the bootable media and restart the machine.

By default, it will be the rolling branch of the NuTyX installed; it's possible to specify another branch. Specify the name of the branch via the VERSION variable. It should exist on the depot server.

VERSION="testing" bash install-nutyx

The default URL will be used for downloading and configuration of NuTyX. To instead specify another URL, use the URL variable.

URL="http://192.168.0.254" bash install-nutyx

By default, it will be the /mnt/hd folder used for the installation, the LFS variable can be set to specify a new destination folder:

LFS="/My-NuTyX" bash install-nutyx
The folder will be automatically created if it does not already exist.

You can combine several variables:

LFS="/MINI-ISO" \
VERSION="rolling" \
URL="http://192.168.0.254" \
CHROOT="acl attr expat" \
bash install-nutyx

If you want to have your own configuration, it's possible to place your configuration files in the /etc/install-nutyx.conf.d/ folder. When you run the script, if files are found there, they will be used instead of the default ones.

Recognised configuration files list:
cards.conf /etc/cards.conf
pkgmk.conf /etc/pkgmk.conf
fstab /etc/fstab
.bashrc /root/.bashrc and /home/<username>/.bashrc
bashrc /etc/bashrc
profile /etc/profile
hosts /etc/hosts
inputrc /etc/inputrc
rc_site /etc/sysconfig/rc_site
.bash_profile /root/.bash_profile and /home/<username>/.bash_profile
.dmrc /etc/skel/.dmrc
shells /etc/shells
dircolors.sh /etc/profile.d/dircolors.sh
extrapaths.sh /etc/profile.d/extrapaths.sh
readline.sh /etc/profile.d/readline.sh
umask.sh /etc/profile.d/umask.sh
modules /etc/sysconfig/modules
createfiles /etc/sysconfig/createfiles
mouse /etc/sysconfig/mouse

As a conclusion:

[Important] Don't forget to remove/check the /etc/install-nutyx.conf file and the contents of the /etc/install-nutyx.d/ directory if necessary. Found files will be read and used by the script and allow a more powerful configuration.

Produce a customised ISO

[Important] Producing an ISO is only possible on NuTyX. Means, it's not possible to use another distribution for building an ISO.

As specified above, the ISO variable allows you to specify the name of the ISO to generate.

For example, the command below:

sudo ISO=gnome bash install-nutyx
will install and produce a gnome NuTyX in the /mnt/hd folder.

Possible ISO names are:

strict, mini, base, cli, gui, xorg, gui_extra, openbox, jwm, lxde, xfce4, mate, gnome and kde5

It is possible to test the command and thus view all the commands that are affected.

ISO=gnome bash install-nutyx -t
List of variables: 

LFS        : /mnt/hd
URL        : http://downloads.nutyx.org
VERSION    : rolling
KERNEL     : 
DEPOT      : /var/lib/pkg/depot
MOUNT      : 
SHELL      : /bin/bash
DEPOT_BASE : http://downloads.nutyx.org/x86_64/rolling/base
CHROOT     : nutyx busybox curl gcc bzip2 glibc zlib lz4 xz zstd \
libarchive openssl cards
CORE       : acl attr bash coreutils readline expat ncurses lzo gmp \
flex file gzip mpc mpfr grep sed findutils binutils inetutils diffutils \
shadow bc less libcap util-linux kmod kbd pam gdbm e2fsprogs libpipeline \
gettext procps-ng psmisc sudo tzdata iproute2 iana-etc groff man-db \
cards.man nutyx.man dialog cpio squashfs lsb-release grub eudev sysklogd \
sysvinit kernel efibootmgr linux-firmware systemd runyx wireless-tools \
wpa-supplicant gpm gpm.service dosfstools make-ca xdg-user-dirs \
sound-theme-freedesktop ntp ntp.service flcards gvfs network-manager-applet \
xorg-xinit xorg-xf86-input-synaptics xorg-xf86-input-wacom \
xorg-xf86-video-ati xorg-xf86-video-fbdev xorg-xf86-video-intel \
xorg-xf86-video-nouveau xorg-xf86-video-vesa xorg-xrandr xorg-setxkbmap \
firefox thunderbird gparted leafpad scrot vlc telegram gnome epiphany \
seahorse-nautilus evolution simple-scan gnome-weather gnome-chess balsa
DEVEL      : 
for k in $(ls /lib/modules/)
do
  mkinitramfs $k -nf
done
sed -i "s@kernel-419@$KERNEL@g" /sbin/setup-nutyx
cards purge
for d in opt bin etc lib lib64 root run sbin usr var home
do
  rm -f /ISO/boot/$d.squashfs
  mksquashfs /$d /ISO/boot/$d.squashfs
done
exit 0
ISO        : GNOME
STRICT     : kernel
MINI       : dhcpcd
BASE       : efibootmgr linux-firmware systemd runyx wireless-tools \
wpa-supplicant
CLI        : gpm gpm.service dosfstools make-ca xdg-user-dirs \
sound-theme-freedesktop ntp ntp.service
GUI        : flcards gvfs network-manager-applet
GUI_EXTRA  : firefox thunderbird gparted leafpad scrot vlc telegram
XORG       : xorg-xinit xorg-xf86-input-synaptics xorg-xf86-input-wacom \
xorg-xf86-video-ati xorg-xf86-video-fbdev xorg-xf86-video-intel \
xorg-xf86-video-nouveau xorg-xf86-video-vesa xorg-xrandr xorg-setxkbmap
GNOME_EXTRA: epiphany seahorse-nautilus evolution simple-scan \
gnome-weather gnome-chess balsa
KDE5_EXTRA : kdenlive k3b
JWM        : lxdm jwm
LXDE       : lxdm lxde
XFCE4      : lxdm xfce4 xfce4-extra
MATE       : lightdm mate
GNOME      : gnome
KDE5       : kde5
ISO Filename /mnt/hd/NuTyX_x86_64-21.03.0-rc4-GNOME.iso

As we can see, new variables are now available. These can also be redefined at your convenience:

STRICT, BASE, CLI, GUI, GUI_EXTRA, XORG, GNOME, GNOME_EXTRA, KDE5, KDE5_EXTRA, BUDGIE, CINNAMON, ENLIGHTENMENT, CDE, OPENBOX, JWM, LXDE, XFCE4, MATE.

Each variable specify a set of packages to be installed. Each ISO name use a set of thoses variables to build up the specified ISO. That means, by specifying your own set of packages for some or all of those variables, you will generate your very own ISO.

The table below shows which combination of each of thoses variables are used for each ISO.

Combinations of available variables for each ISO name:
STRICT STRICT
MINI STRICT + MINI
BASE STRICT + BASE
CLI STRICT + BASE + CLI
GUI STRICT + BASE + CLI + GUI
XORG STRICT + BASE + CLI + GUI + XORG
JWM STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + JWM
OPENBOX STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + OPENBOX
LXDE STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + LXDE
XFCE4 STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + XFCE4
MATE STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + MATE
CDE STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + CDE
ENLIGHTENMENT STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + ENLIGHTENMENT
CINNAMON STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + CINNAMON
BUDGIE STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + BUDGIE
GNOME STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + GNOME + GNOME_EXTRA
KDE5 STRICT + BASE + CLI + GUI + GUI_EXTRA + XORG + KDE5 + KDE5_EXTRA

A few examples

sudo ISO=KDE5 install-nutyx

install and produce a standard kde5 ISO in the /mnt/hd directory.

sudo \
ISO="lxde" \
XORG="xorg-xf86-input-synaptics" \
BASE="linux-firmware wireless-tools wpa-supplicant" \
GUI="xorg-xrandr" \
GUI_EXTRA="deadbeef geany firefox" \
DEVEL="&& setup-nutyx start && echo 'ready ?' && read a" \
CLI="dhcpcd openssh git cdrtools syslinux libisoburn dosfstools" \
LFS="/MyIso" \
DEPOT="/media/www" \
MOUNT="/media/www" \
install-nutyx

install and produce a customised lxde ISO. The BASE, CLI, GUI, XORG, GUI_EXTRA, DEVEL, LFS, MOUNT and DEPOT variables redefined.