Installing Gentoo Using Packages on the liveDVD
1.
Overview
Synopsis
Warning:
Installing Gentoo from the liveDVD is a bad thing to do.
|
- takes more sysadmin time than a normal install and less CPU time.
- misses out practicing the skills needed to maintain a living Gentoo install
- the update to todays gentoo will carried out it will be on a live system full of user data
- provides a gentoo install as it was when at the date of the portage snapshot for the DVD
The preferred method of installing gentoo is to use a stage3 tarball and a liveCD following the Gentoo Handbook.
Any liveCD will do, including the Gentoo liveDVDs.
Second choice is a stage3 install supported by Sneakernet. This differes only in that things are fetched from the internet using a remote
system or another operating system (or both) and loaded into the growing install manually. Portage still builds everything.
The use of sneakernet is described elsewhere.
Important: Unpicking the LiveDVD as described here is a very poor third choice |
Alright, perhaps its not quite that bad. Before you proceed understand that Gentoo usies a 'rolling release' model. The mirrors update
every 30 mintes. When you install the binaries from the liveDVD you get a Gentoo system from some time in the past. Look at the file
/usr/portage/metadata/timestamp to see when the portage tree and therefore the packages were current. Understand that the further
'time now' is from that date and time, the harder it will be to update your system to todays Gentoo.
Understand too that you don't get to choose your USE flags and compiler options, they were set by the liveDVD team.
If you want to have control over your install, do the normal stage3 Gentoo install.
You can rebuild everything from the sources later. If thats your plan, its faster to do the normal 'handbook' Gentoo Install
The liveDVD provides a Gentoo testing install. Thats the price of giving up your choice and using the binaries provided by the
DVD.
Still reading ... don't say you were never warned. The usual caveat applies, if it breaks, you can keep the pieces.
Overview
The steps are:-
- partition the target drive following the handbook
- quickpkg all of the packages on the liveDVD indo the new installs /usr/portage/packagess
- use tar to unpack enough so that a chroot is vialble
- use emerge @system -eK to install the system set from the binary packages
- use emerge @world -K to install the world set
- Install a kernel ... may not be included on the DVD
- configure grub
- review and edit configuraooin settins
- reboot to test
Space Requirements
- /boot 32Mb
- <swap> 512 Mb
- /usr/portage/packages is just less than 4G
Still nothing is installed. /usr/portage/packages can be deleted when the install is complete.
- With the system set installed, 332 packages, 5.2G are used
- With the world set installed 1602 packages, 12.0G are used
The 4G from /usr/portage/packages can be recovered, so 12G is an absolute minimum for the install.
Introduction
This document describes how to install Gentoo using the packages provided on the 2011, 11.1-r5 liveDVD. If you have a copy of the 10.0 Live DVD throw it away.
Extra steps are required with the 11.0 DVD as some required packages were omitted. This document does not include these extra steps.
Instrucrions for installing from the 10.0 DVD are still around but this document won't work with that DVD. The 2011 DVD provides aufs, which makes the DVD
apear to be read write, even though its not really, so we don't need any temporary read write space of our own.
Access to the Gentoo Handbook is required as this guide makes frequent references to it,
there is no point in repeating the handbook here.
2.
Getting Started
Partitioning and Making Filesystems
Boot the 11.1-r5 liveDVD. A GUI is not required as all the commands given below need to be entered in a root shell.
This document was develped and timing information provied from a 2 CPU 2G RAM Virtualbox Instance hosted on a Phenom II 1090 X6 at 3.2G with 16G RAM.
Follow the Gentoo Handbook, Chapters 1 to 4. Do not carry out Chapter 5
Follow the rest of this chaper instead
3.
Installing The Portage Snapshot
Run the terminal program from the Favourites menu
Code Listing 3.1: Open a terminal for the root user |
sudo su -
|
As the install is being accomplised without using a stage3 tarball, the normal directory structure it provides is missing from
/mnt/gentoo. This guide makes the directories as needed.
Code Listing 3.2: Making the installs /usr directory |
mkdir /mnt/gentoo/usr
|
As the liveCD provides its portage tree, we can just copy it.
Code Listing 3.3: Copying the portage tree |
cp -a /usr/portage /mnt/gentoo/usr
|
Thats the correct version of the portage tree in place.
Important: You must not emerge --sync or the tree will not match the binaries then the quickpkg and emerge -K steps will fail |
The liveDVD also uses its own local overlay which is located in /usr/local/portage so copy that too.
Ebuilds and profiles here will take precendence over those in the main portage tree
Code Listing 3.4: Copy the local overlay |
mkdir /mnt/gentoo/usr/local
cp -a /usr/local/portage /mnt/gentoo/usr/local
|
4.
Preparing the Chroot
make.conf in the install
We need to edit the /etc/make.conf file on the DVD so that we can use quickpkg to save binary tarballs into our budding install.
We also need to copy some files from /etc into our install can eventuially chroot into the install.
Before /etc/make.conf is changed, copy it to the install, along with a few other things that are normally provided by the stage3
Code Listing 4.1: Copying /etc/make.conf |
mkdir /mnt/gentoo/etc
cp /etc/make.conf /mnt/gentoo/etc/make.conf
cp /etc/group /mnt/gentoo/etc/group
cp /etc/passwd /mnt/gentoo/passwd
cp /etc/shadow /mnt/gentoo/shadow
cp /etc/profile /mnt/gentoo/etc/profile
cp /etc/fstab /mnt/gentoo/etc/fstab
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
cp /etc/locale.gen /mnt/gentoo/etc/locale.gen
cp -a /etc/portage /mnt/gentoo/etc
|
edit /mnt/gentoo/etc/locale.gen to include only the locales you need. The default is to build all locales.
Instructions are in the comments in the file
Code Listing 4.2: Edit /mnt/gentoo/etc/locale.gen |
nano -w /mnt/gentoo/etc/locale.gen
|
Make mountpoints for special filesystems and other directories that would have been provided by the stage 3.
Code Listing 4.3: Making mount points for special filesystems |
mkdir /mnt/gentoo/dev
mkdir /mnt/gentoo/proc
mkdir /mnt/gentoo/home
mkdir /mnt/gentoo/var
mkdir /mnt/gentoo/var/log
|
Copy layman and world to the chroot
Code Listing 4.4: Copying Layman and world |
cp -a /var/lib/layman /mnt/gentoo/var/lib
cp -a /var/lib/portage /mnt/gentoo/var/lib
|
To make the liveCD use the portage tree in the budding intall, a few portage defaults must be changed in the liveCD make.conf
Warning: This change will drop out at any reboot as it is made in the liveDVDs root in RAM filesystem |
So that quickpkg puts it output in our install add the following three lines to /etc/make.conf, using
Code Listing 4.5: Edit /etc/make.conf |
nano -w /etc/make.conf
PORTDIR="/mnt/gentoo/usr/portage"
PKGDIR="/mnt/gentoo/usr/portage/packages"
PORTAGE_TMPDIR="/mnt/gentoo/var/tmp"
|
These entries are not required when quickpkg is complete
Setting the chroot /var
Portage needs some workspace in the chroot with a special mode set.
Code Listing 4.6: Making Portage Workspace |
mkdir -p /mnt/gentoo/var/tmp
chmod 1777 /mnt/gentoo/var/tmp
|
The chroot needs its own copy of /var/db
Code Listing 4.7 |
mkdir /mnt/gentoo/var/db
cp -a /var/db/* /mnt/gentoo/var/db
|
With all that in place quickpkg should work and depost its output in the install, so its time for a few tests.
If the following tests fail, fix things before proceeding.
Code Listing 4.8: Testing the new settings |
quickpkg --include-config=y gcc
|
This makes a portage binary package of gcc complete with all the config files - even ones that contain security information.
There must be no error messages from quickpkg and the output package file will be shown by
Code Listing 4.9: Testing quickpkg |
ls /mnt/gentoo/usr/portage/packages/sys-devel
|
as gcc-4.5.2.tbz2, which is the version used to build the liveDVD.
Provided that the above tests passed, the system is set up to quickpkg the whole DVD ... it will take a while.
About 105 minutes in a VMWare virual machine on my AMD 1090 Phenom II X6 at 3.2GHz, with the VM allowed two cores
Readers with multiplte real cores may like to use pbzip2 in place of bzip2. pbzip2 is a multi threading version of bzip2.
This is harmless on a single core CPU
Code Listing 4.10: Using pbzip2 in place of bzip |
mv /bin/bzip2 /bin/bzip2_single
ln -s /usr/bin/pbzip2 /bin/bzip2
|
Warning: The next step must be run in one go - it will restart from the beginning if its interrupted |
Code Listing 4.11: quickpkg the whole DVD |
while read pkg; do (quickpkg --include-config=y "${pkg}"); done < <(qlist -CI)
|
Important: The --include-config flag makes quickpkg save configuration information from the live system - Including Security Information |
This is a good time for a break if you need to do the install in two goes. To contine, Mount the filesystems and do the normal chroot steps.
Recap - Whats in the install so far
The portage tree exists, the local overlay exists, make.conf exists, the security files exit, the /etc/portage that the liveDVD was built with exists
and so do all the packages from the liveDVD in a binary form that emerge can use.
Various odds and ends required to be able to chroot are still missing but all the bits are in /mnt/gentoo/portage/packages somewhere
Looking forward, lets cheat a little - unpack suffcient to chroot and use emerge -k but no more. Thats almost like stage1 install but there are some important differences.
emerge cannot be used until we are in the chroot and the chroot does not exist until we unpack some things there. Its a little chicken and egg. However,
the binary packages are tarballs with extra data appended. They can be unpacked with tar, provided we ignore the warning about extra garbage at end ignored.
5.
Chrooting
Making the chroot
Code Listing 5.1: Setting make.profile |
cd /mnt/gentoo/etc
ln -s ../usr/portage/profiles/default/linux/amd64/10.0/desktop make.profile
|
Having made the packages we need, making the chroot is only a question of untaring them there. We will need
glibc (everything uses that) bash, portage and python at the very least.
Make friends with tab completion before you attempt the following. Type a few letters of a path name and press tab.
If the fragment is ambiguious, the alternatives will be shown. Type a few more letters and press tab again.
Important: Version numbers will vary with different liveDVDs and are not a cause for concern - tab completion will find the only version provided |
Code Listing 5.2: Unpacking some key tarballs |
cd /mnt/gentoo/usr/portage/packages
tar xpf app-shells/bash-4.0_p28.tbz2 -C /mnt/gentoo
tar xpf dev-lang/python-2.6.2-r1.tbz2 -C /mnt/gentoo
tar xpf dev-lang/python-3
tar xpf sys-libs/glibc-2.9_p20081201-r2.tbz2 -C /mnt/gentoo
tar xpf sys-libs/ncurses-5.6-r2.tbz2 -C /mnt/gentoo
tar xpf sys-libs/zlib-1.2.3-r1.tbz2 -C /mnt/gentoo
tar xpf app-arch/bzip2-1.05-r1.tbz2 -C /mnt/gentoo
tar xpf app-arch/tar-1.20.tbz2 -C /mnt/gentoo
tar xpf sys-apps/portage-2.1.6.13.tbz2 -C /mnt/gentoo
tar xpf sys-apps/coreutils-7.4.tbz2 -C /mnt/gentoo
tar xpf sys-apps/findutils -C /mnt/gentoo
tar xpf sys-apps/acl-2.2.47.tbz2 -C /mnt/gentoo
tar xpf sys-apps/sed-4.2.tbz2 -C /mnt/gentoo
tar xpf sys-apps/attr-2.4.43.tbz2 -C /mnt/gentoo
tar xpf app-admin/eselect-python -C /mnt/gentoo
tar xpf app-admin/eselect -C /mnt/gentoo
sandbox ?
gcc and gcc-config ?
needs /var/cache/edb/counter ?
speedup pbzip2 for multicore ?
|
Mount /proc and /dev inside the chroot
Code Listing 5.3: Mounting Special Filesystems |
mount -o bind /dev/ /mnt/gentoo/dev
mount -t proc proc /mnt/gentoo/proc
|
Entering the chroot
Code Listing 5.4: Entering the chroot |
chroot /mnt/gentoo /bin/bash
|
Python is not set up in the chroot yet. Almost everything we want uses it, so fix that right now
Code Listing 5.5: Selecting Python |
eselect python set 2
eselect python list
|
Verify that python 2.7 is selected - the active python has the blue * after its name. Python is needed to set the chroot environment
Set the profile from inside the chroot
Code Listing 5.6: Setting the chroot environment |
env-update
source /etc/profile
export PS1="(chroot) $PS1"
|
Things to fix or document more thorougly
set /etc/timezone
Important: --oneshot so the package is not added to the world set |
Important: -K == --usepkgonly use binary packages only, do not attempt to build any packages |
Code Listing 5.7: emerging system |
emerge -Keav --oneshot --keep-going @system
|
takes 75 min and needs gcc to be configured
A few things failed as gcc was not configured, configure gcc and reru n ett s
ep
Code Listing 5.8: |
gcc-config 1
source /etc/profile
|
This actually installs a lot more than just the system set. It installs 331 packages in all.
Our minimal chroot could be better so some packages may fail to install, we will get them next time round
On the liveDVD the system set (@system) is not included in the world (@world) set, so emerging @wotld does not automatically update @system.
Explicit dependencies from packages in @world will update individual packages in @system. We need to ensure we get it all, so run the above command again,
this time without --keep-going. It should not stop for any errors
Code Listing 5.9: emerging system |
emerge -Keav --oneshot @system
|
Thats the system set installed ... then next step is the world set. Allow about six hours.
6.
Installing World
Installing World
Contine by emergeing world.
Code Listing 6.1: emerging world |
emerge -Keav --oneshot @world
|
Takes about six hours ... 392m
7.
Configuration Settings
A lot of the settings the installation would have aquired by following the handbook have been skipped. In their place your install has the settings
provided by the liveCD. Some will be flne, some won't. e.g. you want to set your own hostname and timezone.
You will want add a normal user and probably delete the gentoo user.
8.
Kernel and Boot Loader
Warning: The rest of this document is left over from the 10.0 DVD install ***************************************************************************************** |
9.
Getting ready to reboot
Making the Kernel
Follow the instructions at http://www.kernel-seeds.org which is mirrored at http://kernel-seeds.bloodnoc.org
Configuring your System
Follow Gentoo Handbook Chapter 8.
Important: Add the -K option to the emerge command given in the handbook |
Installing Necessary System Tools
Follow Gentoo Handbook Chapter 9.
Important: Add the -K option to the emerge command given in the handbook |
Setting up the Boot Loader
The Grand Unifided Bootloade, grub, has already been installed to /boot
Follow Gentoo Handbook Chapter 10. to install
grub to the Master Boot Record and create a /boot/grub/grub.conf file
10.
Tiding Up
Freeing Disk Space
After you are happy with the install, you can remove the following files
11.
Further Reading
Linux Sea offers a gentle yet technical (from end-user perspective) introduction to the Linux operating system, using Gentoo Linux as the example Linux distribution.
Link included with permission from the author.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-2.5 license. The Gentoo Name and Logo Usage Guidelines apply.
|