How do I make my own Linux distribution?

I use Arch Linux, and a vanilla installation starts out with nothing but a terminal and some basic utilities. Everything beyond that is installed and configured by me.

So I would like to configure my OS how I like, and then wrap it up with some kind of installer so that I can put it on a disk and install it on any machine I want (not just the machine I configured it on – or else I would just make a disk image). If other people would like a copy, that’s great. But mostly I’d just like to have it for myself. It doesn’t have to be a live disk, although that might be nice.

I understand it will probably be kind of difficult, but I’m a technically oriented person and I think it would be fun to figure out. So don’t point me to something like Archbang which is a slightly more fleshed out version of Arch. I want to do it myself.

Where do I start?

A good resource for a starting point is Linux From Scratch. It’s basically a “how to build linux from bare silicon and source code”, which isn’t quite “build your own distro”, but it’s as close as I’ve seen.

I’ve been meaning to try LFS for a while now. Mainly I’m just worried about not having a package manager.

But what I’m really looking for is a way to package it up and add an installer. Basically an easy deployment mechanism for a preconfigured OS that works on any, or at least most, consumer hardware.

For example, the way Crunchbang and Ubuntu are both based on Debian. And Archbang based on Arch. I’d like to make an “Arch my way” installer CD that I could use for any future computer I buy and maybe hand out to my friends.

Nothing is stopping you from using Arch pacman for your own distribution. It is released under the GPL.

Install it on VirtualBox, export the image, and then on any other machines you install VirtualBox and import your image. You’ll probably want to settle for 32-bit, for portability, but you could also do two versions.

Crunchbang has a little script for installing stuff after the basic install. Open Office for instance.

That script should be in archbang too; I think it actually came out of that community.

Working off that, you could install stuff on a very basic system. As you grow in complexity, craft a python script lay out a gui to handle that. Et viola, you have an installer.

This is close, but it leaves you being stuck virtualizing the OS, which may not be what you want.

If you want to install it natively, just do a basic installation with all vanilla drivers onto a separate partition of your hard drive, then make a disk image with something like Clonezilla. Yes, this means you’ll have to install drivers for items if you want to use anything other than the universal ones, but you’d pretty much have to do that anyways, as you are using a different computer. You could always script that part of it, and even set up the script to autorun after installation.

Heck, you could probably clone your existing partition, make some tweaks to get back to vanilla/universal drivers, and be good.

Now, if you want to be able to boot from USB or CD/DVD, that adds an extra level of complexity–CD/DVD moreso than USB, as you can tweak a hard drive installation to work perfectly with USB, but need to look into making a Live CD/DVD version.