Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
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.
Here is a procedure that I used to install the LFS 6.1 Live CD to my hard drive. Use it at your own risk. The installed size is about 1.6 GB. You can delete the /sources directory and a file in / named .root.sqfs (or something similar) and reduce the size to about 1.3 GB.
1. Prepare a partition on your hard drive for LFS Live CD installation. Or maybe you want to use the whole hard drive. Format and install the file system of your choice. I used ext3.
2. Also prepare a swap partition. I used a swap equal in size to my RAM.
3. Boot the LFS Live CD. Configure your network so that you can connect to the Internet.
4. Mount the partition you want for your LFS Live CD hard drive installation
on /mnt. I used the following command.
# mount /dev/hda4 /mnt
5. Copy the system to your mounted partition. I used the following procedure.
# tar -C / -l -cpvf - . | tar -C /mnt -xpf -
6. Download a kernel source tar ball from kernel.org and put it in /mnt/usr/src. I used kernel 126.96.36.199. Make sure the kernel is in /usr/src of your new system, not in /usr/src of the Live CD.
7. chroot into your new system.
# chroot /mnt
8. Install the LFS bootscripts. I used the following procedure.
# cp /sources/lfs-bootscripts-3.2.1.tar.bz2 /usr/src/
# cd /usr/src
# tar -xvjf lfs-bootscripts-3.2.1.tar.bz2
# cd lfs-bootscripts-3.2.1
# make install
9. Edit /etc/fstab. You need to delete references to union file system and add normal entries for a hard drive installation. The first two lines in my /etc/fstab are:
10. Install the new kernel. I used the following procedure.
# cd /usr/src
# tar -xvjf linux-188.8.131.52.tar.bz2
# cd linux-184.108.40.206
# make mrproper
# make menuconfig (Set all configuration options that you need or want.)
# make modules
# make modules_install
# cp arch/i386/boot/bzImage /boot/lfskernel-220.127.116.11
# cp System.map /boot/System.map-18.104.22.168
# cp .config /boot/config-22.214.171.124
11. Edit the bootloader of your choice for your new LFS Live CD system. I had another Linux system on my hard drive, so I added an entry to my existing /etc/lilo.conf as follows.
Neat tip. You should submit it as a hint to the LFS web site. I already finished my first LFS 6.1, but I'll definitely consider it the next time I do an LFS build. It was quite annoying having to find the CD every time I returned to the LFS build or listening to my loud CD drive spin up whenever I had to run something off the disk in another console while I was chroot'd in my LFS environment.
One question: why does the HD install require over 1 GB if the disk itself is only a couple hundred MB?
Why not? You should browse through the list of current hints to see how many there are that 'goes against the grain' of LFS, so to speak. I'm sure there are several people that would appreciate the hint. Though, as I'm sure you realize, that particular hint isn't likely to ever be officially supported by LFS or the LFS Livecd project.
Btw, the compression we get on the LiveCD is about 50%. Thanks to squashfs.
Also, your system ends up being more than double the size of the iso (approx 400Mb) because you are including the /proc and /sys filesystems in your dump. Those aren't necessary for the 'install' and take up a bunch of space when you dump them like that. You should find a way to skip those two directories in your dump.
I think that it would be a fine idea if the LFS (and BLFS) projects included that kind of information, if only as a last-resort step if you happen to really hose something up.
Also, the rsync command is very useful to look at. When used in strictly local mode (not involving the network... source and destination systems are the same) it is quite good at replicating things like symlinks and so-on which can confuse simpler commands. It's also clever at deciding what actually needs to be copied and what does not.
I agree that these instructions should be fleshed-out and published as an official document. It certainly has its place.
lilo...ick! That's one place where I've always completely-ignored the LFS instructions. grub is a much better boot-loader, imho. Easy to set up, a great deal smarter overall, and if you encounter a glitch at boot-time you can quite easily fix it without grabbing for that rescue-CD. The configuration files are ordinary text-files and there's none of this balderdash of having to execute the 'lilo' command...
Originally posted by shevegen I think this last information lacks, for either lilo or Grub, so that you can boot into
your hdd installed LFS.
The livecd has the sources for an LFS 6.1 build, you can just chroot into /mnt and build a copy of grub and install it.
This was a great hint, Jimbo, thanks. This is probably going to save my butt, as I've been trying to get an LFS 6.1 build to work for a little while now. I kept running into problem after problem, and it always came down to the fact that glibc does not compile properly if you compile it on a host that's running a 2.6.x kernel compiled with gcc 2.95 (which most distros still do). It took me forever to finally find a distro that worked, only to find it's glibc was too old and I had issues after a few of the temp tools were built. An LFS 6.1 makes a perfect host to build an LFS 6.1 on. It meets all the requirements AND for those few places where little things can creep into your build from the host...who cares? It's the same version!
Originally posted by jhuntwork Also, your system ends up being more than double the size of the iso (approx 400Mb) because you are including the /proc and /sys filesystems in your dump. Those aren't necessary for the 'install' and take up a bunch of space when you dump them like that. You should find a way to skip those two directories in your dump.
Actually, it doesn't because he's using the "-l" (which is replaced in the next version with --one-file-system), this limits it to the root fs. Mounted filesystems, including /proc and /sys, aren't done. The only drawback is I've found different versions of tar implement this more or less right, depending on which one you get. The latest on the CD seems to handle it right, though.
Originally posted by GoldCPUfish The problem is that You need to be root in order to run X windows. Also You don't need to compile The kernel, There is a file called "linux" on the cd and thats the kernal.
The reason that I compiled a kernel was to eliminate any Live CD specific stuff that might be in there. Maybe not necessary, but I wanted to be sure I had a "clean" hard drive installation.