Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
By Anonymo at 2006-02-23 14:01
This guide was originally written by LQ member Ninja Cow. He has kindly given his permission for us to post it up here.
Welcome to Cooking Up Some Slack. (CUSS)
Go ahead and CUSS. Your mother will never know. :)
-Introduction: "What is CUSS?", "Advanced or Newbie", "What You Will Need".
-Modifying Scripts, Part I: initrd.img
-Modifying Scripts, Part II: tagfiles
-Modifying Scripts, Part III: setpkg
-Modifying Scripts, Part IV: message.txt
-Editing Files For Fun: Revisiting initrd.img
-Obtaining And Adding Software: Making Your Distro Unique
-ISO Creation: Breathe Life Into Your Distribution
-Contact: Drop me a line.
What is CUSS?
Cooking Up Some Slack (or CUSS) is a website that explains how to make your own Slackware-based distribution. Have you ever wanted to make your own custom Slackware distro? Want to add specific programs to Slackware? Remove programs? We will teach you how, step by step.
Advanced or Newbie?
I will assume you have had previous experience with Slackware Linux. If you're not very familiar with Slackware I suggest you read the Slackware Essentials book. Take a day or two and read it once or twice.
What You Will Need
1). You will need a working Slackware setup. Editing the configuration files will come easier if you're already running Slackware. Also, creating a new partition for testing your new distro is recommended (but not necessarily needed.)
2). If you don't have Slackware already installed, you can always use something like UltraISO for Windows to create the ISO for your distribution.
3). The latest Slackware distro, Slackware 10.0 or current. Find a Slackware mirror and download all of the files in /slackware or /Slackware-10.0. Please note that you do not need /source, /extra, /testing, or /zipslack.
Modifying Scripts, Part I: initrd.img
If you want to make your own, custom Slack distro, you will need to modify a few scripts. Well, depending on what you want, you might be editing several scripts. In any case, we will start out with modifying the initrd.img you download in /slackware or /slackware-10.0. Go ahead and look in /slackware/isolinux. There are several files here worth looking over, but for now we're only concerned with the initrd.img.
Copy the initrd to another directory, but add a "gz" extension.
Now, cd into the directory where you put your extra initrd. Gunzip the initrd like so:
Now you should have your initrd.img back again, ready to mount. In order for us to edit any files within initrd, we must mount it like so:
mount -o loop initrd.img /mnt/your-mount-point
Again, we will change our directory:
...You can find your scripts in:
Note: You know, pico is an easy text editor suitable for everyone. Try editing one of your install scripts using pico.
For now, you will need to configure these files on your own. In the future, CUSS will add a section for these files. Most of the scripts won't "need" to be edited anyway. Editing these scripts are optional.
Modifying Scripts, Part II: tagfiles
Moving on to what I think is the "fun" part of all this: Editing tagfiles. This allows you to add your own software to your distro.
Look inside of your /slackware (or /slackware-10.0) folders. See another "slackware" directory? This directory holds all of the software, documentation, and kernel. Vital? Yes. Everything in here is the backbone of your distro. You will find yourself in this directory often, so familiarize yourself with the directories and software.
Take a gander at the directory /a and find its tagfile. Please, please, PLEASE read the notes at the very beginning. You'll learn how to control the software you install. For example, it will teach you how to make software optional or required.
After you read the notes, let's look at the first four files that are installed during the Slackware installation process.
You should know that the first two files are required during the installation process, while the last two are recommended.
Okay, so you know the basics of a tagfile. How will this benefit you? Well, now you can actually add software to your distro!
You can choose any directory (/a, /ap, /x, etc.) to place your software in. Furthermore, you can also make your own directories. More on that later.
Let's say you want to add the best damn browser ever dreamed up to your distro. Straight from LinuxPackages.net, we will download mozillafirefox-1.0-i686-1jim.
After you move this software to the desired directory, we will need to edit the tagfile in said directory. Remember how I mentioned pico earlier? Let's use it.
Now insert something like this in your tagfile:
Using the first part of the filename in your tagfile is needed. Tinker around with the tagfile options a bit. You will be customizing your own distro in no time at all. Later on in this guide I will explain exactly how to choose, find, or compile your own software for use in your distro. For now, let's move on to the setpkg script...
Modifying Scripts, Part III: setpkg
Remember when I told you earlier that there are several scripts in /slackware/isolinux that can be edited? Well, this time we're going to be editing a file called "setpkg". This file will present the user the option to select different directories containing software as well as letting you add your own directories. Change directory to /slackware/isoliux and open up setpkg.
Find the first four directories along with their descriptions. It should look like this:
"A" "Base Linux system" on "The A (base) series contains the kernel and main system utilities." \
"AP" "Various Applications that do not need X" on "The AP series is a collection of useful applications." \
"D" "Program Development (C, C++, Lisp, Perl, etc.)" on "The D series contains compilers, debuggers, and other programming tools." \
"E" "GNU Emacs" on "The E series contains the GNU Emacs advanced real-time display editor." \
To be honest, this isn't too hard to understand setpkg's structure. All you do is add your own directory to the /slackware/slackware directory then edit setpkg to correspond with your newly created directory.
An example would be something like this:
I created /z in /slackware/slackware and now I need to edit setpkg to reflect this. /z contains my extra packages for Slackware.
Adding this line to setpkg will allow users to select/deselect this directory if they desire.
"Z" "Extra Packages" on "The Z series contains extra packages for my custom Slackware distribution. " \
Remember, you can also remove lines and directories to free up space on your distro. You're not limited to just adding software -- you can remove it as well.
Modifying Scripts, Part IV: message.txt
This section is fairly small since you're only creating a welcome message. Once again, if you look in /slackware/isolinux, you will find yet another file we can configure. Find "message.txt" and open it with pico.
Of course, you can edit this file to whatever you want. You may wish to add your distro's name. "Bob's Uber Cool Slackware Distro". Okay, that name may suck, but at least you know which file to edit when adding a welcome message!
Editing Files For Fun: Revisiting initrd.img
Yes, we're revisiting the initrd.img once again. If you have yet to read the first section, "Modifying Scripts, Part I (initrd.img)", do so now. It contains the information you will need to actually edit the files within the initrd.
Remember, you do not *need* to edit these files. You can create a working distro without touching any file in here. But hey, some folks may prefer to edit every file possible to further customize their distro.
Let's take a look at the "setup" script. This file contains the Slackware Installer's setup functions. Change directory to /mnt/yourmountpoint/usr/lib/setup. Pico time.
You know the drill:
Does anything look familiar? It should, since this is what you see when you install Slackware. Well... kind of. You don't see the actual functions or code. Anything can be edited in this file, so play around a bit.
Here's what I edited first. Find this section and let's edit some things.
dialog --title "Slackware Linux Setup (version 10.0)" \
"Welcome to Slackware Linux Setup.\n\
Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\
Alternate keys may also be used: '+', '-', and TAB." 18 72 9 \
"HELP" "Read the Slackware Setup HELP file" \
"KEYMAP" "Remap your keyboard if you're not using a US one" \
"ADDSWAP" "Set up your swap partition(s)" \
"TARGET" "Set up your target partitions" \
"SOURCE" "Select source media" \
"SELECT" "Select categories of software to install" \
"INSTALL" "Install selected software" \
"CONFIGURE" "Reconfigure your Linux system" \
"EXIT" "Exit Slackware Linux Setup" 2> $TMP/hdset
You can input your own text for just about everything here. Adding your distro's name within the installer might be a good idea...
We change this:
dialog --title "Slackware Linux Setup (version 10.0)" \
"Welcome to Slackware Linux Setup.\n\
--title "Bob's Good Ole Setup" \
Welcome to Bob's Linux Setup.\n\
Very simple, yes. Meaningful? Not really. Fun? Yes, as you can edit the file anyway you like. This goes for most of the files here -- try opening SeTpasswd and editing the message in the file. The best way to learn here is looking over each file very carefully. I could continue on with each file, but I already sound repetitive enough.
Word of warning: If you want to edit the actual code of each file, make sure you know what you're doing. Honestly, there isn't a reason to edit the structure of the Slackware Installer since it's perfect (in my humble opinion.)
After editing the files in initrd.img, you will need to move or copy the file back to /slackware/isolinux.
mv initrd.img /path/to/slackware/isolinux
cp initrd.img /path/to/slackware/isolinux
Now that you're done editing your initrd, let's move on to adding software to your custom distro.
Obtaining And Adding Software: Making Your Distro Unique
Earlier when we covered tagfiles I explained how to add software. In this section I will show you how you can obtain slackpacks. Slackpacks are already-built software packages, much like RPM or DEB packages without the dependency hell. I'll also explain how you can create your own slackpacks by compiling software. Using a program called "checkinstall" will make your Slack-life a lot easier.
The easiest way to obtain software for your custom Slackware distro is using a site called Linux Packages. Linux Packages has a wealth of slackpacks, submitted by several members of the Slackware community.
Just a word of advice: You should always get permission before you snatch up slackpacks. Those packages were compiled by someone else on someone else's time. E-mailing LinuxPackages.net and asking for their approval would indeed be a wise choice.
You could also offer to place their address in your welcome message. (See Modifying Scripts, Part IV (message.txt) Something like "Extra packages are provided by www.LinuxPackages.net" wouldn't hurt!
You may prefer to compile your own packages. While it's definitely more time consuming compiling your own packages rather than adding pre-built packages, in the end you will not need to give credit to any person except Pat. You will need checkinstall to create your slackpacks after you compile your software, so go ahead and download checkinstall from LinuxPackages.net.
Keep in mind that you should also add a description of the software in a txt file named AFTER said software. For example, if you look in /slackware/slackware/xap, you will notice that each file has a txt with the same name. Open up Mozilla's description.
mozilla: mozilla (an open-source web browser)
mozilla: The Mozilla web browser. Mozilla is a cousin to Netscape
mozilla: Communicator that is being developed by the Free Software Community
mozilla: with the cooperation and support of Netscape. Mozilla uses a next-
mozilla: generation browser engine known as Gecko.
You should always use this format when adding new software. Simplified, it comes down to this after configuring your tagfile(s):
1). Add the software to the specific directory.
2). Add a a txt file (a description) of the software in the same directory of the software you just added.
Truly simple, yes?
ISO Creation: Breathe Life Into Your Distribution
We've configured our scripts, added software, and now we're ready to make our Slackware ISO. Probably the easiest step in the whole process, you will create the ISO at the command line.
Enter your /slackware directory. (You should see the first five folders: bootdisks, isolinux, kernels, rootdisks, and slackware.)
At the command line, use this command to create your ISO: