Announcement

Collapse
No announcement yet.

How to Build Your Own Custom Linux Distro

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Build Your Own Custom Linux Distro

    Although most Linux users rely on pre-built Linux distros and customize their software configuration after installation, there is nothing quite like having a Linux distro that was custom-designed to your specifications. This allows you to get whatever you want out of the box, but in the past it was difficult to create such a distro since it involved compiling the entire operating system from source. (something firmly in the realm of advanced-to-expert-level users)

    In more recent years, it has become possible to create your own Linux distro through various easy-to-use online interfaces. The most well-known distro customization tool is Slax (which we recently discussed) but Novell has a tool called SuSE Studio in closed beta which allows you to assemble your own custom SuSE-based distro from pre-compiled packages. Right now, SuSE Studio is still invite-only since Novell gives you storage space on their servers and bandwidth to both store and download your creations.


    Read on to learn how we built our own Maximum PC-themed Linux distro!

    Planning the System

    Before you can create a distro, you must first plan what you are going to use it for. Our intention was to create a customized yet well-rounded desktop distro based on openSuSE 11. However, you also have the option of creating a desktop or server variant of OpenSuSE or SuSE Enterprise Linux for 32 or 64-bit x86 architecture. If you plan to redistribute your creation, you will need to use OpenSuSE as a base since SuSE Enterprise Linux is not free for download whereas OpenSuSE is. Redistribution also requires the removal of all SuSE-related artwork and branding as per the Novell requirements.

    *

    Many distros are meant to be one-size-fits-all and can be a little bit bloated since they must appeal to a wide audience. Since you know what you need better than anyone else, building your own distro gives you unparalleled opportunities to maximize efficiency. Ideally, Linux distros should be as small and compact as possible while still being feature-complete, so try to plan ahead and come up with an inventory of the exact software you are going to need. It often helps to get out some paper or a spreadsheet to make a list: break down the required software ecosystem for your distro into categories like development, Internet, multimedia, graphics, office, etc. and then populate each category with the programs you think you will need.

    When you go hiking, it pays to travel light since it is seldom worth it to carry a bunch of equipment you don't need over long distances. The same rule applies to distro planning. You should avoid including software that introduces redundant functionality; you don't need more than one desktop environment, raster editor, or office suite on your system. For instance, don't install both Openoffice.org and Koffice or both GNOME and KDE in the same distro.

    The only exception to the rule is with GUI vs. CLI utilities; you should make sure you have a CLI alternative for important utilities if applicable. For instance, you might choose a robust tool like Kate or Gedit as your primary text editor, but you should also include a CLI-friendly tool like Vim or Nano to fall back on during the times you may not have GUI functionality. Alternatively, you could also get away with just using Vim as your all-purpose text editor in both a GUI and CLI setting if you are so inclined. While it is possible to mix and match programs from both GNOME and KDE in SuSe Studio, this will inevitably create bloat because of the extra dependencies that will also have to be installed to make everything work.

    Building the Distro


    Now that planning is out of the way, we can get to the really fun part. The first step to building a custom distro with SuSE Studio is creating the base configuration. This includes choosing the core operating system, (various OpenSuSE or SuSE Enterprise Linux templates are available in preset desktop, server, and minimalistic configurations) the primary desktop environment, the primary system architecture, (x86 or x86-64) and the name of the distro. The core operating system doesn't include very much, just a kernel, desktop environment, and a few basic utilities. For our demonstration, we chose to create a 64-bit variant of OpenSuSE 11 that utilizes the GNOME desktop environment. We chose to call our creation “Maximum PC Linux.”


    Once the distro's base configuration has been created, you will be taken to the start page, which is the gateway to the rest of the tools you will need to create your distro. The next step is to configure your distro's software ecosystem. Although choosing a base configuration will already have added a bunch of software to your distro, you are still able to add any other individual programs you may want to use. This is where the list you should have made before starting this part of the process will come in handy.


    SuSE Studio automatically ties in the default repositories for your distro, so you will have full access to the same packages you would normally be able to work with through the package manager in conventional SuSe Enterprise Linux or OpenSuSE. You can also add additional repositories if the default ones do not have what you are looking for; SuSE studio will integrate them and make their packages available to you if the repository is valid. You also have the option of loading individual RPM files, useful for those rare times when you have no choice but to spoon-feed packages into the operating system.


    The package list in SuSE Studio is divided into several categories that will probably correspond to the categories on your preparation list: multimedia, graphics, office, etc. By browsing each category, you will be able to add additional programs to the project. Remember that while most software dependencies are handled automatically, this is not the case for system services; if you want sound to work you will need to add a sound engine like ALSA or PulseAudio. Likewise, you will also need to add any necessary codec packages for the various media frameworks (like Gstreamer or Xine) that most media players rely on.


    Of course, you (or your other users) could always install these packages after installation, but a primary incentive of using a custom distro is to have most services work out of the box. Unfortunately, US patent law and the DMCA prohibited us from including MP3 codecs or a DVD decrypter with Maximum PC Linux, even though we really wanted to. To get these types of media working, you will need to add the necessary plugins yourself. (you will need the Fluendo MP3 decoder for Gstreamer and the libdvdcss2 plugin; Fluendo can be acquired as an RPM here.

    Depending on the size of the installation media you are planning to use, be sure to keep an eye on the package count to prevent the distro footprint from getting too big. SuSE Studio estimates the current size of the distro for your convenience but keep in mind that the final image is slightly larger than the value provided during the software selection process because dependencies are not factored into the estimate. Therefore, if you want your distro to fit on a 700 MB CD, you should generally not exceed more than 610 MB of additional software packages although the actual safety margin will vary depending on what you install.

    After all the additional software you wanted has been added to the mix, you can customize the appearance and behavior of your distro by switching to the Configuration tab:

    General Settings


    General Settings allow you to set the default configuration of your location, time zone, firewall, and network settings. For Maximum PC Linux, we chose to have NetworkManager handle the network configuration since it allows far greater flexibility (such as the ability to choose between wired and wireless connections) than standard DHCP. If you go this route, be sure to include the NetworkManager package and the appropriate frontend for NetworkManager that would allow it to interface with your desktop environment. We also configured the firewall to allow inbound SSH through port 22. If you do not need or want remote access functionality, be sure to disable it when you build your custom distro.


    Personalization


    The Personalize tab allows you to choose a logo and wallpaper for your distro. The wallpaper image is especially prominent, since it is also shown during the boot process and is a great way to brand your custom distro to make it truly yours. The default settings are rather limited and are identical to what can be found in generic OpenSuSE. We took this opportunity to customize Maximum PC Linux with one of the official Maximum PC wallpaper images. The logo functionality allows you to use the SuSE iguana symbol, a generic Tux image, a custom image, or no logo at all.



    *

    Startup


    The Startup tab allows you to choose the default runlevel of your distro. The default level is set to graphical login; you should leave this alone unless you know what you are doing and don't want the GUI to start automatically at boot. You should know that the runlevel settings in this section correspond with the general Linux runlevels, some of which do not feature a GUI and/or disallow networking. The Startup section also allows you to define a EULA for your distro. Since the LiveCD installation utility built into the distro will complain (but will still work) if there is no EULA, it is advisable to use something generic if you do not have your own special licensing terms.


    Server


    The Server tab allows you to configure specific services (like MySQL) that would normally run in a server-type environment. If you choose to build a desktop distro, you will typically not need to enable any services.


    Desktop


    The Desktop tab allows you to further configure runtime options like automated login and automated startup programs. Since a typical SuSe Studio desktop distro is automatically set up to be a LiveCD, it helps to enable automated login since security is not as important in that situation. If you choose to install the distro, you will be able to set up a more secure environment at that time.


    Storage and Memory


    The Storage and Memory tab allows you to declare virtual memory allocation if your distro is going to be a VMware or Xen image. If you plan to create a conventional ISO image, you do not need to make any changes in this section.

    *

    Scripts


    The scripts section allows you to create and run a shell script at the end of the SuSE Studio build process or at the distro's boot time. Most SuSE Studio projects will work properly without additional scripting, so you should generally leave this feature alone unless you know what you are doing.


    Putting Everything Together

    Once you have configured your distro to be the way you want it, SuSE studio must assemble everything before it will work. This is not a compile process (like Gentoo and similar distros would be) but is instead a very elegant assembly and configuration process where all individual packages you have chosen are brought together and configured to work with each other. You have the option of creating an ISO image for an installation CD, Vmware/Virtualbox hard disk image, (which you can then plug into a new virtual machine) Xen image, or a generic disk image you can clone onto a USB stick or hard drive.


    To start this process, switch to the build tab, choose the format you want your distro to be created in, set the version, and then click the Build button. After that, all you have to do is relax and wait as SuSE Studio does all the hard work behind the scenes and creates your custom distro for you based on your specifications. Depending on the size and complexity of your distro, the build process can take awhile; creating a 700 MB build of Maximum PC Linux took about 24 minutes on average.

    The versioning feature is very important since it can take several adjustments (each requiring a separate build) to get everything working properly. To facilitate easy debugging, SuSE Studio has an incredibly useful tool called TestDrive, which is essentially an Adobe Flash-based virtualization tool. Using TestDrive, you can run your distro in an hour-long test session without having to download it. However, truly comprehensive testing and debugging often requires you to download and run the distro on a virtual machine or a real test system.


    Once the build is finished, you can download your distro. SuSE Studio will save your builds for about a week, after which they may be deleted to free up space for other users. (however, you can always re-build them later if you have to)

    SuSE Studio generally worked well for us, (all programs we chose worked properly) but there were some minor problems. On the first build, we did not expect to have to manually add packages like ALSA to get sound support, so it took more debugging than we initally anticipated to get everything working. Although using SuSE Studio is far easier than manually configuring a distro from scratch, it is still not something you are able to breeze through in five minutes without careful planning and a fairly good knowledge of Linux systems.


    Also, the builds that SuSE Studio produces have problems with auto-mounting media; after plugging in a USB flash drive, nothing would happen so we had to mount those devices manually through the console. (after which they worked perfectly) We tried installing udev and any other package we could find that dealt with USB devices, but no solution presented itself. Since we concluded that this problem is caused by the HAL (hardware abstraction layer) not properly recognizing new media, we feel that this (and other essential stuff like sound support) is something that should be automatically set up in the base configuration instead of being something that users should be expected to figure out for themselves.



    More...
    ClanofIdiots.com Administrator
    PcGamingNetworks.com Co-owner
    webmaster@clanofidiots.com
Working...
X