Quick Start

From LFScript
Jump to: navigation, search

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

Before you run LFScript, make sure your system meets the Host System Requirements.

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.

Depending on your use of a Live CD, you should execute the commands from one of the following subsections:

Preparing the hard disk (if you use a Live CD)

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.


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, which is recommended if you are running low on memory:

mkswap /dev/sda3
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 (only if you don't use a Live CD)

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*

Important: Configure your kernel. If you don't, you may need to rebuild your kernel later.

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

Personal tools
LFScript Resources