Category: Installations

Instalar GFortran (yum)

The Humble Fortran Programmer

yum install gcc-gfortran

If for some reason you do not want to use gfortran to compile your fortran code, there is still g77. g77 was an excellent fortran-77 compiler that was part of gcc prior to gcc version 4.0. g77 had (and still does have) a reputation for being able to accept almost any fortran variant ever created. g77 binaries are still avaliable. as is the source, since gcc/g77 is licensed under the gpl.

Fedora Users
Running Fedora Linux ? g77 is easily available by:
yum install compat-gcc-34-g77
Build It Yourself

The last release in the gcc3.4 series (3.4.6) was on March 6th, 2006.

Can you still build g77 from source code (use BASH preferrably):
tar xvzf gcc-3.4.6.tar.gz
mkdir bin
mkdir run
cd bin
../gcc-3.4.6/configure –enable-languages=c,f77 –disable-checking –prefix=/home/sma/g77/run
make CC=/usr/bin/gcc
make install

spoofmyarp@sma:~/g77$ cat a.f
bdavis@bdavis-desktop:~/g77$ /home/bdavis/g77/run/bin/g77 -static a.f
bdavis@bdavis-desktop:~/g77$ ./a.out

UPDATE 08/03/2010. A report from a Ubuntu linux user reports that the
above no longer works!!!

Here is a patchfile:

diff –recursive –context gcc-3.4.6/gcc/collect2.c /home/bdavis/g77_2/gcc-3.4.6/gcc/collect2.c
*** gcc-3.4.6/gcc/collect2.c 2005-01-10 09:25:23.000000000 -0600
— /home/bdavis/g77_2/gcc-3.4.6/gcc/collect2.c 2010-09-03 16:44:38.104761159 -0500
*** 1534,1540 ****
if (redir)
/* Open response file. */
! redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);

/* Duplicate the stdout and stderr file handles
so they can be restored later. */
— 1534,1540 —-
if (redir)
/* Open response file. */
! redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT,S_IRWXU);

/* Duplicate the stdout and stderr file handles
so they can be restored later. */

Put this in a file in your g77 directory (probably ~/g77 if you followed the above
directions. I stored it in a file named ‘pfile’. Also note I am using my home directory,
which is /home/bdavis. You will need to change the instructions to reflect where your home
directory is or where you want to build and install g77.

mkdir g77
cd g77
# get the patchfile in this directory, like a cut and paste into vi
vi pfile
mkdir bin
mkdir run
gunzip gcc-3.4.6.tar
tar xf gcc-3.4.6.tar
patch -p0 < pfile
cd bin
../gcc-3.4.6/configure –enable-languages=c,f77 \
–prefix=/home/bdavis/g77/run \
make install


Installar servidor-web

Vamos hacer paginas dynamicas con PHP niños…

Se empesa con installar un servidor en tu bota linux que se llama Apache. Despues se necesita perl-cgi, PHP y MySQL. Algunas modulos más y tiene una sitèma, que sirve sus paginas por nuestro Firefox como una locura. Ya apprendiste installar LAMPP, que sirve también, pero ahora lo hacemos cosita pa cosita, qu´el servidor-web en nuestro portátil ou servidor hace exactemiento lo quieremos. Rapido, funcional y sin ninguna redundanccia. Perfecto.

Installa CentOS ou outro Linux.
Installa Apache2 con modulas.
Compiling and Installing
Available Languages: de | en | es | ja | ko | ru | tr

This document covers compilation and installation of Apache on Unix and Unix-like systems only. For compiling and installation on Windows, see Using Apache with Microsoft Windows. For other platforms, see the platform documentation.

Apache 2.0’s configuration and installation environment has changed completely from Apache 1.3. Apache 1.3 used a custom set of scripts to achieve easy installation. Apache 2.0 now uses libtool and autoconf to create an environment that looks like many other Open Source projects.

If you are upgrading from one minor version to the next (for example, 2.0.50 to 2.0.51), please skip down to the upgrading section.

■ Overview for the impatient
■ Requirements
■ Download
■ Extract
■ Configuring the source tree
■ Build
■ Install
■ Customize
■ Test
■ Upgrading
See also
■Configure the source tree
■Starting Apache
■Stopping and Restarting
Overview for the impatient
Download $ lynx
Extract $ gzip -d httpd-2_0_NN.tar.gz
$ tar xvf httpd-2_0_NN.tar
Configure $ ./configure –prefix=PREFIX
Compile $ make
Install $ make install
Customize $ vi PREFIX/conf/httpd.conf
Test $ PREFIX/bin/apachectl start

NN must be replaced with the current minor version number, and PREFIX must be replaced with the filesystem path under which the server should be installed. If PREFIX is not specified, it defaults to /usr/local/apache2.

Each section of the compilation and installation process is described in more detail below, beginning with the requirements for compiling and installing Apache HTTPD.

The following requirements exist for building Apache:

Disk Space
Make sure you have at least 50 MB of temporary free disk space available. After installation Apache occupies approximately 10 MB of disk space. The actual disk space requirements will vary considerably based on your chosen configuration options and any third-party modules.
ANSI-C Compiler and Build System
Make sure you have an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free Software Foundation (FSF) is recommended (version 2.7.2 is fine). If you don’t have GCC then at least make sure your vendor’s compiler is ANSI compliant. In addition, your PATH must contain basic build tools such as make.
Accurate time keeping
Elements of the HTTP protocol are expressed as the time of day. So, it’s time to investigate setting some time synchronization facility on your system. Usually the ntpdate or xntpd programs are used for this purpose which are based on the Network Time Protocol (NTP). See the Usenet newsgroup comp.protocols.time.ntp and the NTP homepage for more details about NTP software and public time servers.
For some of the support scripts like apxs or dbmmanage (which are written in Perl) the Perl 5 interpreter is required (versions 5.003 or newer are sufficient). If you have multiple Perl interpreters (for example, a systemwide install of Perl 4, and your own install of Perl 5), you are advised to use the –with-perl option (see below) to make sure the correct one is used by configure. If no Perl 5 interpreter is found by the configure script, you will not be able to use the affected support scripts. Of course, you will still be able to build and use Apache 2.0.
Apache can be downloaded from the Apache HTTP Server download site which lists several mirrors. Most users of Apache on unix-like systems will be better off downloading and compiling a source version. The build process (described below) is easy, and it allows you to customize your server to suit your needs. In addition, binary releases are often not up to date with the latest source releases. If you do download a binary, follow the instructions in the INSTALL.bindist file inside the distribution.

After downloading, it is important to verify that you have a complete and unmodified version of the Apache HTTP Server. This can be accomplished by testing the downloaded tarball against the PGP signature. Details on how to do this are available on the download page and an extended example is available describing the use of PGP.

Extracting the source from the Apache HTTPD tarball is a simple matter of uncompressing, and then untarring:

$ gzip -d httpd-2_0_NN.tar.gz
$ tar xvf httpd-2_0_NN.tar

This will create a new directory under the current directory containing the source code for the distribution. You should cd into that directory before proceeding with compiling the server.

Configuring the source tree
The next step is to configure the Apache source tree for your particular platform and personal requirements. This is done using the script configure included in the root directory of the distribution. (Developers downloading the CVS version of the Apache source tree will need to have autoconf and libtool installed and will need to run buildconf before proceeding with the next steps. This is not necessary for official releases.)

To configure the source tree using all the default options, simply type ./configure. To change the default options, configure accepts a variety of variables and command line options.

The most important option is the location –prefix where Apache is to be installed later, because Apache has to be configured for this location to work correctly. More fine-tuned control of the location of files is possible with additional configure options.

Also at this point, you can specify which features you want included in Apache by enabling and disabling modules. Apache comes with a Base set of modules included by default. Other modules are enabled using the –enable-module option, where module is the name of the module with the mod_ string removed and with any underscore converted to a dash. You can also choose to compile modules as shared objects (DSOs) — which can be loaded or unloaded at runtime — by using the option –enable-module=shared. Similarly, you can disable Base modules with the –disable-module option. Be careful when using these options, since configure cannot warn you if the module you specify does not exist; it will simply ignore the option.

In addition, it is sometimes necessary to provide the configure script with extra information about the location of your compiler, libraries, or header files. This is done by passing either environment variables or command line options to configure. For more information, see the configure manual page.

For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree /sw/pkg/apache with a particular compiler and flags plus the two additional modules mod_rewrite and mod_speling for later loading through the DSO mechanism:

$ CC=”pgcc” CFLAGS=”-O2″ \
./configure –prefix=/sw/pkg/apache \
–enable-rewrite=shared \

When configure is run it will take several minutes to test for the availability of features on your system and build Makefiles which will later be used to compile the server.

Details on all the different configure options are available on the configure manual page.

Now you can build the various parts which form the Apache package by simply running the command:

$ make

Please be patient here, since a base configuration takes approximately 3 minutes to compile under a Pentium III/Linux 2.2 system, but this will vary widely depending on your hardware and the number of modules which you have enabled.

Now it’s time to install the package under the configured installation PREFIX (see –prefix option above) by running:

$ make install

If you are upgrading, the installation will not overwrite your configuration files or documents.

Next, you can customize your Apache HTTP server by editing the configuration files under PREFIX/conf/.

$ vi PREFIX/conf/httpd.conf

Have a look at the Apache manual under docs/manual/ or consult for the most recent version of this manual and a complete reference of available configuration directives.

Now you can start your Apache HTTP server by immediately running:

$ PREFIX/bin/apachectl start

and then you should be able to request your first document via URL http://localhost/. The web page you see is located under the DocumentRoot which will usually be PREFIX/htdocs/. Then stop the server again by running:

$ PREFIX/bin/apachectl stop

The first step in upgrading is to read the release announcement and the file CHANGES in the source distribution to find any changes that may affect your site. When changing between major releases (for example, from 1.3 to 2.0 or from 2.0 to 2.2), there will likely be major differences in the compile-time and run-time configuration that will require manual adjustments. All modules will also need to be upgraded to accomodate changes in the module API.

Upgrading from one minor version to the next (for example, from 2.0.55 to 2.0.57) is easier. The make install process will not overwrite any of your existing documents, log files, or configuration files. In addition, the developers make every effort to avoid incompatible changes in the configure options, run-time configuration, or the module API between minor versions. In most cases you should be able to use an identical configure command line, an identical configuration file, and all of your modules should continue to work. (This is only valid for versions after 2.0.41; earlier versions have incompatible changes.)

To upgrade across minor versions, start by finding the file config.nice in the build directory of your installed server or at the root of the source tree for your old install. This will contain the exact configure command line that you used to configure the source tree. Then to upgrade from one version to the next, you need only copy the config.nice file to the source tree of the new version, edit it to make any desired changes, and then run:

$ ./config.nice
$ make
$ make install
$ PREFIX/bin/apachectl stop
$ PREFIX/bin/apachectl start

You should always test any new version in your environment before putting it into production. For example, you can install and run the new version along side the old one by using a different –prefix and a different port (by adjusting the Listen directive) to test for any incompatibilities before doing the final upgrade.

Gentoo Linux x86 Quick Install Guide

1. Introduction

This guide contains all the commands you should use to complete a stage3 installation of Gentoo. You need a connection to the Internet to download the stage3 and Portage snapshots.
Important: New users should read the Handbook as it gives a better overview about the installation process. The Quick Install guide is designed for experienced users who just need a checklist to follow.

Timing output follows all commands that take more than a couple of seconds to finish. Commands were timed on an AMD 2000 1.66 Ghz PC with 512 MB of RAM and two SATA disks connected to a hardware controller.

Code Listing 1.1: Test box specs
(The following specs and the timing information should help you determine
a rough estimate of the time you need to complete your install)

# grep bogo /proc/cpuinfo
bogomips : 3337.81

# hdparm -tT /dev/sda
Timing cached reads: 1100 MB in 2.00 seconds = 549.97 MB/sec
Timing buffered disk reads: 224 MB in 3.01 seconds = 74.36 MB/sec

# grep MemTotal /proc/meminfo
MemTotal: 509248 kB

2. Quick Install Guide

Installation Media

Download a CD from one of our mirrors. You can find the minimal CD ISO in releases/x86/current-iso/. The minimal installation CD is only useful for Internet-based installations. This guide will use the minimal CD.

Burn the CD and boot it.

Booting the CD

Press F2 at the boot screen to find out what boot options exist. You can either start gentoo or gentoo-nofb, the latter disables the framebuffer. If you booted the LiveCD, don’t forget to add the nox option to prevent the X graphical environment from starting. Several options allow to enable or disable some features. If all goes well, your hardware will be detected and all modules will be loaded. If the kernel fails to boot properly or if your computer hangs during the boot procedure, you may have to experiment with different configurations. The safest way is probably to use the nodetect option and then load required modules explicitly.

Code Listing 2.1: Boot the minimal CD
Gentoo Linux Installation LiveCD
Enter to Boot; F1 for kernels F2 for options.
boot: gentoo-nofb
(or in case of problems)
boot: gentoo-nofb nodetect

Optional: loading modules

If you used the nodetect option, once booted, load the required modules. You need to enable networking and have access to your disks. The lspci command can help you identify your hardware.

Code Listing 2.2: Load required modules
livecd root # lspci
(Use lspci’s output to identify required modules)

(The following is an example, adapt it to your hardware)
livecd root # modprobe 3w-9xxx
livecd root # modprobe r8169

Network Configuration

If your network does not work already, you can use net-setup to configure your network. You might need to load support for your network card using modprobe prior to the configuration. If you have ADSL, use pppoe-setup and pppoe-start. For PPTP support, first edit /etc/ppp/chap-secrets and /etc/ppp/options.pptp and then use pptp .

For wireless access, use iwconfig to set the wireless parameters and then use either net-setup again or run ifconfig, dhcpcd and/or route manually.

If you are behind a proxy, do not forget to initialize your system using export http_proxy, ftp_proxy and RSYNC_PROXY.

Code Listing 2.3: Configure networking the guided way
livecd root # net-setup eth0

Alternatively, you can start networking manually. The following example assigns the IP address to your PC and defines as your router and name server.

Code Listing 2.4: Configure networking the manual way
livecd root # ifconfig eth0
livecd root # route add default gw
livecd root # echo nameserver > /etc/resolv.conf

The installation CD allows you to start an sshd server, add additional users, run irssi (a command-line chat client) and surf the web using links.

Optional: connect to your new box over ssh

The most interesting feature is of course sshd. You can start it and then connect from another machine and cut and paste commands from this guide.

Code Listing 2.5: Start sshd
livecd root # time /etc/init.d/sshd start
* Generating hostkey …
(sshd generates the key and displays more output)
* starting sshd … [ok]

real 0m13.688s
user 0m9.420s
sys 0m0.090s

Now, set the root password on the liveCD so that you can connect to it from another PC. Please note that allowing root to connect over ssh is not recommended under normal circumstances. If you can’t trust your local network, use a long and complex password, you should use it only once as it will disappear after your first reboot.

Code Listing 2.6: Set the root password
livecd root # passwd
New UNIX password: type_a_password
Retype new UNIX password: type_a_password
passwd: password updated successfully

Now, you can start a terminal on another PC and connect to your new box, follow the rest of this guide in another window, and cut and paste commands.

Code Listing 2.7: Connect to your new box from another PC
(Use the IP address of your new box)
$ ssh root@
The authenticity of host ‘ (’ can’t be established.
RSA key fingerprint is 96:e7:2d:12:ac:9c:b0:94:90:9f:40:89:b0:45:26:8f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘’ (RSA) to the list of known hosts.
Password: type_the_password

Preparing the Disks

Use fdisk or cfdisk to create your partition layout. You need at least a swap partition (type 82) and one Linux partition (type 83). The following scenario creates a /boot, a swap and a main partition as used in our handbook. Replace sda with your disk. Most systems ignore the bootable flag, but a few need it. Set this flag on your boot partition with fdisk’s a command.

Code Listing 2.8: Create the partitions
livecd ~ # fdisk /dev/sda

(The rest of this guide uses the following partitioning scheme)
livecd ~ # fdisk -l /dev/sda

Disk /dev/sda: 599.9 GB, 599978409984 bytes
255 heads, 63 sectors/track, 72943 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 12 96358+ 83 Linux
/dev/sda2 13 110 787185 82 Linux swap / Solaris
/dev/sda3 111 72943 585031072+ 83 Linux

Use mke2fs, mke2fs -j, mkreiserfs, mkfs.xfs and mkfs.jfs to create file systems on your Linux partitions. Initialize your swap partition using mkswap and swapon.

Code Listing 2.9: Create the file systems and activate swap
(ext2 is all you need on the /boot partition)
livecd ~ # mke2fs /dev/sda1

(Let’s use ext3 on the main partition)
livecd ~ # mke2fs -j /dev/sda3

(Create and activate swap)
livecd ~ # mkswap /dev/sda2 && swapon /dev/sda2

Mount the freshly created file systems on /mnt/gentoo. Create directories for the other mount points (like /mnt/gentoo/boot) if you need them and mount them too.

Code Listing 2.10: Mount the file systems
livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ # cd /mnt/gentoo

Setting Up The Stage

First make sure your date and time is set correctly using date MMDDhhmmYYYY. Use UTC time.

Code Listing 2.11: Set the date and UTC time
(Check the clock)
livecd gentoo # date
Mon Mar 6 00:14:13 UTC 2006

(Set the current date and time if required)
livecd gentoo # date 030600162006 (Format is MMDDhhmmYYYY)
Mon Mar 6 00:16:00 UTC 2006

Next, download a stage from one of our mirrors:

Code Listing 2.12: Download a stage3 archive
livecd gentoo # links
(Pick a mirror, move to the releases/x86/current-stage3/ directory,
highlight the stage3 of your choice, probably the i686 stage3, and press D to
download it)

(Or download it directly with wget without choosing a nearby mirror)
livecd gentoo # wget*.tar.bz2

Go to /mnt/gentoo and unpack the stage using tar xjpf .

Code Listing 2.13: Unpack the stage3 archive
livecd gentoo # time tar xjpf stage3*

real 1m14.157s
user 1m2.920s
sys 0m7.530s

Install the latest Portage snapshot. Proceed as for the stage3 archive: choose a nearby mirror from our list, download the latest snapshot and unpack it.

Code Listing 2.14: Download the latest Portage snapshot
livecd gentoo # cd /mnt/gentoo/usr
livecd usr # links
(Pick a mirror, move to the snapshots/ directory,
highlight portage-latest.tar.bz2 and press D to download it)

(Or download it directly with wget without choosing a nearby mirror)
livecd gentoo # cd /mnt/gentoo/usr
livecd usr # wget

Code Listing 2.15: Unpack the Portage snapshot
livecd usr # time tar xjf portage-lat*

real 0m40.523s
user 0m28.280s
sys 0m8.240s


Mount the /proc & /dev file systems, copy over the /etc/resolv.conf file, then chroot into your Gentoo environment.

Code Listing 2.16: Chroot
livecd usr # cd /
livecd / # mount -t proc proc /mnt/gentoo/proc
livecd / # mount –rbind /dev /mnt/gentoo/dev
livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd / # chroot /mnt/gentoo /bin/bash
livecd / # env-update && source /etc/profile
>>> Regenerating /etc/…

Set your time zone

Set your time zone information by using the correct listing in /usr/share/zoneinfo.

Code Listing 2.17: Setting your timezone
livecd / # ls /usr/share/zoneinfo
(Using Brussels as an example)
livecd / # cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime

livecd / # date
Wed Mar 8 00:46:05 CET 2006

Set your host name and domain name

Set your host name in /etc/conf.d/hostname and /etc/hosts. In the following example, we use mybox as host name and at.myplace as domain name. You can either edit the config files with nano or use the following commands:

Code Listing 2.18: Set host and domain name
livecd / # cd /etc
livecd etc # echo “ mybox localhost” > hosts
livecd etc # sed -i -e ‘s/HOSTNAME.*/HOSTNAME=”mybox”/’ conf.d/hostname
(Use defined host name and check)
livecd etc # hostname mybox
livecd etc # hostname -f

Kernel Configuration

Install a kernel source (usually gentoo-sources), configure it, compile it and copy the arch/i386/boot/bzImage file to /boot.

Code Listing 2.19: Install a kernel source, compile it and install the kernel
livecd etc # time emerge gentoo-sources

real 2m51.435s
user 0m58.220s
sys 0m29.890s
livecd etc # cd /usr/src/linux
livecd linux # make menuconfig
(Configure your kernel)
livecd linux # time make -j2

(Elapsed time depends highly on the options you selected)
real 3m51.962s
user 3m27.060s
sys 0m24.310s

livecd linux # make modules_install
livecd linux # cp arch/i386/boot/bzImage /boot/kernel

Configure the system

Edit your /etc/fstab and replace BOOT, ROOT and SWAP with the actual partition names. Don’t forget to check that the file systems match your installation.

Code Listing 2.20: Example fstab
livecd linux # cd /etc
livecd etc # nano -w fstab
/dev/sda1 /boot ext2 noauto,noatime 1 2
/dev/sda3 / ext3 noatime 0 1
/dev/sda2 none swap sw 0 0

Configure your network in /etc/conf.d/net. Add the net.eth0 init script to the default run level. If you have multiple NICs, symlink them to the net.eth0 init script and add them to the default run level as well. Either edit /etc/conf.d/net with nano or use the following commands:

Code Listing 2.21: Configure networking
livecd etc # cd conf.d
livecd conf.d # echo ‘config_eth0=( “” )’ >> net
livecd conf.d # echo ‘routes_eth0=( “default via″ )’ >> net
livecd conf.d # rc-update add net.eth0 default
(If you compiled your network card driver as a module,
add it to /etc/modules.autoload.d/kernel-2.6)
livecd conf.d # echo r8169 >> /etc/modules.autoload.d/kernel-2.6
(If you want to reconnect via ssh after you have rebooted your new box)
livecd conf.d # rc-update add sshd default

Note: Emerge pcmciautils if you need support for PCMCIA cards.

Set the root password using passwd.

Code Listing 2.22: Set the root password
livecd conf.d # passwd
New UNIX password: type_the_password
Retype new UNIX password: type_the_password_again
passwd: password updated successfully

Edit /etc/conf.d/clock to define the time zone you used previously.

Code Listing 2.23: Edit /etc/conf.d/clock
livecd conf.d # nano -w /etc/conf.d/clock

Check the system configuration in /etc/rc.conf, /etc/conf.d/rc, /etc/conf.d/keymaps and edit any of those files if required.

Code Listing 2.24: Optional: edit some config files
livecd conf.d # nano -w /etc/rc.conf
livecd conf.d # nano -w /etc/conf.d/rc
livecd conf.d # nano -w /etc/conf.d/keymaps

Installing System Tools

Install a system logger like syslog-ng and a cron daemon like vixie-cron, and add them to the default run level.
Note: Cron daemons depend on an MTA. mail-mta/ssmtp will be pulled in as a dependency. If you want to use a more advanced MTA, you might want to install it now. If you are in a hurry, let ssmtp be installed and remove it later when you install the MTA of your choice.

Code Listing 2.25: Install a syslogger and a cron daemon
livecd conf.d # time emerge syslog-ng vixie-cron

real 1m54.099s
user 1m2.630s
sys 0m34.620s
livecd conf.d # rc-update add syslog-ng default
livecd conf.d # rc-update add vixie-cron default

Install the necessary file system tools (xfsprogs, reiserfsprogs or jfsutils) and networking tools (dhcpcd or ppp) if you need any.

Code Listing 2.26: Install extra tools if required
livecd conf.d # emerge xfsprogs (If you use the XFS file system)
livecd conf.d # emerge jfsutils (If you use the JFS file system)
livecd conf.d # emerge reiserfsprogs (If you use the Reiser file system)
livecd conf.d # emerge dhcpcd (If you need a DHCP client)
livecd conf.d # emerge ppp (If you need PPPoE ADSL connectivity)

Configuring the Bootloader

Emerge grub and configure it.

Code Listing 2.27: Emerge grub and edit its configuration file
livecd conf.d # time emerge grub

real 1m4.634s
user 0m39.460s
sys 0m15.280s
livecd conf.d # nano -w /boot/grub/grub.conf

Code Listing 2.28: Example grub.conf
default 0
timeout 10

title Gentoo
root (hd0,0)
kernel /boot/kernel root=/dev/sda3

Code Listing 2.29: Install grub
livecd conf.d # grub
Probing devices to guess BIOS drives. This may take a long time.

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd0)
Checking if “/boot/grub/stage1” exists… yes
Checking if “/boot/grub/stage2” exists… yes
Checking if “/boot/grub/e2fs_stage1_5” exists… yes
Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 16 sectors are embedded.
Running “install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/
grub/menu.lst”… succeeded

grub> quit


Exit the chrooted environment, unmount all file systems and reboot:

Code Listing 2.30: Reboot
livecd conf.d # exit
livecd / # umount -l /mnt/gentoo/dev{/shm,/pts,}
livecd / # umount -l /mnt/gentoo{/proc,/boot,}
livecd / # reboot
(Don’t forget to remove the CD)

Finalizing the Installation
Note: The total elapsed time between the display of the boot prompt on the minimal CD and the display of the login prompt after the reboot was 00:42:31 on our test box. Yes, less than one hour! Note that this time also includes the stage3, Portage snapshot and several packages download time and the time spent configuring the kernel.

Log in as root, then add one or more users for daily use with useradd.

Code Listing 2.31: Connect to your new box from another PC
(Clean up your known_hosts file because your new box
has generated a new definitive hostkey)
$ nano -w ~/.ssh/known_hosts
(Look for the IP of your new PC and delete the line,
then save the file and exit nano)

(Use the IP address of your new box)
$ ssh root@
The authenticity of host ‘ (’ can’t be established.
RSA key fingerprint is 96:e7:2d:12:ac:9c:b0:94:90:9f:40:89:b0:45:26:8f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘’ (RSA) to the list of known hosts.
Password: type_the_password

Code Listing 2.32: Add a new user
mybox ~ # useradd -g users -G lp,wheel,audio,cdrom,portage,cron -m john
mybox ~ # passwd john
New UNIX password: Set John’s password
Retype new UNIX password: Type John’s password again
passwd: password updated successfully

Last configuration touches

Start by selecting nearby mirrors either by defining the SYNC and GENTOO_MIRRORS variables in /etc/make.conf or by using mirrorselect. You can also define the number of concurrent compilation processes at this point.

Code Listing 2.33: Use mirrorselect and set MAKEOPTS
mybox ~ # emerge mirrorselect
mybox ~ # mirrorselect -i -o >> /etc/make.conf
mybox ~ # mirrorselect -i -r -o >> /etc/make.conf
(Usually, (the number of processors + 1) is a good value)
mybox ~ # echo ‘MAKEOPTS=”-j2″‘ >> /etc/make.conf

Now is a good time to enable or disable some USE flags. Run emerge -vpe world to list all currently installed packages and their enabled and disabled USE flags. Either edit /etc/make.conf or use the following command to define the USE variable:

Code Listing 2.34: View USE flags in use and enable or disable some
mybox ~ # emerge -vpe world
(Portage displays the packages and their USE flags, as an example, let’s
disable fortran, and enable ipv6 and unicode)
mybox ~ # echo ‘USE=”nptl nptlonly ipv6 -fortran unicode”‘ >> /etc/make.conf

Recent versions of glibc use /etc/locale.gen to define locale settings.

Code Listing 2.35: Define locales
mybox ~ # cd /etc
mybox etc # nano -w locale.gen
mybox etc # locale-gen

Last but not least, you may want to alter the CFLAGS variable in your /etc/make.conf to optimise the code to your specific needs. Please note that using a long list of flags is rarely needed and can even lead to a broken system. It is recommended to specify the processor type in the march option and stick to -O2 -pipe.

You may also want to switch to ~x86. You should only do this if you can deal with the odd broken ebuild or package. If you’d rather keep your system stable, don’t add the ACCEPT_KEYWORDS variable.

Code Listing 2.36: Last edit of make.conf
mybox etc # nano -w make.conf
(Set -march to your CPU type in CFLAGS)
CFLAGS=”-O2 -march=athlon-xp -pipe”
(Only add the following if you know what you’re doing)

You might want to recompile your whole system twice to make full use of your latest configuration changes. It would take quite a long time to complete and yield minimal speed benefits. You can let your system optimise itself gradually over time when new versions of packages are released. However, recompiling is a still good idea from the standpoint of maintaining system consistency. Please see the Gentoo GCC Upgrading Guide for a discussion on the benefits of ensuring a consistently built system and world.

Recompiling only the packages that have already been updated since the release or that are affected by your new USE flags will take enough time. You might also have to remove packages that block your upgrade. Look for “[blocks B ]” in the output of emerge -vpuD –newuse world and use emerge -C to remove them.

Code Listing 2.37: Update your packages
(Please note that the switch to ~x86 causes many packages to be upgraded)
mybox etc # emerge -vpuD –newuse world
(Take a good look at the package list and their USE flags,
remove blocking packages if any, and start the lengthy process)
mybox etc # time emerge -vuD –newuse world
(79 packages have been (re)compiled)

real 180m13.276s
user 121m22.905s
sys 36m31.472s

(Remerge libtool to avoid further potential problems)
mybox etc # emerge –oneshot libtool

(Update config files, make sure you do not let dispatch-conf
update config files you have edited)
mybox etc # dispatch-conf

(If perl has been updated, you should run the perl-cleaner script)
mybox etc # time perl-cleaner all
real 1m6.495s
user 0m42.699s
sys 0m10.641s

(In case of a major upgrade of python, you should run the python-updater script)
mybox etc # python-updater

What to do next

Depending on what your new Gentoo machine is supposed to do, you will probably want to install server applications or a desktop system. Just as an example, emerge gnome and emerge kde have been timed on the ~x86 system installed as describe above. Both have been installed from the same starting point.

You should check our documentation index to find out how to install and configure the applications of your choice.
Important: The following is only an example. It is in no way meant as a recommended setup.

Code Listing 2.38: Emerge GNOME
mybox etc # emerge -vp gnome
(Look at the list of packages and their USE flags,
then edit make.conf if required.
mybox etc # nano -w /etc/make.conf
(The following USE flags have been defined)
USE=”nptl nptlonly -ipv6 -fortran unicode svg hal dbus \
-kde -qt4 -arts -eds -esd gnome gstreamer gtk firefox”

mybox etc # time emerge gnome
(326 packages have been emerged)

real 520m44.532s
user 339m21.144s
sys 146m22.337s

Code Listing 2.39: Emerge KDE
mybox etc # emerge -vp kde-meta
(Look at the list of packages and their USE flags,
then edit make.conf if required.
mybox etc # nano -w /etc/make.conf
The following USE flags have been defined)
USE=”nptl nptlonly -ipv6 -fortran unicode svg hal dbus \
kde qt4 -arts -eds -esd -gnome -gstreamer -gtk -firefox”

mybox etc # time emerge kde-meta
(391 packages have been emerged)

real 1171m25.318s
user 851m26.393s
sys 281m45.629s

If KDE is too big for you, or doesn´t support your wishes (like, just C++++++!!!), then here is all the ways to install Qt4 or higher on your Linux-box.