General notes on a lightweight Linux distribution

CRUX Linux

CRUX Linux is a lightweight linux distribution with a simple .tar.gz based package and ports system, and relatively simple initscripting. I chose to use this distribution on some of my virtual machines.


The most difficult part of a CRUX install is the kernel compilation. Beside this, everything should be easy.

Get the .iso from the official website or get an updated one from to save time on your updates.

First, you should create four paritions for {home,boot,fat,root} and mount the system on /mnt/. The next step is to launch the install script and enter chroot.

# setup
# setup-chroot

Essential Setups

Once you are in the mounted system, edit /etc/fstab to add you partition scheme without modifying the uncommented lines.

Edit /etc/rc.conf as you like. You should specify your timezone, keymap, and services there.

Generate your locales. Replace en_US with the locale you want like fr_FR or ja_JP.

# localedef -i en_US -f ISO-8859-1 en_US
# localedef -i en_US -f ISO-8859-1 en_US.ISO-8859-1
# localedef -i en_US -f UTF-8 en_US.UTF-8

Kernel Compilation

The hardest part of the installation. Go to /usr/src/linux, and launch the configuration menu. You should check the internet; maybe someone made a list of options for your setup. Gentoo users made published a lot of examples.

# make menuconfig

Save and leave the menu. Once you are back to the shell, you can compile the kernel, move it to the boot partition with its modules.

# make all
# make modules_install
# cp arch/x86/boot/bzImage /boot/vmlinuz
# cp /boot

Boot Options

If your machine is a BIOS system:
Edit /etc/lilo.conf and run lilo, or install grub and edit manually /boot/grub/grub.conf. grub-mkconfig is bad at generating a working configuration file.

# grub-install /dev/sdX

If your machine is a UEFI system: I don't know. I don't have a modern machine. But grub-mkconfig should work if you have efibootmgr installed.

User Creation

Change the root password, create a new user and add it to essential groups.

# passwd
# useradd -G audio,video,wheel -m -U $USER
# passwd $USER

Manage your users permissions with visudo.

Now you can exit and reboot your machine.

# exit
# shutdown -r now

Post Installation

Now, you have a basic CRUX Linux installation. But it misses some steps to be convenient.

Package Management

Create a user dedicated to package management.

# groupadd pkgmk
# useradd -m -g pkgmk pkgmk
# usermod -aG pkgmk $USER

Make sure you use fakeroot to build ports by adding the following line to /etc/prt-get.conf.

makecommand sudo -H -u pkgmk /usr/bin/fakeroot /usr/bin/pkgmk

Packages directories should be defined as such in /etc/prt-get.conf.


Create those directories and set their access permissions.

# chmod 775 /home/pkgmk/*

You can now enable the contrib repository and update your package database if you are conected to the internet.

# mv /etc/ports/contrib.rsync.inactive /etc/ports/contrib.rsync
# ports -u

Install fakeroot.

# prt-get install fakeroot
# cd /usr/ports/opt/fakeroot
# pkgmk -d -i
n.b. Use the last two commands if you are not connected to the internet.


User Ports

There official repository is not really big. You can add user repositories by editing /etc/prt-get.conf. Use CRUX's port database to find what you need. Just like the contrib repository, you have to get their .rsync or .httpup sync file, add it to the /etc/ports/ directory, and edit /etc/prt-get.conf like this.

# the following line enables the user maintained contrib collection
prtdir /usr/ports/contrib
prtdir /usr/port/$USER_CONTRIB

We placed the user contribued repository below the contrib one because prt-get will install the package from the repository placed higher in the configuration file. If you are absolutely sure about the package you want, you can change the order to install it.

Package it Yourself

This is true for most distribution: you can make it better if you contribute to the package manager.

Most of the time, it's an easy task. Update your package when you realize that you are behind some updates, you'll make this world a better place.

crux links

Questions or corrections: