Quick Start

From LFScript
Revision as of 20:49, 30 January 2012 by Marcel (talk | contribs)

This page will explain how to set up your computer so that you can run LFScript for the first time. It assumes that you have read Linux From Scratch at least once and that you know what LFScript is.

There also is a video tutorial available, which shows you exactly what happens when you execute the commands presented here.

Before you start

It is recommended that you use LFScript on a virtual machine like VirtualBox. This allows you to experiment freely without any risk that you destroy your host system. You can use the fsOS Live CD to boot the virtual machine.

System requirements

In addition to the system requirements set by Linux From Scratch, your host system needs to have wget installed if you want LFScript to download source code automatically. Having wget installed is highly recommended, because there could be several hundred files which must be downloaded.

It has been reported that the build of GCC will fail if you have less than 1 GigaByte of memory. LFScript will not run unless you have at least that amount of memory, or if you acknowledge that you have less by giving the -M switch to LFScript. You could try to set up SWAP space to overcome memory issues, but this may slow down the build.

Log in as the root user

LFScript requires root access (which is another great reason to build only in a virtual machine).

If you have not logged in as the root user (or if this is disabled on your host system), run the following command to become root:

su - root

On Ubuntu (and probably other systems where you can not log in as root), you may need sudo to become root:

sudo su - root

Preparing the host system

Building an OS from source requires a lot of free space. Luckily, modern computers come with very large hard disks. Running LFScript could require up to 20 GB of free disk space.

Preparing the hard disk (virtual machine only)

If you are running in a virtual machine as recommended, you need to partition and format your virtual hard disk first.

The cfdisk utility makes it easy to partition your hard disk.

cfdisk

If you want to install your system later, you need to reserve at least one extra partition for your new OS.

The page that explains the installation of your system assumes that you have created four partitions on your hard disk:

  • sda1 (Linux filesystem, Bootable) is where the root file system of your new OS will be.
  • sda2 (Linux filesystem) is where /usr will be mounted (optional).
  • sda3 (SWAP) will be used as SWAP space.
  • sda4 (Linux filesystem) is where we will run LFScript.

If you only want to build a Live CD of your system you will only need one partition though.

You can bring any SWAP space online immediately:

swapon /dev/sda3

Format and mount the partition you want to use for building your system:

mkdir /mnt/lfscript
mkfs.ext4 /dev/sda4
mount /dev/sda4 /mnt/lfscript
cd /mnt/lfscript

Choose a directory (non-virtual machine only)

Although it is started by root, LFScript will reduce it's privileges when it builds the temporary toolchain. For this reason, you must choose a directory which is accessible (and writable) by all users but has enough space to run LFScript.

You may choose to use a separate partition for this, but any directory will do.

mkdir /home/lfscript_tmp
cd /home/lfscript_tmp

Fetch and go!

One of the core features of LFScript is that it should be extremely easy to use.

Download the latest version:

wget lfscript.org/latest.tar.bz2
tar xf *.tar.bz2
cd lfscript4-revision*

You can now build your system using LFScript.

./lfscript -B

This is the most basic command you can give to LFScript. It instructs it to build the full basic system (LFS).

You can also instruct it to build extra packages, for example:

./lfscript -Bx "nano wget x-window-system"

That command would build LFS, nano, wget and everything it needs for the X Window System.

Important further reading