How to Create a Custom Arch Linux Distro

Oct 26, 2011 10:17 PM

Having a custom Linux distro can be the coolest thing ever. Most of you will probably be satisfied with any particular Linux distribution, but I know I'm not the only one out there who wants it to have custom configurations and programs preloaded while leaving the bloatware behind.

The good thing? A custom distro doesn't have to be a fantasy. Linux is based on open-source software and user-contributed content, so setting up your own version isn't all that hard. The hardest part is getting started, because it's hard to find the exact details on the internet.

That's what this Null Byte is here for! We're going to create a custom, live Arch Linux CD that can have all of your personal configurations and software pre-installed.

Requirements

  • An installed version of Arch Linux on the computer that you're making this on.
  • 10GB of drive space (just to be safe).
  • A blank CD or DVD (depending on the size of the finished disc).
  • Root privileges on the computer.

Commands for the terminal are written in bold.

Create a Chroot Base System

First off, we need to create what is know as a chroot. A chroot is a root Linux file system within another. So by creating one, we can put ourselves inside our OS-in-progress and paint the house from the inside, so to speak.

  1. Download the necessary tools:

    su && pacman -S devtools git make --needed
  2. Create a chroot with base-packages:

    mkarchroot /tmp/chroot base
  3. Clone the Archiso package:

    git clone git://projects.archlinux.org/archiso.git
  4. Compile Archiso to your chroot:

    make -C archiso/archiso DESTDIR=/tmp/chroot install
  5. Enter our chroot:

    mkarchroot -r bash /tmp/chroot

Customize the ISO & Packages

Now we are going to customize the OS from the inside out. We can customize the whole OS from here, but we are going to go over packages, configuration files, and a window manager.

  1. Create a loopback interface:

    mknod /dev/loop0 b 7 0
  2. Configure a server to download packes from, this one is the most up-to-date:

    echo 'Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/x86_64' >> /etc/pacman.d/mirrorlist
  3. Let's download any packages we want! Here are the required ones:

    pacman -S devtools libisoburn squashfs-tools

I would recommend installing the following packages for the average user.

  • leafpad
  • abiword
  • zathura
  • firefox
  • xorg
  • smplayer
  • audacious
  • gimp
  • kde-base

With this list of packages, you will have a few graphical tools as well as a graphical user interface on the disc already.

Next, we can create our user and change any configuration files that we want. Some common files I like to change are:

  • .bashrc
  • /boot/grub/menu.lst
  • /etc/rc.conf
  • /etc/hosts/allow

It's incredibly convenient to have all of your custom settings out of the box. You can't do that with Windows!

Build the ISO

After you have done all the customizing you desire, we can build the ISO for burning.

  1. cp -r /usr/share/archiso/configs/baseline /tmp
  2. cd /tmp/baseline
  3. ./build.sh
  4. exit

Now, you will be out of your chroot, with the built ISO at the file path of:

/tmp/chroot/tmp/baseline/out/

Congratulations! You now have your own custom live media! Bring any questions and interesting conversations over with you to the Null Byte IRC!

Image by morlockonzark

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

Comments

No Comments Exist

Be the first, drop a comment!