funtoo complete man

Upload: avaloshe

Post on 14-Oct-2015

60 views

Category:

Documents


5 download

TRANSCRIPT

  • Contents1 Introduction

    2 Booting the Installation System

    2.1 Booting old/other GNU/Linux

    2.2 Booting with SystemRescueCd

    3 HDD Preparation

    3.1 Resize of HDD partitions

    3.2 Partitioning scheme

    3.3 MBR

    3.3.1 unencrypted

    3.3.2 encrypted

    3.4 GPT/GUID partition table

    3.4.1 unencrypted

    3.4.2 encrypted

    3.5 Cryptocontainer

    3.5.1 MBR

    3.5.2 GPT/GUID

    3.5.3 logical volumes

    3.6 filesystem creation

    3.6.1 MBR unencrypted

    3.6.2 GPT unencrypted

    3.6.3 MBR/GPT encrypted

    3.7 System Setup

    3.7.1 Mounting filesystem

    3.7.1.1 MBR unencrypted

    3.7.1.2 GPT unencrypted

    3.7.1.3 MBR/GPT encrypted

    3.7.2 Downloading the System

    3.7.3 Installing the base system

    3.7.4 Chrooting

    3.7.4.1 Updating the Portage tree

    3.7.4.2 Setting the default options

    3.7.4.2.1 /etc/make.conf

    3.7.4.2.1.1 CFLAGS

    3.7.4.2.1.2 CXXFLAGS

    3.7.4.2.1.3 MAKEOPTS

    3.7.4.2.1.4 USE

    3.7.4.2.1.5 GENTOO_MIRRORS

    3.7.4.2.1.6 LINGUAS

    3.7.4.2.1.7 /etc/make.conf example

    3.7.4.2.2 /etc/fstab

    3.7.4.2.2.1 unencrypted MBR

    3.7.4.2.2.2 unencrypted GPT

    3.7.4.2.2.3 encrypted

    3.7.4.2.3 /etc/conf.d/hostname

    3.7.4.2.4 /etc/rc.conf

    3.7.4.2.5 /etc/conf.d/keymaps

    3.7.4.2.6 /etc/conf.d/hwclock

    3.7.4.2.7 /etc/conf.d/consolefont

    Installation (Tutorial)From FuntooThis is the approved revision of this page, as well as being the most recent.Note: If you want to do a standard Funtoo Linux installation, I recommend you usethe shorter, ocial Funtoo Linux Installation Instructions instead. -Daniel

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    1 de 62 01/02/14 12:55

  • 3.7.4.2.8 /etc/env.d/99editor

    3.7.4.2.9 /etc/localtime

    3.7.4.2.10 /etc/make.profile

    3.7.4.2.11 /etc/conf.d/modules

    3.7.4.2.12 Localization

    3.7.4.3 Kernel

    3.7.4.3.1 choosing a kernel

    3.7.4.3.2 genkernel

    3.7.4.3.2.1 default options for unencrypted/encrypted setup

    3.7.4.3.2.2 additional encrypted options

    3.7.4.3.3 manual kernel

    3.7.4.3.3.1 install and config

    3.7.4.3.3.2 default options for unencrypted/encrypted setup

    3.7.4.3.3.3 additional encrypted options

    3.7.4.3.3.4 building the kernel the manual way

    3.7.4.4 Bootloader

    3.7.4.4.1 boot-update

    3.7.4.4.1.1 encrypted disk with manual kernel

    3.7.4.4.1.2 = Updating better-initramfs =

    3.7.4.4.1.3 setting up grub2

    3.7.4.4.2 Extlinux

    3.8 finalize Setup

    3.8.1 Necessary System Tools

    3.8.1.1 System Logger

    3.8.1.2 Optional: Cron Daemon

    3.8.1.3 Optional: File Indexing

    3.8.1.4 File System Tools ==

    3.8.2 Networkconfig

    3.8.2.1 The Easy (Dynamic) Way

    3.8.2.2 The Modular Way

    3.8.2.2.1 Configuration Variables

    3.8.2.2.1.1 Interface Variables

    3.8.2.2.2 General Variables

    3.8.2.3 VLAN Variables

    3.8.2.4 OpenResolv and resolv.conf

    3.8.2.5 Network-Dependent Services

    3.8.2.6 Multiple Network Configurations

    3.8.2.6.1 Alternate Configs

    3.8.2.6.2 Interface Renaming

    3.8.2.6.3 Basic VLAN Configuration

    3.8.2.6.4 Custom VLAN Names

    3.8.2.7 More Complex Network Configuration

    3.8.2.8 netif_create

    3.8.2.9 netif_depend

    3.8.2.10 netif_pre_up

    3.8.2.11 netif_post_up

    3.8.2.12 netif_pre_down

    3.8.2.13 netif_post_down

    3.8.2.14 netif_destroy

    3.8.2.15 How It Works

    3.8.2.16 Wireless Configuration

    3.8.2.17 802.11 Passphrases

    3.8.2.18 Wireless Firmware

    3.8.3 Set your root password

    3.8.4 Create a user account

    3.8.5 Verify boot time services

    3.8.6 First boot

    3.9 What's next

    Introduction

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    2 de 62 01/02/14 12:55

  • This HowTo aims to give the experienced GNU/Linux User a quick way to install FuntooLinux in a nice and fast way. Also we will give you all the necessary steps for installingFuntoo GNU/Linux in this guide, but we won't go deeper into the details of them as needThere are two ways of installing Funtoo GNU/Linux on your PC:

    using an already installed GNU/Linux System or1.using a LiveCD2.

    If you plan to use a LiveCD, we recommend you to use SystemRescueCd(http://www.sysresccd.org/) .All the commands in this guide are performed as "root", unless we indicate it otherwise.This HowTo will cover the following four setups:

    a standard Installation (MBR, HDD not encrypted),1.a standard secure Installation (MBR, HDD encrypted),2.a modern Installation (GPT/GUID partition table, HDD not encrypted) and3.a modern secure Installation (GPT/GUID partition table, HDD encrypted).4.

    These four approaches have the following Pros and Cons:

    Setup Pro Contra

    1

    Easy method mostly used byall distributionsWell documented everywhereTime saving methodNo special EFI-partitionneededDualbootable with MicrosoftWindows

    Partition table limited 4 primaryones onlyNeeds special 4th partition formore than 4 partitionsHDD not encrypted, can easily becloned

    2

    Easy method mostly used byall distributionsWell documented everywhereNo special EFI-partitionneededHDD encryptedDualbootable with MicrosoftWindowsLogical volume groups forGNU/Linux

    Partition table limited 4 primaryones onlyNeed special 4th partition for morethan 4 partitionsNeeds lot of time for preparing theHDD to be encrypted

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    3 de 62 01/02/14 12:55

  • 3Easy method but nearly notused by other distributionsNo special partiton needed formore than 4 partitionsTime saving method

    Need special EFI-partition forboot-managerSpecial kernel attributes areneededNot compatible with MicrosoftWindowsNot supported on all platformsespecially for the system volumeHDD not encrypted, can easily becloned from other linux systems

    4

    Easy method but nearly notused by other distributionsNo special partition needed formore than 4 partitionsHDD encryptedLogical volume groups

    Need special EFI-partition forboot-managerSpecial kernel attributes areneededNot compatible with MicrosoftWindowsNot supported on all platformsespecially for the system volumeNeeds lot of time for preparing theHDD to be encrypted

    With the help of the the above table you should be able to select your future Hard Disk(HDD) partitioning scheme. In the further guide we will go through every single step forall four schemes.For booting your old/other GNU/Linux System we won't give you a special detailedhowto guide, as you should know how to do so, as concerning the booting withSystemRescueCd (http://www.sysresccd.org) , we will give you a short step-by-stepguide on how to boot up the system.This guide will only be split into subparts for the installation process if concerning thefour above mentioned steps, here the split points will be MBR vs. GPT/GUID-partitioningand encrypted vs. unencrypted HDD. So be aware of these parts if you want to usethem.

    Booting the Installation SystemBooting old/other GNU/LinuxThis step is really simple, as you know your old GNU/Linux System and you need simplystart your Computer, select in the boot-loader your GNU/Linux System, let it start up,log in as always and start a root-terminal.Booting with SystemRescueCd

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    4 de 62 01/02/14 12:55

  • First step is to download SystemRescueCd (http://www.sysresccd.org) , an overview ofthe actual version can be found at http://www.sysresccd.org/Download, just follow therethe link to the Sourceforge Download, you will download then about 300 MB to yourHDD. If nished burn this ISO-image with your favorite burning tool like burn-cd,bashburn, K3B, GNOMEbaker on a GNU/Linux Box or NERO Burning ROM,CDBurnerXP Pro, and many more on a Microsoft Windows box.

    Next insert this CD into your CD-ROM-Drive and boot up the PC with it where you wantto install Funtoo GNU/Linux. Make sure you boot from the CD when booting. TheBooting process with SystemRescueCd (http://www.sysresccd.org) will follow the nextsteps:

    Selecting your Kernel to boot SystemRescueCd (http://www.sysresccd.org/) with:1.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    5 de 62 01/02/14 12:55

  • In that screen you will be greeted with all the power of SystemRescueCd(http://www.sysresccd.org/) , depending on your CPU we use the boot option 1) for a32-bit CPU or a 64-bit CPU that should run in 32-bit mode and 6) for a 64-bit CPU in64-bit mode. If this boot option fails, use the boot option A) or B), will will lead to thefollowing screen:

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    6 de 62 01/02/14 12:55

  • That menu will give you more boot options. If you select 1. here, it would be the samekernel option like in the previous screen 1) and 6). The next step is to select yourkeyboard layout for installation.

    Selecting your Installation Keyboard Layout1.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    7 de 62 01/02/14 12:55

  • That step requires a bit of your atention, as it only gives you 20 seconds time to chooseyour keyboard layout, if you are OK with the US keymap, just press Enter to accept thedefault setting.

    Being ready1.Seconds later SystemRescueCd (http://www.sysresccd.org/) welcomes you wit a shortmessage and is ready fo you to be used to perform your installation.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    8 de 62 01/02/14 12:55

  • HDD PreparationAs mentioned earlier in this guide we cover four dierent installation variations, thecould be displayed in an installation matrix as below:

    MBR GPTunencrypted See MBR See GPT/GUID partition tableencrypted See MBR See GPT/GUID partition table

    If you are going to plan to install Funtoo GNU/Linux on a machine where another O/S isalready installed, you have to make some free space available on your HDD in order todo so. A resize of most existing lesystems can be done with SystemRescueCd(http://www.sysresccd.org/) too. You just need to enter the graphical environment anduse gparted. We will give you a short example on how to do so with a sample HDD thatmight hold windows, so you get a feeling what to do, but be aware that a resize can be adangerous part, so please keep a backup of your data, as Funtoo Technologies wouldn'ttake any responsibility for a loss of data that could happen by the process of shrinking apartition.Starting the graphical environment in SystemRescueCd (http://www.sysresccd.org/) isreally simple, just execute the following command:root@sysresccd /root % wizard

    and it will start a dialog for the graphical environment setup, for most users the defaultoptions should be OK. Both the dialog and the graphical environment (Xfce) are shownin the next two images.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    9 de 62 01/02/14 12:55

  • Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    10 de 62 01/02/14 12:55

  • Resize of HDD partitionsThe above screen shows us that there is the tool called GParted right on the frontpanel.That tool will be used to resize our HDD partitions. The following screen shows us anexample of how the tool looks if you start it.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    11 de 62 01/02/14 12:55

  • By clicking on the partion you want to resize you make it active right-click on it and usethe point resize and you will see the Resize/Move dialog, here you can edit the resizeoptions for that partiton.

    When you nished setting the resize options, you will see that the grey-green hook inthe menu got green, that means you have jobs added to the working list. If you have all

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    12 de 62 01/02/14 12:55

  • actions done on the partition, click on the green hook and your resize action will run bygiving you the following feedback window:

    when that has nished you will see the resized result and it should look like that:

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    13 de 62 01/02/14 12:55

  • we are nished with resizing the dis partitions, exit the Tool and close Xfce by clickingthe running exit man in the down right. We are back on the command line and are readyto partitions our disk. to our needs, for a unied way we will show it with an emptypartition table, so if you have resized some partitions, they will be listed in the MBRmenu, as if you want to use an GPT/GUID partition table we will start from a clean tableanyway.Partitioning scheme

    Warning:If you are partitioning the hard drive of a SPARC machine, please seeFuntoo Linux Installation on SPARC. Also, note that OpenBoot has nosupport for GPT volumes and you won't be able to boot on thesystem volume if that later has been partitioned with GPT.

    For partitioning we suggest the following schemes:MBR unencrypted

    Partition Size fdiskoptionFilesystem

    (FS)/boot 200 MB 83 ext2

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    14 de 62 01/02/14 12:55

  • swap 2x RAM if 1024 MB or less, otherwise 2GB 82 sw (default)/ 20-50 GB 83 ext4/usr/portage ~10 GB 83 ext4/home As much as possible. 83 xfs

    MBR encryptedPartition Size fdisk option FS/boot 200 MB 83 ext2cryptoroot Rest of the Disc 83 none

    GPT unencryptedPartition Size gdisk option FS

    /boot 200 MB 0700 ext2EFI-Boot 512 kB EF02 noneswap 2x RAM if 1024 MB or less, otherwise 2 GB 8200 swap (default)/ 20 - 50 GB 0700 ext4/usr/portage ~10 GB 0700 ext4/home Rest of the Disc 0700 xfs

    GPT encryptedPartition Size gdisk option FS/boot 200 MB 0700 ext2EFI-Boot 512 kB EF02 nonecryptoroot Rest of the Disc 0700 noneMBRNow we will partition the HDD using the above scheme with a disk partitioning toolnamed "fdisk". So just invoke it with the following command:# fdisk /dev/sda

    it will greet you like this

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    15 de 62 01/02/14 12:55

  • by pressing `m` you will get a help context menu that will give you the following options: a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partion o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel
  • next we need to make the partition bootable and add then the rest of the partitions:Command (m for help): aPartition number (1-4): 1Command (m for help): tSelected partition 1Hex code (type L to list codes): 83Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4, default 2): (default)Using default value 2First sector: (Use default)Using default valueLast sector, ...: +2GCommand (m for help): tPartition number (1-4): 2Hex code (type L to list codes): 82Changed system type of partition 2 to 82 (Linux swap / Solaris)Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4, default 3): (default)Using default value 3First sector: (Use default)Using default valueLast sector, ...: +20GCommand (m for help): tPartition number (1-4): 3Hex code (type L to list codes): 83Command (m for help): nCommand action e extended p primary partition (1-4)eSelected partition 4First sector: (Use default)

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    17 de 62 01/02/14 12:55

  • Using default valueLast sector, ...: (Use default)Using default valueCommand (m for help): nFirst sector: (Use default)Using default valueLast sector, ...: +10GCommand (m for help): tPartition number (1-5): 5Hex code (type L to list codes): 83Command (m for help): nFirst sector: (Use default)Using default valueLast sector, ...: (Use default)Command (m for help): tPartition number (1-6): 6Hex code (type L to list codes): 83Command (m for help): p

    this will result in the following output

    now just write the partition table to your disk by using `w`, this will result in thefollowing output:Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    18 de 62 01/02/14 12:55

  • If that was your scheme, you are now so far to get to the partition formatting section.encryptedCommand (m for help): n

    it will ask you now if you want to add a primary or extended partition, we chooseprimary by pressingCommand action e extended p primary partition (1-4)p

    and use for the next 2 steps the default options and add as the Last Sector for the rstpartition the following:Partition number (1-4, default 2): (default)Using default value 1First sector: (Use default)Using default valueLast sector, ...: +200M

    Next we need to make the partition bootable and add then the rest of the partition:Command (m for help): aPartition number (1-4): 1Command (m for help): tSelected partition 1Hex code (type L to list codes): 83Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4, default 2): (default)Using default value 2First sector: (Use default)Using default valueLast sector, ...: (use default)Command (m for help): p

    this will result in the following output

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    19 de 62 01/02/14 12:55

  • now just write the partition table to your disk by using w, this will result in the followingoutput:Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.

    next we need to prepare our cryto-container that will keep all the encrypted stu in it.For that, go to the Cryptocontainer section.GPT/GUID partition tableThis setup is for most users more intuitive, since we don't need to care about extendedpartitions. We only need to setup an extra partition for our bootloader. So let us do it forunencrypted and encrypted partitions.For setting up the GPT partition table we use the tool "gdisk", that is the GPT equivalentof fdisk.Just start it with the following command:gdisk /dev/sda

    it will greet you with the following screen

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    20 de 62 01/02/14 12:55

  • unencryptedNext we will create the partitions for our unencrypted setup:Command (? for help): nPartition number (1-128, default 1): (Use default)First sector (34-..., default = 34) or ...: (Use default)Information: Moved requested sector from 34 to 2048 inorder to align on 2048-sector boundaries.Use 'l' on the experts' menu to adjust alignmentLast sector (2048-..., default = ...) or ...: +200MCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): (ENTER)Changed type of partition to 'Linux/Windows data'Command (? for help): nPartion number (2-128, default 2): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): +512KCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): ef02Changed type of partition to 'BIOS boot partition'Command (? for help): nPartition number (3-128, default 3): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): +2GCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): 8200Changed type of partition to 'Linux swap'Command (? for help): nPartition number 4-128, default 4): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): +20GCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): (ENTER)Changed type of partition to 'Linux/Windows data'Command (? for help): nPartition number 5-128, default 5): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): +10GCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): (ENTER)Changed type of partition to 'Linux/Windows data'Command (? for help): n

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    21 de 62 01/02/14 12:55

  • Partition number 6-128, default 6): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): (Use default)Current type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): (ENTER)Changed type of partition to 'Linux/Windows data'Command (? for help): p

    will now show you a disk partitioning like that one:

    now write the table to your disk with w;Command (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!Do you want to proceed, possibly destroying your data? (Y/N): YOK; writing new GUID partition table (GPT).The operation has completed successfully.

    Now go the section about creating the lesystem on MBR.encryptedNext we will create the partitions for our encrypted setup:Command (? for help): nPartition number (1-128, default 1): (Use default)First sector (34-..., default = 34) or ...: (Use default)Information: Moved requested sector from 34 to 2048 inorder to align on 2048-sector boundaries.Use 'l' on the experts' menu to adjust alignmentLast sector (2048-..., default = ...) or ...: +200M

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    22 de 62 01/02/14 12:55

  • Current type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): (ENTER)Changed type of partition to 'Linux/Windows data'Command (? for help): nPartion number (2-128, default 2): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): +512KCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): ef02Changed type of partition to 'BIOS boot partition'Command (? for help): nPartition number (3-128, default 3): (Use default)First sector (...) or ...: (Use default)Last sector (...) or (...): (Use defaultCurrent type is 'Linux/Windows data'Hex code or GUID (L to show codes, Enter = 0700): (ENTER)Changed type of partition to 'Linux/Windows data'Command (? for help): p

    will now show you a disk partitioning like that one:

    now write the table to your disk with w;Command (? for help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!Do you want to proceed, possibly destroying your data? (Y/N): YOK; writing new GUID partition table (GPT).The operation has completed successfully.

    Now go to the Cryptocontainer setup.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    23 de 62 01/02/14 12:55

  • CryptocontainerSetting up the cryptocontainer for our encrypted system is in both cases nearlyidentically, but for the easier showing eect we will give both examples in a seperatesubsection.MBRFirst we will prepare the HDD for being encrypted, if you use SystemRescueCd(http://www.sysresccd.org/) in version 2.0.1 or higher just execute the followingcommands:Note: If you want to see progress of dd than you have to open another terminal andexecute: kill -s USR1 `pidof dd`# dd if=/dev/zero of=/dev/sda2 bs=100M# dd if=/dev/urandom of=/dev/sda2 bs=100M

    This part is optional but for security reason we advise you to do so if you like to have asecure encrypted disk. This part takes a lot of time, let your Computer run and get outto sleep and work, as it might take a day or two depending on your HDD size. :)You should also be aware that you will get a hint about reaching the end of your HDD.That's intended and desired in this case so that the command can work without knowingyour disk-size.If you ran the above commands you should see an output similar to the one shown in thescreenshot:

    Next we need to encrypt our HDD, that will be done with the following commands:# cryptsetup -c aes-xts-plain luksFormat /dev/sda2WARNING!========This will overwrite data on /dev/sda2 irrevocably.Are you sure (Type uppercase yes): YESEnter LUKS passphrase: (Your paranoid passphrase)Verify passphrase: (Your paranoid passphrase again)

    Then we need to mount our HDD:# cryptsetup luksOpen /dev/sda2 dmcrypt_root

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    24 de 62 01/02/14 12:55

  • Enter passphrase for /dev/sda2: (your paranoid passphrase)

    Next we will creat the logical volumes for our setup, so have a look at the subsectionabout logical volumes.GPT/GUIDThis section is nearly the same as above, so if you read the text in one you will rereadthe MBR section again only with the GPT enabled stu.Note: If you want to see progress of dd than you have to open another terminal andexecute: kill -s USR1 `pidof dd`

    First we will prepare the HDD for being encrypted, if you use SystemRescueCd(http://www.sysresccd.org/) in version 2.0.1 or higher just execute the followingcommands:# dd if=/dev/zero of=/dev/sda3 bs=100M# dd if=/dev/urandom of=/dev/sda3 bs=100M

    This part is optional but for security reason we advise you to do so if you like to have asecure encrypted disk. This part takes a lot of time, let your Computer run and get outto sleep and work, as it might take a day or two depending on your HDD size. :)You should also be aware that you will get a hint about reaching the end of your HDD.That's intended and desired in this case so that the command can work without knowingyour disk-size.If you ran the above commands you should see an output similiar to the one shown inthe screenshot:

    Next we need to encrypt our HDD, that will be done with the following commands:# cryptsetup -c aes-xts-plain luksFormat /dev/sda3WARNING!========This will overwrite data on /dev/sda3 irrevocably.Are you sure? (Type uppercase yes): YESEnter LUKS passphrase: (your paranoid passphrase)Verify passphrase: (your paranoid passphrase again)

    Then we need to mount our HDD:

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    25 de 62 01/02/14 12:55

  • # cryptsetup luksOpen /dev/sda3 dmcrypt_rootEnter passphrase for /dev/sda3: (your paranoid passphrase)

    next we will creat the logical volumes for our setup, so have a look at the followingsubsection.logical volumesFeel free to adjust your sizes here, we will follow our given advices above for that. Firstwe need to creat the the physical volume, then the volume group and at last the logicalvolumes. doing so is really easy, just do the following for if you want to follow ouradvices above:# pvcreate /dev/mapper/dmcrypt_rootPhysical volume "/dev/mapper/dmcrypt_root" successfully created# vgcreate vg /dev/mapper/dmcrypt_rootVolume group "vg" successfully created# lvcreate -L20G -nroot vgLogical volume "root" created# lvcreate -L2G -nswap vgLogical volume "swap" created# lvcreate -L10G -n portage vgLogical volume "portage" created# lvcreate -l 100%FREE -nhome vgLogical volume "home" created

    lesystem creationNow that we have created our partitioning scheme, we can go on to create thelesystems needed for our partitions. Here dierences only occur between theunencrypted setups. Encrypted volumes are handled the same way, no matter whetherMBR and GPT, so there is no need to split them up in two seperate parts:MBR unencryptedFor the unencrypted partions in the MBR setup just use the following regarding to ourabove given adives, you may feel free to change some parts of it if you like:# mkfs.ext2 /dev/sda1# mkswap /dev/sda2# mkfs.ext4 /dev/sda3# mkfs.ext4 /dev/sda5# mkfs.xfs /dev/sda6

    That was all for having your lesystem created. now go to the System Setup.GPT unencryptedNow let us create the lesystem for our GUID partition table. It is as easy as above, justsee the dierence in the jump of partition name:# mkfs.ext2 /dev/sda1# mkswap /dev/sda3# mkfs.ext4 /dev/sda4

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    26 de 62 01/02/14 12:55

  • # mkfs.ext4 /dev/sda5# mkfs.xfs /dev/sda6

    Next step is to mount our partitons, for that go to the System Setup.MBR/GPT encryptedIf you choose to encrypt your HDD, you will in both cases follow the next steps to setupyour lesystems:# mkfs.ext2 /dev/sda1# mkswap /dev/mapper/vg-swap# mkfs.ext4 /dev/mapper/vg-root# mkfs.ext4 /dev/mapper/vg-portage# mkfs.xfs /dev/mapper/vg-home

    So far we prepared the disk and will now mount our partitions.

    System SetupMounting lesystemAs we need to have a mountpoint for our system, we now create it with# install -d /mnt/funtoo

    Note:The in the following used install -d command just creats all the needed foldersfor later mountpoints for us. If you like you can control it by using ls/mnt/funtoo after the install -d part. Now you are ready to install your basesystem, read on in Downloading the System.

    MBR unencryptedNow mount your system partitions like that if you used our above advice:# swapon /dev/sda2# mount /dev/sda3 /mnt/funtoo# install -d /mnt/funtoo/{boot,usr/portage,home}# mount /dev/sda1 /mnt/funtoo/boot# mount /dev/sda5 /mnt/funtoo/usr/portage# mount /dev/sda6 /mnt/funtoo/home

    Note:The install -d command just creats all the needed folders for later mountpointsfor us. If you like you can control it by using ls /mnt/funtoo after the install -dpart. Now you are ready to install your base system, read on in Downloadingthe System.

    GPT unencryptedThat part is really similiar to the unencrypted MBR, but see for yourself:# swapon /dev/sda3# mount /dev/sda4 /mnt/funtoo

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    27 de 62 01/02/14 12:55

  • # install -d /mnt/funtoo/{boot,usr/portage,home}# mount /dev/sda1 /mnt/funtoo/boot# mount /dev/sda5 /mnt/funtoo/usr/portage# mount /dev/sda6 /mnt/funtoo/home

    MBR/GPT encryptedNow mount the system so we can setup the system in the next step.# swapon /dev/mapper/vg-swap# mount /dev/mapper/vg-root /mnt/funtoo# install -d /mnt/funtoo/{boot,usr/portage,home}# mount /dev/sda1 /mnt/funtoo/boot# mount /dev/mapper/vg-portage /mnt/funtoo/usr/portage# mount /dev/mapper/vg-home /mnt/funtoo/home

    Downloading the SystemThe next step is to download the base system and portage tree and set up both. Here alist of packages we have:

    Arch (32/64bit) Processors Stable Release Current Release

    64-bit InstallImages forPC-compatibleprocessors

    64Generic Intel andAmd 64-bitProcessors

    generic_64(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-64bit/generic_64/)

    generic_64(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/)

    64Intel Core2 Seriesand most AtomProcessors

    core2_64(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-64bit/core2_64/)

    core2_64(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/core2_64/)

    64 Intel Core i3, i5,i7 N/Acorei7(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/corei7/)

    64AMD Athlon 64and OpteronProcessors (K8Family or higher)

    amd64-k8(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-64bit/amd64-k8/)

    amd64-k8(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/amd64-k8/)

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    28 de 62 01/02/14 12:55

  • 32-bit InstallImages forPC-compatibleprocessors

    32Intel Core2Series, i3, i5, i7and AtomProcessors

    N/Acore2_32(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/core2_32/)

    32 N/Aamd64-k8_32(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/amd64-k8_32/)

    32Generic x86processors(intel80486+)

    i486(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-32bit/i486/)

    i486(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/i486/)

    32Generic P6-class(PentiumPro/Pentium IIcompatible)

    i686(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/x86-32bit/i686/)

    i686(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/i686/)

    32Athlon XP andAthlon 64-basedCPU (32-bitmode)

    N/Aathlon-xp(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/athlon-xp/)

    32 Intel Pentium 4Processors N/Apentium4(http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-32bit/pentium4/)

    OpenVZTemplates forPC-CompatibleSystems

    32 32-bit OpenVZImages

    OpenVZ x86-32bit(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/openvz/x86-32bit)

    OpenVZ x86-64bit(http://ftp.osuosl.org/pub/funtoo/funtoo-current/openvz/x86-32bit)

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    29 de 62 01/02/14 12:55

  • 64 64-bit OpenVZImages

    OpenVZ x86-64bit(http://ftp.osuosl.org/pub/funtoo/funtoo-stable/openvz/x86-64bit)

    OpenVZ x86-64bit(http://ftp.osuosl.org/pub/funtoo/funtoo-current/openvz/x86-64bit)

    SPARCprocessorImages

    32/64

    Generic SPARC v9processors (usethis one if theultrasparc I/IIstages areinadequate foryou)

    N/Asparc_v9(http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/sparc_v9/)

    32/64UltraSPARC I &UltraSPARC IIseries (choosethis one in doubt)

    N/Aultrasparc(http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/ultrasparc/)

    32/64UltraSPARC IIIand UltraSPARCIV series

    N/Aultrasparc3(http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/ultrasparc3/)

    32/64 Niagara(UltraSPARC T1) N/Aniagara(http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/niagara/)

    32/64Niagara 2(UltraSPARC T2/UltraSPARC T2+)

    N/Aniagara2(http://ftp.osuosl.org/pub/funtoo/funtoo-current/sparc-64bit/niagara2/)

    If you found your desired image above, just change to /mnt/funtoo and download thestage3 and portage-tree images.# cd /mnt/funtoo# elinks http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    30 de 62 01/02/14 12:55

  • this shows you the site presented and by going down with the arrow keys to stage3-latest.tar.xz until it is highlighted you can download it by pressing D. Then move up inthe directory structure (..-link) and go to the snapshot directory or quit elinks afterdownloading nished and start it again with like that# elinks http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/

    here you will now download the portage tree (portage-latest.tar.xz). The Downloaddialog will look in both cases like that:(Note outdated image, 'stage3-current.tar.xz' isnow 'stage3-latest.tar.xz')

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    31 de 62 01/02/14 12:55

  • When both downloads have nished quit elinks by typing q. The downloaded les shouldbe located in /mnt/funtoo. Now that this is done, let us move on to installing your basesystem.Installing the base systemNow that we have the base system and the portage tree downloaded, we will install it.First install the stage3. it is really easy.# tar xfvpJ stage3-latest.tar.xz

    That will output many lines, and return a command-prompt line when nished.Next we need to extract the funtoo-portage-tree. For that we need to change to thefuture /usr dir, and extract there the portage.# cd /mnt/funtoo/usr# tar xfvpJ ../portage-latest.tar.xz

    This time there will be no output, but when the unpacking has nished, the result will bean empty command prompt. We still need to checkout the tree, but this can only be donefrom inside the chroot environment.At this state of the setup we have setup most of our system. If you choose to use the fastgenkernel method later on, the hardest part is already done. If you choose to manuallycongure the kernel, you still have quite a bit work ahead of you.ChrootingBefore we can nally chroot into your system, there are a couple of things that need to

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    32 de 62 01/02/14 12:55

  • be done before, like mounting the proc and dev lesystem.# mount -t proc none /mnt/funtoo/proc# mount --bind /dev /mnt/funtoo/dev

    to have a working network inside of your chrooted system later you need to copy theresolv.conf le too:# cp -L /etc/resolv.conf /mnt/funtoo/etc

    Now we can chroot into your Funtoo system# env -i HOME=/root TERM=$TERM SHELL=/bin/bash # chroot /mnt/funtoo /bin/bash

    Now that we are inside your new system, you'll need to update your environment, usethe following commands to do so:# source /etc/profile# env-update

    We also recommend you to change the default command prompt while you are inside thechroot, as it will avoid confusions if you have to change terminals for anything. To do souse the following command:# export PS1="(chroot) $PS1"

    Congratulations! You are now inside your new Funtoo Linux operating system.Updating the Portage treeAs we have insalled the Portage snapshot during the installation, we now need to"activate" the Portage tree by selecting the funtoo.org branch.By default, the master branch is enabled, which saves space when storing the treeinside a tarball, but that branch only contains a README with the same instructions asthe ones given here.To activate the funtoo.org branch, do the following:# cd /usr/portage/# git checkout funtoo.org Checking out files: 100% (85007/85007), done. Switched to branch "funtoo.org"

    You'll now be able to see thousands of glorious ebuilds inside your Portage tree :)After activating the funtoo.org branch you need to sync your tree to the newest gloriousfuntoo ebuilds. Run:# emerge --sync

    This will now update the tree to the current state, which normally changes twice a day.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    33 de 62 01/02/14 12:55

  • Setting the default optionsLike any other Linux Distribution, Funtoo Linux has it's share of conguration les, thatneed to be edited by you. The following table gives you an overview of these les and forwhat they are there:

    File Description/etc/make.conf Parameters used by gcc compiler/etc/fstab Device to mountpoint denitions/etc/conf.d/hostname Setting your hostname/etc/rc.conf OpenRC conguration le./etc/conf.d/keymaps Keyboard conguration le./etc/conf.d/hwclock System clock to use./etc/conf.d/consolefont

    Fonts to be used in console display. This doesn't aect GUIterminal emulators.

    /etc/env.d/99editor Default editor./etc/localtime Your timezone./etc/make.prole Type of installation (desktop, server...)./etc/conf.d/modules Kernel modules to load/etc/locale.gen Localization./etc/env.d/02locales Localization for old programs.

    If you are installing an english Funtoo, you are lucky, as you won't need to edit many ofthe les above, if not, don't be afraid, we will walk through the conguration of theseles in the following together.First we will get a mighty editor with great syntax highlighting as it is not provided inour main system we will merge it, if you don't like to please replace in the following editsections the part vim with your editor where editor isreplaced by vi or nano -w.First let us get vim so we have the perfect highlighting from it for our personal help.# emerge -avt vim

    that will result in an output like that

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    34 de 62 01/02/14 12:55

  • just accept the output with Enter and it will install vim for you, while you wait for vim toget emerged, here are the some basic usage instructions for ViM. ViM has a multimodeinterface, if you start it, it is in Command mode, the second mode is the Edit mode which youwill enter from the Command mode by pressing i, to go back into the Command mode press ESC.After you have edited a cong le, you want to save it, for that you have to be in Commandmode and then simple press :w, it will save the le, a closing is done with :q, ifyou changed content in the le that shouldn't be saved use :q! and for saving andclosing the le :wq, thats all, the visual mode is in that context not very useful, so weleave it out. Now that you know the basic usage of ViM and it has emerged we will nowstart conguring the cong les./etc/make.confFirst open that le# vim /etc/make.conf

    This le contains something similar to the following. You may or may not have aCFLAGS variable set already depending on what stage 3 tarball you used:ACCEPT_KEYWORDS="~amd64"SYNC="git://github.com/funtoo/portage-mini-2010.git"CHOST="x86_64-pc-linux-gnu"

    Note:In ACCEPT_KEYWORDS, ~amd64 is used for current 64-bit builds; There is notilde for the stable build. The default value is (~)x86 for 32 bit. TheACCEPT_KEYWORDS line should not be altered. Keep it as supplied in thedefault le. It is also important to not change the CHOST line.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    35 de 62 01/02/14 12:55

  • CFLAGSIf you're only building packages for your host processor and not any others then therecommended CFLAGS setting is:CFLAGS="-march=native -O2 -pipe"

    Since gcc-4.2 (http://gcc.gnu.org/gcc-4.2/changes.html) , -mtune=native and-march=native will produce code optimized for the host processor. -mtune=native hasno eect if GCC does not recognize the processor. More information can be found in theGCC online docs (http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options) .Note: The value native selects the best architecture option for the host processor, sothis should not be used if you intend to compile packages for a dierent CPU.

    CXXFLAGSNormally, this ag is set to the same values as CFLAGS:CXXFLAGS="${CFLAGS}"

    MAKEOPTSWith MAKEOPTS you dene how many parallel compilations should occur when you compilea package. A good choice is the number of CPUs (or CPU threads) in your system plusone (Note: this guideline isn't always perfect). If for example you have a dual coreprocessor without hyperthreading, then you would set MAKEOPTS to 3:MAKEOPTS="-j3"

    If you're unsure of how many processors/threads you have, then use /proc/cpuinfo tohelp you.# cat /proc/cpuinfo | grep "model name" | wc -l16

    Set MAKEOPTS to this number plus one:MAKEOPTS="-j17"

    USEUSE ags dene what functionality is enabled when ebuilds are built. It is notrecommended to add a lot of them during installation. You should wait until you have aworking, bootable system to do so. The following USE ags are a recommended startingpoint for new systems:USE="-gnome -gtk -kde -kdeenablefinal -ldap nls -qt3 -qt3support -qt4 userlocales"

    The minus(-) sign tells gcc not to use the ag when compiling. USE ags gnome, gtk, kde, qt3,qt3support, and qt4 will be set later if you install a desktop envrionment.A Funtoo guide to USE ags will be available in the future. For now, you can nd out moreinformation about USE ags in the Gentoo Handbook (http://www.gentoo.org/doc/en

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    36 de 62 01/02/14 12:55

  • /handbook/handbook-amd64.xml?part=2&chap=2) .GENTOO_MIRRORSThis is the mirror from which emerge gets a lot of the source les. It is usually notnecessary to set this ag. In the following ewxample, the Waterloo University is used (afast and reliable Canadian mirror). Please set this variable to a mirror local to yourcountry.GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://distfiles.gentoo.org"

    LINGUASLINGUAS tells Portage which local language to compile the system and applications in(those who use LINGUAS variable like OpenOce). It is not usually necessary to set thisif you use English. Otherwise, if you want another language, replace fr (French) for thecode of your mother language, e.g. de for German.LINGUAS="fr"

    or for multiple language support you might also use:LINGUAS="en de fr"

    /etc/make.conf exampleAn example of a /etc/make.conf le could look like that:# These settings were set by the metro build script that automatically built this stage.# Please consult /etc/make.conf.example for a more detailed example.ACCEPT_KEYWORDS="x86"FEATURES="mini-manifest"SYNC="git://github.com/funtoo/portage-mini-2010.git"CHOST="i686-pc-linux-gnu"CFLAGS="-march=i686 -O2 -pipe"CXXFLAGS="${CFLAGS}"MAKEOPTS="-j2"USE="-gnome -gtk -kde -kdeenablefinal -ldap nls -qt3 -qt3support -qt4 userlocales"GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://distfiles.gentoo.org"LINGUAS="fr"INPUT_DEVICES="evdev synaptics"VIDEO_CARDS="vesa radeon"PORT_LOGDIR="/var/log/portage"PORTAGE_ELOG_CLASSES="log warn error info"PORTAGE_ELOG_SYSTEM="echo:log,warn save:log,warn,error,info syslog:error"

    /etc/fstabThis le is used for the conguration of the mountpoints for the system. As we have twodierent setups described above, here are the two examples for these.# vim /etc/fstab

    unencrypted MBR# The root filesystem should have a pass number of either 0 or 1.# All other filesystems should have a pass number of 0 or greater than 1.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    37 de 62 01/02/14 12:55

  • ## NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.## See the manpage fstab(5) for more information.## /dev/sda1 /boot ext2 noauto,noatime 1 2/dev/sda2 none swap sw 0 0/dev/sda3 / ext4 noatime 0 1/dev/sda5 /usr/portage ext4 noatime 0 1/dev/sda6 /home xfs defaults,noatime 0 1#/dev/cdrom /mnt/cdrom auto noauto,ro 0 0none /dev/shm tmpfs nodev,nosuid,noexec 0 0

    unencrypted GPT# The root filesystem should have a pass number of either 0 or 1.# All other filesystems should have a pass number of 0 or greater than 1.## NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.## See the manpage fstab(5) for more information.## /dev/sda1 /boot ext2 noauto,noatime 1 2/dev/sda3 none swap sw 0 0/dev/sda4 / ext4 noatime 0 1/dev/sda5 /usr/portage ext4 noatime 0 1/dev/sda6 /home xfs defaults,noatime 0 1#/dev/cdrom /mnt/cdrom auto noauto,ro 0 0none /dev/shm tmpfs nodev,nosuid,noexec 0 0

    encryptedThat time the setup is the same for both MBR and GPT partition layout:# The root filesystem should have a pass number of either 0 or 1.# All other filesystems should have a pass number of 0 or greater than 1.## NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.## See the manpage fstab(5) for more information.## /dev/sda1 /boot ext2 noauto,noatime 1 2/dev/mapper/vg-swap none swap sw 0 0/dev/mapper/vg-root / ext4 noatime 0 1/dev/mapper/vg-portage /usr/portage ext4 noatime 0 1/dev/mapper/vg-home /home xfs defaults,noatime 0 1#/dev/cdrom /mnt/cdrom auto noauto,ro 0 0none /dev/shm tmpfs nodev,nosuid,noexec 0 0

    /etc/conf.d/hostnameHere you will set up your hostname for the PC. So choose a name for your PC and set itup in that le:# vim /etc/conf.d/hostname

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    38 de 62 01/02/14 12:55

  • # Set to the hostname of this machinehostname=""

    /etc/rc.confYou may use this le as-is. However, it is a good idea to set rc_logger to yes. That willcreate a log le which is handy when problems are encountered with OpenRC scripts.Very helpful for xing things.Another good option here is the rc_interactive ag, if you are playing around with a newgraphical display manager or aren't that used with the upgrade procedure of thegraphical environement. if rc_interactive is set to yes, you will be able to interactivelymanipulate the boot process, what means you can decide what you want to start or not,like the graphical environment for example.Other options have really good explainations inside of the /etc/rc.conf le./etc/conf.d/keymapsYou do not have to alter that le if you have a US English keyboard. Otherwise, edit leand set keymap to your keyboard model. For example, cf for French Canadian keyboard, frfor French Azerty and de for German Qwertz./etc/conf.d/hwclockIf you dual boot with Windows, you'll need to edit this le and change clock to local.Otherwise you should not normally need to edit this le.You should dene your timezone in /etc/timezone:# vim /etc/timezoneEurope/Berlin

    anoteher value might beAmerica/Denver

    so you might get an idea how it should look like, if not have a look at /usr/share/zoneinfo itwill give you the entry after the path like /usr/share/zoneinfo/ likefor Germany you will nd a path in there that looks like /usr/share/zoneinfo/Europe/Berlin./etc/conf.d/consolefontThere is nothing to edit in that le./etc/env.d/99editorCreate and edit that le to instruct your system about the default editor it should use.vim /etc/env.d/99editor

    Type in :EDITOR="/usr/bin/vim"

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    39 de 62 01/02/14 12:55

  • Replace the above line with the editor of your choice, if you had been happy so far withViM just paste it in as is, if not use nano, vi or what else you like./etc/localtimeIf you came here from Gentoo, it was advised to copy the le from the zoneinfo dir tohere. We advise you to create a symbolic link from the zoneinfo dir to /etc/localtime. As inthe hwclock section above, we need your timezone parted in LAND/TOWN like forGermany Europe/Berlin. Now, create the symbolic link. More info about it can be foundin the /usr/share/zoneinfo dir.ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

    That command sets the timezone to Central European Time./etc/make.proleHere you select which type of environment you want the gcc-compiler to take intoaccount. That will dress up an environment with a list of pre-dened USE ags.To list all available proles run:eselect profile list

    The output will look like that:[1] default/linux/x86/2008.0 *[2] default/linux/x86/2008.0/desktop[3] default/linux/x86/2008.0/developer[4] default/linux/x86/2008.0/server

    Prole defaults to 2008.0 (See the star). To create a prole for DE (DesktopEnvironment) run:eselect profile set 2

    Warning: Funtoo only supports the 2008.0 prole and the 2008.0 prole children.Use one of these proles until 'funtoo-1.0' is ready./etc/conf.d/modulesWith Funtoo, OpenRC loads modules from /etc/conf.d/modules using the line:modules_2_6="list of modules"

    With Funtoo, dene module arguments as follows:module_module-name_args_2_6="module arg=value"

    Localization/etc/locale.gen and /etc/env.d/02locales are used to support your local language. The lastone is required just in case there still are old programs installed.You do not need to amend anything if your locales are US English. The following are

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    40 de 62 01/02/14 12:55

  • examples for German. You can look in /usr/share/i18n/SUPPORTED for the default list ofsupported combinations or look in /usr/share/i18n/locales to determine values to use.# vim /etc/locale.gen

    Put this value into the le for German support:de_DE.UTF-8 UTF-8

    for a multiple language support it might look like that:de_DE.UTF-8 UTF-8fr_CA.UTF-8 UTF-8en_US.UTF-8 UTF-8

    Edit /etc/env.d/02locales according to that layout:# vim /etc/env.d/02locales

    and put in these lines:LANG="de_DE.UTF-8"LANGUAGE="de_DE.UTF-8"

    Finally after we editet all the localization les generate the localized environment:locale-gen && source /etc/profile

    KernelNow that you have the base system running, you need to install a kernel. If you decidedto use a standard setup with an unencrypted GPT disc layout or the old unencryptedMBR disc layout, a fast solution would be to use the genkernel solution. If you used thestandard setup with an encrypted GPT disc layout or the old encrypted MBR disc layout,you have to use the manual kernel steps.choosing a kernelFirst, you need to choose a kernel version you would like to install on your system. Thefollowing table will give you an overview of which kernels are available and who shoulduse them.

    Kernelebuild Description masked

    PreferedUsers

    eselectkernel set

    sys-kernel/* generatessymlink

    cell-sourcesFull sources including thecell/ps3 patchset for the 2.6kernel tree

    [Masked]

    unsure

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    41 de 62 01/02/14 12:55

  • ck-sourcesCon Kolivas' highperformance patchset +Gentoo patchset sources

    unsure

    debian-sources

    Debian Sources - withoptional OpenVZ support NO

    gentoo-sources

    Full sources including theGentoo patchset for the 2.6kernel tree

    default for mostusers YES

    git-sources The very latest -git version ofthe Linux kernelfor the verseduser YES

    hardened-sources

    Hardened kernel sources(kernel series 2.6)

    not supportedatm YES

    mips-sourcesLinux-Mips GIT sources forMIPS-based machines, dated20110207

    [Masked]

    unsure

    mm-sourcesAndrew Morton's kernel,mostly xes for 2.6 vanilla,some vm stu too

    unsure

    openvz-sources

    Full sources includingOpenVZ patchset for the2.6.18 kernel tree

    For users thatwant to build aOpenVZ server

    unsure

    pf-sourcesLinux kernel fork with newfeatures, including the -ckpatchset (BFS), BFQ,TuxOnIce and LinuxIMQ

    unsure

    rhel5-openvz-binaries

    RHEL5 kernel with OpenVZpatchset - initrd and bzImage YES

    rhel5-openvz-sources

    Full Linux kernel sources -RHEL5 kernel with OpenVZpatchset

    unsure

    rhel6-openvz-binaries

    RHEL6 kernel with OpenVZpatchset - initrd and bzImage unsure

    rhel6-openvz-sources

    Full Linux kernel sources -RHEL5 kernel with OpenVZpatchset

    unsure

    sparc-sources Full sources for the GentooSparc Linux kernel[Masked]

    YES

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    42 de 62 01/02/14 12:55

  • sysrescue-std-binaries

    System Rescue CD Fullsources for the Linux kernel,including gentoo andsysresccd patches - initrd andbzImage

    [Masked]

    unsure

    sysrescue-std-sources

    System Rescue CD Fullsources for the Linux kernel,including gentoo andsysresccd patches.

    unsure

    tuxonice-sources

    TuxOnIce + Gentoo patchsetsources unsure

    usermode-sources

    Full sources for the UserMode Linux kernel

    [Masked]

    unsure

    vanilla-sources

    Full sources for the Linuxkernel YES

    vserver-sources

    Full sources including Gentooand Linux-VServer patchsetsfor the 2.6 kernel tree.

    unsure

    xbox-sources Full sources for the XboxLinux kernel[Masked]

    unsure

    xen-sources Full sources for a dom0/domULinux kernel to run under Xen unsurezen-sources The Zen Kernel Sources v2.6 unsure

    For the next section, we will assume that you selected gentoo-sources for your kernelsetup. If not, please replace gentoo-sources in the next section with your selection. Ifyou are unsure, please follow our suggestion to use the gentoo-sources.genkernelThat part would be fast done in general, we will now guide you through that process.First, we need to install the needed tools for it. So, let's do it!# emerge -avt genkernel gentoo-sourcesCalculating dependencies... done!These are the packages that would be merged, in reverse order:[ebuild N ] sys-kernel/gentoo-sources-2.6.38-r4 USE="-build -deblob -symlink" 134 kB[ebuild N ] sys-kernel/genkernel-3.4.12.6-r2 USE="-bash-completion (-ibm) (-selinux)" 11,556 kBTotal: 2 packages (2 new), Size of downloads: 11,690 kBWould you like to merge these packages? [Yes/No]

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    43 de 62 01/02/14 12:55

  • After answering the above question with "Yes", it will download and install the packagesfor you. Next, you need to set the symlink from /usr/src/linux to the /usr/src/linux-version directory. There are two ways to do so. If you have selected a version that issupported by eselect, it would be really simple for you, just do:# eselect kernel list# eselect kernel set 1

    The rst command should list the kernel you have selected. If that isn't the case, thesecond command to set this kernel version isn't needed, else the second one sets thesymlink automatically for you. As eselect kernel command will scan your /usr/src directory, itshould list every kernel-sources listed above, if that isn't the case, please report thefailing to the funtoo-dev mailing list (http://groups.google.com/group/funtoo-dev) ,Funtoo Forums (http://forums.funtoo.org) or contact us directly in IRC at #funtoo(irc://irc.freenode.net/funtoo) . As a workaround you could use the following steps tomake your kernel-sources usable:# cd /usr/src# rm linux# lslinux-sources# ln -s linux-sources linux

    where linux-sources is the directory that the ls command above showed you.When you nished the selection of your kernel you will now bake your rst kernel, usingthe genkernel or fast way. Execute for that the following command:# genkernel --menuconfig all

    if you have a special cong predened use# genkernel --kernel-config=config-name --menuconfig all

    else if you have choosen an encrypted setup, use the following command to include allthe tools you need for bootup:# genkernel --lvm --luks --menuconfig all

    the above used options are doing the following:--kernel-cong: use the given name located in the kernel source tree (/usr/src/linuxby default is taken unless overridden by --kerndir)all: rebuild the kernel image and the initramfs ramdisk image (aside of kernelmodules, the ramdisk image contains tools such as BusyBox and some genericstartup scripts, depending on options you use on the command line severaladditional tools like lvm or raid volume management can be incorporated as well).--lvm: Includes support for storage using via Logical Volume Management (LVM2)from static binaries, if available to the system. Relevant (static) LVM2 binaries arecompiled if they are unavailable. Be sure to install the lvm2 package on yoursystem with emerge lvm2 before enabling this ag.--luks: Includes support for Linux Unied Key Setup or LUKS. This will allow you to

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    44 de 62 01/02/14 12:55

  • use a device encrypted by LUKS which contains the root lesystem. On thebootloader, you then set that encrypted device as the value of crypt_root (andreal_root shall be the unencrypted device LUKS creates).--menucong: lets you set options for kernel compile manual

    The --menuoption will present you the following screen:

    default options for unencrypted/encrypted setupWe advized you above to use a partitioning scheme based on the following le systemtypes:

    ext2swapext4xfs

    You now need to activate all of them so you can boot your system later, these optionscan be found at:Kernel option: File Systems ---> Second extended fs support The Extended 4 (ext4) lesystem[*] Ext4 extended attributes (NEW)[ ] Ext4 POSIX Access Control Lists (NEW)[ ] Ext4 Security Labels (NEW)[ ] EXT4 debugging support (NEW) XFS lesystem support

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    45 de 62 01/02/14 12:55

  • [ ] XFS Quota support (NEW)[ ] XFS POSIX ACL support (NEW)[*] XFS Realtime subvolume support[ ] XFS Debugging support (EXPERIMENTAL) (NEW)

    If you furthermore decided to follow our advice and to use a GPT-Partitioning scheme,which will be your default, you will need to activate it in your kernel by using thefollowing options:

    Kernel option: File Systems ---> Partition Types --->[*] Advanced Partition Selection (PARTITION_ADVANCED)[*] EFI GUID Partition Support (EFI_PARTITION)

    additional encrypted optionsIt is very important to add the following parts in your kernel setup, when you used theabove GPT or MBR encrypted setup. UnderKernel option: General setup --->[*] Initial RAM lesystem and RAM disk (initramfs/initrd) support

    and under

    Kernel option: Device Drivers ---> [*] Multiple devices driver support Device Mapper Support Crypt target support

    and nally underKernel option: -*- Cryptographic API ---> XTS support (EXPERIMENTAL)-*- AES cipher algorithms

    Finally exit the menucong for your kernel and get a coee. You have done a good bit ofwork so far... :)manual kernelYou can use genkernel to automatically compile your kernel, but this tends to create abloated kernel, compatible with just about any computer, anyplace, any time. On theother hand, you can manually congure and compile your kernel, to give you completecontrol, for the smallest and fastest kernel(s) that you can build for your speciccomputer. However, manual kernel conguration is often called by many users, thehardest step in installing Funtoo. But it is also very worth learning how to do it. Bewarned that it make take several recongurations, compiles and reboots, until you havea working system. Plus, for the encrypted hdd version, you will have to do a bit morework than above, but if you have gotten this far, you should be able to handle it.install and cong

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    46 de 62 01/02/14 12:55

  • First you will have to install the kernel image you selected above. In the following weagain use the kernel we think might be the default choice of you, gentoo-sources, butyou can feel free to replace it with any of the above ones. So now install your kernel-sources:# emerge -avt gentoo-sources

    After answering the above question with Yes, emerge will download and install thekernel-sources for you. Next you need to set the symlink from /usr/src/linux to the/usr/src/linux-version directory. There are two ways to do so, the default way would be touse the following command sequence:# eselect kernel list# eselect kernel set 1

    The rst command will list the kernel or kernels for which you have used emerge toinstall the corresponding source code packages. The character * is used to indicate thecurrently selected default kernel package. In other words, the command eselect kernellist will scan and list directories in your /usr/src directory , each named after a dierentkernel source code. It will then show with a * the directory currently pointed to by the/usr/src/linux link. The second command is not needed, as long as the correct kernelsource has been selected. Otherwise, use this command and the number of thecorresponding kernel directory, to set your /usr/src/linux link.If the eselect kernel command does not work correctly, please report the failing to thefuntoo-dev mailing list (http://groups.google.com/group/funtoo-dev) , Funtoo Forums(http://forums.funtoo.org) or contact us directly in IRC at #funtoo (irc://irc.freenode.net/funtoo) .As a workaround or for educational purposes, you could use the following equivalentcommands. For example, to make gentoo-sources available for compiling your kernel,enter:# cd /usr/src# rm linux# lsgentoo-sources-3.5.4# ln -s gentoo-sources-3.5.4 linux

    where gentoo-sources is the directory that the ls command above showed you.Now you are nearly ready to congure your kernel. First switch to a second terminalwith Alt+F2 and execute lspci and copy the output, most importantly the names of theVGA, Ethernet and Network devices currently in your system. Knowing these devicenames will be needed if you need help for default options at the Debian GNU/Linuxdevice driver check page (http://kmuto.jp/debian/hcl/) . Some options there aren't inyour kernel or may have other names but it is a good source for getting default optionshelp for devices.

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    47 de 62 01/02/14 12:55

  • Now move back to your chrooted system (Alt+F1) and start the congure process with# cd /usr/src/linux# make menuconfig

    This will present you a screen similar to the following:

    start setting the options you know about or the ones the page above gave you. You needto at least set the following options:Here are some more sources you may like to read for conguring your kernel the old

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    48 de 62 01/02/14 12:55

  • fashioned manual way:http://kernel-seeds.org (http://kernel-seeds.org/)http://swift.siphos.be/linux_sea/ch07.htmlhttp://www.gentoo.org/doc/en/kernel-cong.xml

    default options for unencrypted/encrypted setupWe advised above to use a partitioning scheme based on the following lesystemtypes:

    ext2swapext4xfs

    You now need to activate all of them so you can boot your system later, these optionscan be fount at:Kernel option: File Systems ---> Second extended fs support The Extended 4 (ext4) lesystem[*] Ext4 extended attributes (NEW)[ ] Ext4 POSIX Access Control Lists (NEW)[ ] Ext4 Security Labels (NEW)[ ] EXT4 debugging support (NEW) XFS lesystem support[ ] XFS Quota support (NEW)[ ] XFS POSIX ACL support (NEW)[*] XFS Realtime subvolume support[ ] XFS Debugging support (EXPERIMENTAL) (NEW)

    If you furthermore decided to follow our advice and use a GPT-Partitioning scheme, whatwill be our default, you need to activate it in your kernel by using the following options:

    Kernel option: File Systems ---> (or Enable the block layer --->) Partition Types --->[*] Advanced Partition Selection (PARTITION_ADVANCED)[*] EFI GUID Partition Support (EFI_PARTITION)

    additional encrypted optionsIt is very important to add the following parts in your kernel setup, when you used theabove GPT or MBR encrypted setup. UnderKernel option: General setup --->[*] Initial RAM lesystem and RAM disk (initramfs/initrd) support

    and underKernel option: Device Drivers --->

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    49 de 62 01/02/14 12:55

  • [*] Multiple devices driver support Device Mapper Support Crypt target support

    and naly underKernel option: -*- Cryptographic API ---> XTS support (EXPERIMENTAL)-*- AES cipher algorithms

    building the kernel the manual wayNow that all the options are set exit menuconfig and answer the question about savingyour cong with YES. That already was the hardest part, now bake your kernel.# make# make modules_install# cp arch//boot/bzImage /boot/bzImage-

    This code-sequence will need to be explained, the rst command make will bake yourkernel, it will take some time, so feel free to get a coee. :) if you don't have oneavailable here is one from us |_|). make modules_install generates the modules for thekernel and builds them, the third command in the sequence needs to be adjusted by you,if you use a 32bit system replace with x86 and for 64bit systems withx86_64, nally replace the -string with a for you readable and uniqueversionnumber like 2.6.38-rc7-mykernel-v1 or something like that, then the commandcopies over your baked kernel to /boot and you are ready to get to the next step....Bootloaderboot-updateboot-update is the default boot-loader conguration tool in funtoo. You need to install itwith# emerge -avt boot-update

    This will install boot-update and grub2 for you. Next you need to congure it. That isdone in /etc/boot.conf:# vim /etc/boot.conf

    /etc/boot.conf will look somewhat like the following:boot {

    generate grubdefault "Funtoo Linux 64-bit" timeout 10

    }display {

    gfxmode 1440x900

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    50 de 62 01/02/14 12:55

  • #background /boot/}color {

    normal cyan/blackhighlight black/cyan

    }default {

    scan /bootkernel bzImage[-v] kernel[-v] vmlinuz[-v]initrd initramfs[-v]# root=auto will cause the parameter # from your /etc/fstab. rootfstype=params video=vesafb root=auto rootfstype=auto# an alternate graphics mode can be set# default is inherited from display:# gfxmode 1024x768

    }"altboot" {

    params += init=/bin/bash}"Funtoo Linux 64-bit gpt" { kernel bzImage[-v]}"Funtoo Linux genkernel" { kernel kernel[-v] initrd initramfs[-v] params += real_root=auto}"Funtoo Linux 64-bit encrypted gpt/mbr manual kernel" {

    kernel bzImage[-v]initrd /initramfs.cpio.gzparams += enc_root=/dev/sda3 lvm luks root=/dev/mapper/vg-root rootfstype=ext4 resume=swap:/dev/mapper/vg-sw

    }

    If you decided to do a manual kernel, with an encrypted HDD, you will need to read thenext section after you made the changes to your cong. If you decided to use genkernelor a manual kernel with unencrypted HDD, all is OK and it is now safe for you to go tothe Grub2 setup.encrypted disk with manual kernelAs you decided to make an encrypted disk setup with a manual kernel, you need toinstal slashbeast's better-initrmafs (http://github.com/slashbeast/better-initramfs) . It isvery simple to do. First clone the git-repository. If you aren't condent with git, feel freeto have a look at our Git Guide.# install -d /root/.git# cd /root/.git# git clone git://github.com/slashbeast/better-initramfs.git# cd better-initramfs# git checkout v0.3# less README.rst

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    51 de 62 01/02/14 12:55

  • # echo "sys-apps/busybox static" >> /etc/portage/package.use/busybox && echo "sys-fs/cryptsetup static" >> /etc/port# emerge -avt busybox cryptsetup lvm2# make>>> New better-initramfs is not backward compatible, read ChangeLog file.>>> Preparing binary files...>>> Adding /bin/busybox...>>> Adding /sbin/cryptsetup...>>> Adding /sbin/lvm.static...>>> Building image...>>> initramfs.cpio.gz is ready.# cp initramfs.cpio.gz /boot

    Now you are ready to setup grub2. Just go to the next section.= Updating better-initramfs =As the better-initrmafs (http://github.com/slashbeast/better-initramfs) project isn'tcontrolled at the moment by an ebuild, you will need to take care of updating it byyourself, but it is very easy to do so:# git checkout master# git pull# less ChangeLog# git checkout vx.x# make

    where x.x is a version announced in the ChangeLog. At the moment the stable is 0.3.setting up grub2This step is easy. It is done with two commands;# grub-install --no-floppy /dev/sda# boot-update

    A successful run of boot-update might will look like this: boot-update 1.5.2 / Copyright 2009-2011 Funtoo Technologies [use option "-l" for license info, "-h" for help] * Generating config for grub... DEFAULT > Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-a2b9c1f Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-446cc63 Funtoo Linux 64-bit - bzImage-2.6.39-rc7-git-df8d06a * WARN : multiple matches found for default "Funtoo Linux 64-bit" - most recent used. * Completed successfully with warnings.

    ExtlinuxFor Extlinux you will nd a guide for setup at Extlinux.

    nalize SetupNecessary System Tools

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    52 de 62 01/02/14 12:55

  • As some tools are providing the same functionality, it is up to you to choose which onesyou like to use. The next sections are giving you an overview of tools you might like touse and install, but all are optional.System LoggerLinux and Unix have an excellent history of logging capabilities, if you want you can logfrom only special stu up to everything that happens on your system in logles, for thatbehavior is a system logger the reason.There are several in our repository from which you can choose:

    sysklogd, which is a traditional set of system logging daemons,syslog-ng, which is an advanced system logger andmetalog, which is a highly-congurable system logger,rsyslog, seems to be a popular choice, default syslog of Fedora, RHEL, openSUSE,Debian and Ubuntuthere might be others available too, but at the moment we aren't aware of them.

    We advice you to install next to sysklogd or syslog-ng the logrotate tool, as those systemloggers don't provide a rotation machanism for the log les.Just install the desired one like the example shows:# emerge syslog-ng# rc-update add syslog-ng default

    Optional: Cron DaemonAlthough this is optional it is in our opinion very handy and wise to install one. But youmight ask yourself now "What the hell is a cron daemon?" A cron daemon just executesscheduled commands, so you see it can be very handy if you need to execute commandsregularly.In our tree there are three possible cron daemons; dcron, fcron and vixie-cron. Wewould like to advise you to use fcron, but it depends on what you like. also vixie-cronmight be easier, as you don't need to execute crontab /etc/crontab, fcron might be morepowerful.# emerge fcron# rc-update add fcron default# crontab /etc/crontab

    Optional: File IndexingIf you like to index your les for a fast search, you need to install mlocate so you can usethe locate command to quickly search for them:# emerge mlocate# updatedb

    File System Tools ==As we used some special lesystems above you need to at least install xfsprogs, but

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    53 de 62 01/02/14 12:55

  • there might be some others too, the following table gives you an overview:File System Tool install command neededXFS xfsprogs emerge xfsprogs XJFS jfsprogs emerge jfsprogsreiserfs reiserfsprogs emerge reiserfsprogsbtrfs btrfs-progs emerge btrfs-progsNetworkcongThe Easy (Dynamic) WayWhen conguring your network, one option is to skip traditional network congurationand simply rely on DHCP. This is by far the simplest method of conguring yournetwork. If you are on a wired network, no other steps are typically required beyondenabling a DHCP client, and Funtoo Linux includes dhcpcd 5.x by default. To enableDHCP at system startup, you would add dhcpcd to your default runlevel as follows:# rc-update add dhcpcd default

    Template:NoteThe Modular WayDHCP isn't always an option, and for these situations, Funtoo Linux oers its ownmodular, template-based network conguration system. This system oers a lot ofexibility for conguring network interfaces, essentially serving as a "network interfaceconstruction kit." This system can be used by itself, or even combined with dhcpcd -- ifyou limit dhcpcd to only manage certain network interfaces.Here are the key components of the template-based network conguration system:

    /etc/init.d/netif.lo -- An init script that congures the localhost interface.1./etc/netif.d -- This is a directory that contains various network congurationtemplates. Each of these templates is focused on conguring a particular type ofnetwork interface, such as a general static IP-based interface, a bridge interface, abond interface, etc.

    2.

    /etc/init.d/netif.tmpl -- This is the master init script for the template-based networkconguration system. New interfaces are added to your system by creatingsymbolic links to this le in /etc/init.d.

    3.

    So, if you wanted to use this system to congure eth0 with a static IP address, youwould create a netif.eth0 symlink to netif.tmpl as follows:# cd /etc/init.d# ln -s netif.tmpl netif.eth0

    Then, you would create an /etc/conf.d/netif.eth0 conguration le that would specifywhich template to use from the /etc/netif.d directory:

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    54 de 62 01/02/14 12:55

  • template="interface"ipaddr="10.0.1.200/24"gateway="10.0.1.1"nameservers="10.0.1.1 10.0.1.2"domain="funtoo.org"

    To complete our static IP network conguration we would need to:# rc-update add netif.eth0 default

    When conguring your own static network interface, one of ipaddr or ipaddrs isrequired and should specify the IP address(es) to congure for this interface, in"a.b.c.d/netmask" format. Optional parameters include gateway, which denes a defaultgateway for your entire network, and if set should specify the gateway's IP address. Inaddition, domain and nameservers (space-separated if more than one) can be used tospecify DNS information for this interface.Conguration VariablesInterface VariablesThe following variables are supported by the interface and bridge templates:

    ipaddr or ipaddrs: specify IPv4 or IPv6 address(es) for the interface. IP addressesshould be specied in "IP/netmask" format, such as "10.0.0.1/24". Multiple IPaddresses can be specied like this:

    ipaddrs="10.0.0.1/24 10.0.0.2/24"

    Note that in some cases, you may choose to not specify ipaddr or ipaddrs for a bridgetemplate. That is allowed. If you don't want to specify an IP address for a regularinterface, you can choose to use the interface template without an IP address speciedin the cong, or use the interface-noip template instead, for the sake of clarity.Also note that if you specify multiple IP addresses, ifcong will only show the rst IPaddress. To view all IP addresses associated with the interface, use the ip addr showcommand.General VariablesThe following variables are enabled by default for all network scripts, and if speciedwill trigger a corresponding conguration action: nameservers: Set DNS nameserversusing OpenResolv. Specify multiple nameservers like this: "1.2.3.4 1.2.3.5 1.2.3.6"

    domain: Set DNS domain using OpenResolv.gateway: Dene a default IP gateway.route: Specify a semi-colon delimited list of routes to apply when this interface isbrought up. Will be appended to ip route add.mtu: Set Maximum Transmit Unit for the interfaceslaves: Set slave interfaces of this interface (for bridges, etc.) All slaves willautomatically be depended upon, and will also automatically have their mtu set tothat of the current interface, if an mtu is specied for the current interface. This

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    55 de 62 01/02/14 12:55

  • setting is required for the bond template and optional for the bridge template.

    VLAN VariablesVLAN support is enabled by default for all network conguration scripts. If a networkscript has a name in the format netif.ethX.Y, then it is assumed to be a VLAN interfacereferencing trunk ethX and VLAN ID Y. If you desire a custom name for your VLANinterface, you can name your interface whatever you'd like and specify the followingvariables in your interface cong [le: le:]

    trunk: VLAN trunk interface, e.g. "eth0"vlan: VLAN id, e.g. "32"

    OpenResolv and resolv.confFor the network conguration above, OpenResolv will be used to set DNS informationwhen the netif.eth0 is brought up. The OpenResolv framework will add entries to/etc/resolv.conf, and will also handle removing these entries when the interface isbrought down. This way, /etc/resolv.conf should always contain current information andshould not need to be manually edited by the system administrator. dhcpcd will useOpenResolv for updating system DNS information as well.Network-Dependent ServicesOne important dierence between Gentoo Linux and Funtoo Linux is that, in FuntooLinux, network-dependent services only strictly depend on netif.lo. This means that ifanother network service requires an interface to be up, such as samba requiring eth0,then the system administrator must specify this relationship by adding the following lineto /etc/conf.d/samba:rc_need="netif.eth0"

    This will have the eect of ensuring that netif.eth0 is started prior to samba and thatsamba is stopped prior to stopping netif.eth0.Many network services, especially those that listen on all network intefaces, don't needan rc_need line in order to function properly. Avoiding the use of rc_need when requiredwill optimize boot times and allow more network services to remain available whennetwork interfaces are brought up and down by the system administrator.

    Multiple Network CongurationsFor information on how to have multiple, independent network congurations, pleasesee Stacked Runlevels.Alternate CongsIf you need to run the same service with dierent conguration parameters dependingupon runlevel, then you'll be happy to know that you can specify runlevel-specic conf.dles by appending a . sux. In this particular example, we could imagine a

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    56 de 62 01/02/14 12:55

  • situation where we had two child runlevels named home and work:/etc/conf.d/netif.eth0.home/etc/conf.d/netif.eth0.work

    Note that this feature works for all init scripts, not just network conguration scripts.Interface RenamingFuntoo network scripts now support interface renaming, so you can create an interfacecalled lan if you would like. To so this, simply specify the MAC address of the interfaceyou would like to rename using the macaddr variable: macaddr="00:15:17:19:b6:a3" Ifthis MAC address is part of the netif.lan conguration le, then when this interfacestarts, whatever interface currently has the MAC address of 00:15:17:19:b6:a3 (i.e.eth5) will be renamed to lan prior to the interface being brought up, and will show up inifcong and ip commands as being an interface named lan.Basic VLAN CongurationThe standard interface template supports VLANs. To use VLAN support, rst congurethe trunk interface using the interface-noip template. Assuming eth1 is trunked, youwould create the le /etc/conf.d/netif.eth1 with the following contents:template="interface-noip"

    Then, create a network interface symlink for the trunk and add it to your defaultrunlevel:# cd /etc/init.d# ln -s netif.tmpl netif.eth1# rc-update add netif.eth1 default

    Now, assuming you wanted to congure a VLAN of 32, you would create a cong lenamed /etc/conf.d/netif.eth1.32 that looks something like this:template="interface"ipaddr="1.2.3.4/24"gateway="1.2.3.1"# etc...

    Then, create a VLAN network interface symlink and add it to your default runlevel:# cd /etc/init.d# ln -s netif.tmpl netif.eth1.32# rc-update add netif.eth1.32 default

    The Funtoo network conguration scripts will automatically recognize the lenamenetif.eth1.32 as being VLAN 32 of trunk interface netif.eth1.When the VLAN interface is brought up, it will be named eth1.32.Custom VLAN NamesHowever, sometimes you may want to turn o automatic le-based VLAN naming andgive your VLAN interface a custom name, such as mgmt. To do this, you would set upthe trunk interface in the exact same way as described above, but instead of creating anetif.eth1.32 interface, you would create a netif.mgmt interface, and specify vlan and

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    57 de 62 01/02/14 12:55

  • trunk in the /etc/conf.d/netif.mgmt cong le, as follows:template="interface"vlan="32"trunk="eth1"ipaddr="1.2.3.4/24"gateway="1.2.3.1"# etc...

    When you specify trunk and vlan in the interface cong le, lename-basedauto-detecting of VLAN ID and trunk is disabled. Both trunk and vlan must be specied-- you can't specify just one.Then you would simply create a VLAN network interface symlink for netif.mgmt:# cd /etc/init.d# ln -s netif.tmpl netif.mgmt# rc-update add netif.mgmt default

    When the VLAN interface is brought up, it will be named mgmt.More Complex Network CongurationIf the standard templates don't work for your needs, simply create a new template -- Irecommend starting from the interface template for most things:# cd /etc/netif.d# cp interface custom

    You can now call whatever commands you need to /etc/netif.d/custom. The followingshell functions can be dened in a network script:netif_createIn netif_create, you should call any commands to create the interface if it does not yetexist.netif_dependIn netif_depend, you can dene dependencies, using the functions need and use.netif_pre_upIn netif_pre_up, you can dene network conguration actions to perform prior tobringing the interface up. You can also ensure certain variables are specied by callingrequire var1 [var2...] here.netif_post_upIn netif_post_up, you can dene network conguration actions to perform after bringingthe interface up.netif_pre_downIn netif_pre_down, you can dene network conguration actions to perform prior to

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    58 de 62 01/02/14 12:55

  • bringing the interface down.netif_post_downIn netif_post_down, you can dene network conguration actions to perform afterbringing the interface down.netif_destroyIn netif_destroy, you can call any commands necessary to destroy/delete the interface ifit is dynamic in nature (tun/tap, etc.)How It WorksYou do not specify a function for actually bringing up the interface, because thetemplate-based system does this for you. The template-based system also performs allnormal actions for required for bringing an interface down, so only need to specifyatypical actions that must be performed - such as removing child interfaces ordestroying a bridge using brctl.When you create your own network conguration template, the following capabilitiesare available for use automatically, as long as the appropriate variables are set in the/etc/conf.d/netif. le,, without requiring any explicit steps on your part:

    DNS conguration using domain and nameservers cong settings. OpenResolv isused automatically.VLAN conguration using auto-naming (netif.ethX.Y) or via custom naming withtrunk and vlan cong settings.Default gateway and route conguration using the gateway and route settings.MTU conguration using the mtu setting.Auto-depend (and auto-MTU conguration) of slave interfaces specied usingslaves setting.Renaming of existing network interface (specify MAC address using macaddrsetting).

    To take advantage of this functionality, simply enable the appropriate variables.All other necessary network conguration and dependency behavior should be denedusing the netif_-prex functions described above.Wireless CongurationWireless network conguration requires additional steps to the ones outlined above.For wireless networks, you will need to enable wireless extensions in your kernel, theappropriate wireless modules, and emerge wireless-tools:# emerge wireless-tools

    I also recommend you emerge wpa_supplicant. wpa_supplicant implements modernWPA/WPA2 wireless link-layer encryption, which is necessary for connecting to mostmodern password-protected wireless networks:

    Installation (Tutorial) - Funtoo http://www.funtoo.org/Installation_(Tutorial)

    59 de 62 01/02/14 12:55

  • # emerge wpa_supplicant

    After emerging, add to your default runlevel as follows:# rc-update add wpa_supplicant default

    802.11 PassphrasesThe only remaining step is to use the wpa_passphrase utility to store hashed keys(passwords) that wpa_supplicant can use to connect to your favorite wireless networks.This is done as follows:# wpa_passphrase jims-netgear >> /etc/wpa_supplicant/wpa_supplicant.conf

    Now, when wpa_supplicant encounters an SSID of jims-netgear, it will use the passwordyou entered to authenticate with this access point.At this point, ensure that dhcpcd has been enabled in your current runlevel and type rcto start everything up. wpa_supplicant should be able to automatically associate withSSIDs in its cong le, at which point dhcpcd will take over and acquire an IP addressfrom a DHCP server. This should all happen seamlessly. Use the iwcong command tosee if you have successfully associated with an access point.

    Wireless FirmwareMany wireless adapters will now have everything they need to work. However, if youhave an Intel wireless adapter, th