SlideShare a Scribd company logo
Gentoo Linux
Installation Guide
Features of Gentoo Linux Distributions
Why Gentoo[link]
– OS Type: Linux
– Based on: Independent
– Origin: USA
– Architecture: i486, i586, i686, x86_64, alp
ha, arm, hppa, ia64, mips, powerpc, ppc6
4, sparc64
– Desktop: AfterStep, Awesome, Blackbox,
Enlightenment, Fluxbox, GNOME, IceWM,
KDEPlasma, LXDE, MATE, Openbox, WM
aker, Xfce
– Category: Desktop, Server, Source-based
– Status: Active
– Gentoo Linux is a versatile and fast,
completely free Linux distribution geared
towards developers and network
professionals.
– Unlike other distros, Gentoo Linux has an
advanced package management system
called Portage. Portage is a true ports
system in the tradition of BSD ports, but
is Python-based and sports a number of
advanced features including
dependencies, fine-grained package
management, "fake" (OpenBSD-style)
installs, safe unmerging, system profiles,
virtual packages, config file management,
and more.
Boot using minimal live CD
– Download minimal live
CD: https://www.gentoo.org/d
ownloads/
=> http://distfiles.gentoo.org/r
eleases/amd64/autobuilds/20
191002T214502Z/install-
amd64-minimal-
20191002T214502Z.iso
– VMware/VirtualBox
Preparation
– RAM => 2048mb
– HDD => VDI, dynamically
allocated, 256gb
– Choose the right language (fr,
us)
Add Partitions to Hard Disk
Using fdisk to partition the disk
– Command Lines
# fdisk /dev/sda
Goals 3 primary partitions
/dev/sda1 /boot 128M bootable, contain
the grub boot manager, kernel,
decryption software(cryptsetup)
/dev/sda2 swap(2G)
/dev/sda3 encrypted
Two ways of sorting the partitioning
information on a drive
MBR vs. GPT
– MBR(Master Boot Record)
– Special boot sector located at the beginning
of a drive
– The sector contains a boot loader for the
installed OS and information of the drive’s
logical partitions.
– The boot loader is a small bit of code that
generally loads the larger boot loader from
another partition on a drive
– For example,. If you have Windows
installed, the initial bits of the Windows boot
loader reside here—that’s why you may
have to repair your MBR if it’s overwritten
and Windows won’t start. If you have Linux
installed, the GRUB boot loader will
typically be located in the MBR.
– GPT(GUID Partition Table)
– GPT stands for GUID Partition Table. It’s a
new standard that’s gradually replacing
MBR. It’s associated with UEFI
– GPT, in turn, replaces the clunky old MBR
partitioning system with something more
modern. It’s called GUID Partition Table
because every partition on your drive has
a “globally unique identifier,” or GUID—a
random string so long that every GPT
partition on earth likely has its own unique
identifier.
– GPT stores multiple copies of this data
across the disk, so it’s much more robust
and can recover if the data is corrupted
Knowledge Tips:
Partitions Types
– BIOS boot/ Boot
partition sda1
– #mkfs.ext2
/dev/sda1
– Swap partition sda2
#mkswap /dev/sda2
#swapon /dev/sda2
In it’s simplest sense, the SWAP partition acts as an
overflow to your (RAM) memory. If your memory is filled up
completely, any additional applications will be run off of the
SWAP partition rather than memory.
Advantages:
Provides overflow space when your memory fills up
completely
Can move rarely-needed items away from your high-speed
memory
Allows you to hibernate
Disadvantages:
Takes up space on your hard drive as SWAP partitions do
not resize dynamically
Can increase wear and tear to your hard drive
Does not necessarily improve performance (see below)
– Encrypted root partition sda3 root partition sda3
– Encrypt the block device and designate a passphrase, by
using the following command:
#cryptsetup luksFormat /dev/sda3
– Unlock the encrypted volume and assign it a logical volume, as
follows:
#cryptsetup luksOpen /dev/sda3/root
– Create a file system in the decrypted volume, using the
following command:
#mkfs.ext4 /dev/mapper/root
As shown in Figure 1, the partition has been encrypted and opened
and, finally, a file system is associated with the partition.
– Create a mount point for the file system, mount it, and then
access its contents as follows:
#mkdir /mnt/gentoo
#mount /dev/mapper/ root /mnt/gentoo
– We can verify the mounted partition using the df -h command
#cd /mnt/gentoo
Creating file systems to ext2 ext4
– ext4
– Initially created as a fork of ext3, ext4
brings new features, performance
improvements, and removal of size
limits with moderate changes to the
on-disk format. It can span volumes
up to 1 EB and with maximum file size
of 16TB. Instead of the classic ext2/3
bitmap block allocation ext4 uses
extents, which improve large file
performance and reduce
fragmentation. Ext4 also provides
more sophisticated block allocation
algorithms (delayed allocation and
multiblock allocation) giving the
filesystem driver more ways to
optimize the layout of data on the disk.
Ext4 is the recommended all-purpose
all-platform filesystem.
– ext2
– This is the tried and true Linux
filesystem but doesn't have metadata
journaling, which means that routine
ext2 filesystem checks at startup time
can be quite time-consuming. There is
now quite a selection of newer-
generation journaled filesystems that
can be checked for consistency very
quickly and are thus generally preferred
over their non-journaled counterparts.
Journaled filesystems prevent long
delays when the system is booted and
the filesystem happens to be in an
inconsistent state.
– Luks Linux Unified Key Setup
– LUKS is the standard for Linux
hard disk encryption. By
providing a standard on-disk-
format, it does not only
facilitate compatibility among
distributions, but also provides
secure management of multiple
user passwords. In contrast to
existing solution, LUKS stores
all setup necessary setup
information in the partition
header, enabling the user to
transport or migrate his data
seamlessly.
– #fdisk
Activating the swap partition
Mounting the root partation
– Command Lines
#mkfs.ext2 /dev/sda1
#mkswap /dev/sda2
#swapon /dev/sda2
#cryptsetup luksFormat /dev/sda3
#cryptsetup luksOpen /dev/sda3/root
#mkfs.ext4 /dev/mapper/root
#mount /dev/mapper/root
/mnt/gentoo
#cd /mnt/gentoo
Device mapper
– The device mapper is a framework
provided by the Linux kernel for mapping
physical block devices onto higher-level
virtual block devices. It forms the
foundation of the logical volume manager
(LVM), software RAIDs and dm-crypt disk
encryption, and offers additional features
such as file system snapshots.
– Device mapper works by passing data
from a virtual block device, which is
provided by the device mapper itself, to
another block device. Data can be also
modified in transition, which is performed,
for example, in the case of device mapper
providing disk encryption or simulation of
unreliable hardware behavior.
– cryptsetup – utility used to
conveniently setup disk
encryption based on dm-
crypt
– dm-crypt/LUKS – mapping
target that provides volume
encryption
#cd /mnt/gentoo/
#links
https://gentoo.org/downloads/
# tar xpvf stage3*.tar.xz
Installing the Gentoo installation files
Download and unzip Stage3*.tar.xz
Choosing a stage tarball
according to
64-bit<amd64> /32-bit<x86> architecture
Knowledge Tips:
Logical Volume Manager(Linux)
/dev/mapper
– Applications
(like LVM2 and Enterprise Volume
Management System (EVMS))
that need to create new mapped
devices talk to the device mapper
via the libdevmapper.so shared
library, which in turn
issues ioctls to
the /dev/mapper/control device
node.
– Configuration of the device
mapper can be also examined and
configured interactively—or
from shell scripts—by using
the dmsetup utility
Open /mnt/gentoo/etc/portage/make.conf file and configure the system with
your preferred optimization variables
#mkdir /mnt/gentoo/etc/portage/repos.conf
#cp /mnt/gentoo/usr/share/portage/config/repos.conf
/mnt/gentoo/etc/portage/repos.conf/gentoo.conf
To optimize Gentoo, it is possible to set a couple of variables which impacts the
behavior of Portage, Gentoo's officially supported package manager. All those
variables can be set as environment variables (using export) but that isn't
permanent. To keep the settings, Portage reads in the /etc/portage/make.conf file, a
configuration file for Portage.
Configuring compile options
Optional:
Selecting mirrors
Prepare the System for Rooting
Mounting the necessary filesystems
– Mount proc, dev filesystems
# mount --types proc /proc
/mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --make-rslave /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
# mount --make-rslave /mnt/gentoo/dev
Chrooting to the new environment:
# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# export PS1="(chroot) ${PS1}“
mounting the boot partition
# mount /dev/sda1 /boot
Then updating your @world
packages (all installed packages):
# emerge-webrsync –q
Setting the timezone: from
/usr/share/zoneinfo we find our
timezone to be Europe/Paris
# echo "Europe/Paris" >
/etc/timezone
# emerge --config timezone-data
CHROOT
CHROOT
Purpose of chroot
– Chroot was first utilized in the development of Unix
version 7 in 1979. It was later added to BSD on March
18, 1982. Computer programmers can use a chroot
virtual environment to develop and test software
programs, especially if doing so on a production
system is too risky. They can also use a chroot virtual
environment to run software programs that have
compatibility issues with the computer's operating
system. They can set up the software in the virtual
environment, along with the supported libraries and
files needed to run the software. Chroot has also been
used by POSIX systems for their FTP servers, to
isolate untrusted FTP clients.
Some common uses are:
Software Development and
Product Verification.
Reducing Development
Risk.
Running Deprecated
Software.
Recovery and Filesystem
Upgrades
Ringfencing Applications.
#emerge in portage
Portage is the official package manager and distribution system for Gentoo. It
functions as the heart of Gentoo-based operating systems. Portage includes
many commands for repository and package management, the primary of
which is the emerge command.
– Sync the system in case it is a bit
behind on the current Gentoo
repository, update to the latest
version
# emerge –sync
#emerge --sync
– CONFIGURATION FILES
– Portage has a special feature called "config file protection". The purpose of this
feature is to prevent new package installs from clobbering existing configuration files.
By default, config file protection is turned on for /etc and the KDE configuration dirs;
more may be added in the future. When Portage installs a file into a protected
directory tree like /etc, any existing files will not be overwritten. If a file of the same
name already exists, Portage will change the name of the to-be-installed file from 'foo'
to '._cfg0000_foo'. If '._cfg0000_foo' already exists, this name becomes
'._cfg0001_foo', etc. In this way, existing files are not overwritten, allowing the
administrator to manually merge the new config files and avoid any unexpected
changes.
– In addition to protecting overwritten files, Portage will not delete any files from a
protected directory when a package is unmerged. While this may be a little bit untidy,
it does prevent potentially valuable config files from being deleted, which is of
paramount importance.
– Protected directories are set using the CONFIG_PROTECT variable, normally defined
in make.globals. Directory exceptions to the CONFIG_PROTECTed directories can
be specified using the CONFIG_PROTECT_MASK variable. To find files that need to
be updated in /etc, type find /etc -name '._cfg????_*'.
– You can disable this feature by setting CONFIG_PROTECT="-*" in make.conf(5).
Then, Portage will mercilessly auto-update your config files. Alternatively, you can
leave Config File Protection on but tell Portage that it can overwrite files in certain
specific /etc subdirectories. For example, if you wanted Portage to automatically
update your rc scripts and your wget configuration, but didn't want any other changes
made without your explicit approval, you'd add this to make.conf(5):
– CONFIG_PROTECT_MASK=/etc/wget /etc/rc.d
/etc/portage/repos.conf
/etc/portage/repos.conf can be a file or directory which specifies the location
and settings for the repositories used by the current system. It refers to the
Gentoo repository and perhaps ebuild repositories used on a system.
– # mkdir /mnt/gentoo/etc/portage/repos.conf
# cp /mnt/gentoo/usr/share/portage/config/repos.conf
/mnt/gentoo/etc/portage/repos.conf/gentoo.conf
#make.conf
– SYNOPSIS
– /etc/make.conf and /etc/portage/make.conf DESCRIPTION
– This file contains various variables that are used by Portage. The file has a newline-delimited list
of <key>=<value> pairs (see the default file for examples) which are accessible from the environment of ebuilds. It
supports simple shell-like expansion of the form var="${var}", the source keyword and variable substitution, but not
some of the more advanced BASH features like arrays and special parameter expansions. For more details, see the
Simple lexical analysis documentation: https://docs.python.org/3/library/shlex.html. Note that if you source files,
they need to be in the same shlex syntax for portage to read them. If make.conf is a directory, then all the files in that
directory will be sorted in ascending alphabetical order by file name and summed together as if it were a single file.
Portage will check the currently-defined environment variables first for any settings. If no environment settings are
found, Portage then checks the make.conf files. Both /etc/make.conf and /etc/portage/make.conf are checked (if
present), and settings from /etc/portage/make.conf will override settings from /etc/make.conf. If no setting is found
in the make.conf files, Portage checks make.globals. If no setting is found there, the profile's default setting is
grabbed from /etc/portage/make.profile/make.defaults. Please note that all user settings should be made in the
environment or in the make.conf files, which are intended to be customized by the user.
Exceptions are incremental variables such as USE, CONFIG_PROTECT*, and ACCEPT_KEYWORDS. Incremental
variables are propagated down from make.defaults to make.globals to make.conf to the environment settings.
Clearing these variables requires a clear-all as in: export USE="-*"
In order to create per-package environment settings, refer to package.env in portage(5).
USE flag in gentoo
To help users in deciding what to install/activate and what not,
Gentoo wanted the user to specify his/her environment in an easy
way. This forces the user into deciding what they really want and
eases the process for Portage to make useful decisions.
# nano /etc/portage/make.conf
– and add cryptsetup to the USE flags so it becomes a dependency of
genkernel and gets installed to decrypt /dev/sda3 at boot:
– USE="cryptsetup"
Precedence
Of course there is a certain precedence on what setting has priority
over the USE setting. The precedence for the USE setting is, ordered
by priority (first has lowest priority):
Default USE setting declared in the make.defaults files part of your
profile
User-defined USE setting in /etc/portage/make.conf
User-defined USE setting in /etc/portage/package.use
User-defined USE setting as environment variable
To view the final USE setting as seen by Portage, run emerge --info.
This will list all relevant variables (including the USE variable) with their
current definition as known to Portage.
GRUB install and configuration on the
boot loader
Install GRUB using grub-install command for boot loader. This command
to copy relevant /boot/grub/
#grub-install /dev/sda
If everything goes well then the output of the command will be as below:
#grub-install /dev/sda
Installation finished. No error reported.
Following command for updating the GRUB’s configuration file which
means when the new Kernel installed, the GRUB must be reconfigured.
#grub-mkconfig -o /boot/grub/grub.cfg
Install DHCP which will enable for handling IPv4 and IPv6 configuration.
The DHCP will be installed by following command.
# emerge dhcpcd
To verify network IP address and name, we can use “ifconfig” in Linux as
below:
#ifconfig
DHCP configuration
#nano /etc/conf.d/net >> config_enp0s3="dhcp“
The service script will be created by using symlink and the configuration
will be done in “etc/conf.d/net” under path of “/etc/init.d”
# cd /etc/init.d
#ln -s net.lo net.enp0s3
Running the rc-update is the final step in the configuration process. Add
each interface to the system's init process so they are automatically
started when the system boots. Normally interfaces are added to
the default run level:
#rc-update add net.enp0s3 default
Enable at Boot
Create symlink
Install DHCP
client
Installing system tools:
System logging & Cron daemon
To set the hostname to selected host as below:
#nano /etc/conf.d/hostname >> hostname=“hostname”
To keyboard configuration will be done with below command
and edit it to select right keyboard
# nano /etc/conf.d/keymaps
keymap=“us”
Install the logging tool and add it to the default run level using rc-
update to load in the boot list as below
#emerge cronie sysklogd
# rc-update add cronie default
# rc-update add sysklogd default
Set password for root and
unmount
Setup password for root
#passwd root
Once you set the root password, you have to “exit” from chroot
Unmount the all the mounted devices
# umount /mnt/gentoo/boot
# umount /mnt/gentoo/proc
# umount -R /mnt/gentoo/dev
# umount -R /mnt/gentoo/sys
# umount /mnt/gentoo
Then reboot the system
#reboot
Customize the Portage
environment
Create a user and named as John
#useradd -m -G users,wheel,audio -s /bin/bash john
Set the password for user “John”
#passwd john
The CFLAGS and CXXFLAGS variables define the build and compile
flags that will be used for all package deployments. It is used to
customize the Portage environment on a global level.
#nano e/etc/portage/make.conf
Inside the script:
USE="cryptsetup -cups -ldap -bluetooth -firmware -sound -alsa"
User creation
CFLAGS and
CXXFLAGS
Make an own rebuild environment dependencies to your new
profile.
# emerge --update --deep --newuse @world
Edit .xinitrc file and add the command on the script to define
which application should run when startx is run.
# nano .xinitrc
exec i3
Ranger is a console file manager that gives you greater flexibility
and a good overview of your files without having to leave your
console. By following command we can install this package.
#emerge ranger
References:
– Official Gentoo Installation Book [REF]
– How to install Gentoo with LUKS LVM and systemd[REF]

More Related Content

What's hot

Linux admin course
Linux admin courseLinux admin course
Linux admin course
Manikanta Pushadapu
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2
Acácio Oliveira
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
Marian Marinov
 
[ArabBSD] Unix Basics
[ArabBSD] Unix Basics[ArabBSD] Unix Basics
[ArabBSD] Unix Basics
Mohammed Farrag
 
Cfg2html fosdem2014
Cfg2html fosdem2014Cfg2html fosdem2014
Cfg2html fosdem2014
Gratien D'haese
 
Linux Disaster Recovery Made Easy
Linux Disaster Recovery Made EasyLinux Disaster Recovery Made Easy
Linux Disaster Recovery Made Easy
Novell
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
Mohammed Farrag
 
Linux Disaster Recovery Solutions
Linux Disaster Recovery SolutionsLinux Disaster Recovery Solutions
Linux Disaster Recovery Solutions
Gratien D'haese
 
Ram Disk
Ram DiskRam Disk
Ram Disk
Roman Okolovich
 
2.1 design hard disk layout v2
2.1 design hard disk layout v22.1 design hard disk layout v2
2.1 design hard disk layout v2
Acácio Oliveira
 
Scale9x sun
Scale9x sunScale9x sun
Scale9x sun
Dru Lavigne
 
Memory management in Linux
Memory management in LinuxMemory management in Linux
Memory management in Linux
Raghu Udiyar
 
Linuxdiskmanagementcommands
LinuxdiskmanagementcommandsLinuxdiskmanagementcommands
Linuxdiskmanagementcommands
Manikanta Pushadapu
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
Bimal Jain
 
How to design a file system
How to design a file systemHow to design a file system
How to design a file system
Nikhil Anurag VN
 

What's hot (19)

pptdisk
pptdiskpptdisk
pptdisk
 
Linux admin course
Linux admin courseLinux admin course
Linux admin course
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
 
[ArabBSD] Unix Basics
[ArabBSD] Unix Basics[ArabBSD] Unix Basics
[ArabBSD] Unix Basics
 
Cfg2html fosdem2014
Cfg2html fosdem2014Cfg2html fosdem2014
Cfg2html fosdem2014
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 
Linux Disaster Recovery Made Easy
Linux Disaster Recovery Made EasyLinux Disaster Recovery Made Easy
Linux Disaster Recovery Made Easy
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
 
Linux Disaster Recovery Solutions
Linux Disaster Recovery SolutionsLinux Disaster Recovery Solutions
Linux Disaster Recovery Solutions
 
Ram Disk
Ram DiskRam Disk
Ram Disk
 
2.1 design hard disk layout v2
2.1 design hard disk layout v22.1 design hard disk layout v2
2.1 design hard disk layout v2
 
Scale9x sun
Scale9x sunScale9x sun
Scale9x sun
 
Ch12
Ch12Ch12
Ch12
 
Memory management in Linux
Memory management in LinuxMemory management in Linux
Memory management in Linux
 
Linuxdiskmanagementcommands
LinuxdiskmanagementcommandsLinuxdiskmanagementcommands
Linuxdiskmanagementcommands
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
How to design a file system
How to design a file systemHow to design a file system
How to design a file system
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 

Similar to How to install gentoo distributed

FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016
Muhammad Moinur Rahman
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut ii
plarsen67
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layoutAcácio Oliveira
 
logical volume manager.ppt
logical volume manager.pptlogical volume manager.ppt
logical volume manager.ppt
Pandiya Rajan
 
HARD DISK PARTITIONING,FORMATING
HARD DISK PARTITIONING,FORMATINGHARD DISK PARTITIONING,FORMATING
HARD DISK PARTITIONING,FORMATING
chiju chinnu
 
Linux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of TechnologyLinux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of Technology
Nugroho Gito
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
alok pal
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
Henry Osborne
 
Jana treek 4
Jana treek 4Jana treek 4
Jana treek 4
Jana Treek
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)
Bud Siddhisena
 
2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-iLogesh Kumar Anandhan
 
How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan) How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan)
Naoto MATSUMOTO
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-adminbadamisri
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-admin
badamisri
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
Ishan A B Ambanwela
 

Similar to How to install gentoo distributed (20)

FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut ii
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layout
 
logical volume manager.ppt
logical volume manager.pptlogical volume manager.ppt
logical volume manager.ppt
 
HARD DISK PARTITIONING,FORMATING
HARD DISK PARTITIONING,FORMATINGHARD DISK PARTITIONING,FORMATING
HARD DISK PARTITIONING,FORMATING
 
Linux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of TechnologyLinux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of Technology
 
Ch12 system administration
Ch12 system administration Ch12 system administration
Ch12 system administration
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
unixtoolbox
unixtoolboxunixtoolbox
unixtoolbox
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Jana treek 4
Jana treek 4Jana treek 4
Jana treek 4
 
KCC_Final.pdf
KCC_Final.pdfKCC_Final.pdf
KCC_Final.pdf
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)
 
2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i
 
How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan) How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan)
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-admin
 
Linux Conf Admin
Linux Conf AdminLinux Conf Admin
Linux Conf Admin
 
Linux conf-admin
Linux conf-adminLinux conf-admin
Linux conf-admin
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
 

Recently uploaded

Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
CIOWomenMagazine
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Florence Consulting
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
harveenkaur52
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
nhiyenphan2005
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 

Recently uploaded (20)

Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027Italy Agriculture Equipment Market Outlook to 2027
Italy Agriculture Equipment Market Outlook to 2027
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
Bài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docxBài tập unit 1 English in the world.docx
Bài tập unit 1 English in the world.docx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 

How to install gentoo distributed

  • 2. Features of Gentoo Linux Distributions Why Gentoo[link] – OS Type: Linux – Based on: Independent – Origin: USA – Architecture: i486, i586, i686, x86_64, alp ha, arm, hppa, ia64, mips, powerpc, ppc6 4, sparc64 – Desktop: AfterStep, Awesome, Blackbox, Enlightenment, Fluxbox, GNOME, IceWM, KDEPlasma, LXDE, MATE, Openbox, WM aker, Xfce – Category: Desktop, Server, Source-based – Status: Active – Gentoo Linux is a versatile and fast, completely free Linux distribution geared towards developers and network professionals. – Unlike other distros, Gentoo Linux has an advanced package management system called Portage. Portage is a true ports system in the tradition of BSD ports, but is Python-based and sports a number of advanced features including dependencies, fine-grained package management, "fake" (OpenBSD-style) installs, safe unmerging, system profiles, virtual packages, config file management, and more.
  • 3. Boot using minimal live CD – Download minimal live CD: https://www.gentoo.org/d ownloads/ => http://distfiles.gentoo.org/r eleases/amd64/autobuilds/20 191002T214502Z/install- amd64-minimal- 20191002T214502Z.iso – VMware/VirtualBox Preparation – RAM => 2048mb – HDD => VDI, dynamically allocated, 256gb – Choose the right language (fr, us)
  • 4. Add Partitions to Hard Disk Using fdisk to partition the disk – Command Lines # fdisk /dev/sda Goals 3 primary partitions /dev/sda1 /boot 128M bootable, contain the grub boot manager, kernel, decryption software(cryptsetup) /dev/sda2 swap(2G) /dev/sda3 encrypted
  • 5. Two ways of sorting the partitioning information on a drive MBR vs. GPT – MBR(Master Boot Record) – Special boot sector located at the beginning of a drive – The sector contains a boot loader for the installed OS and information of the drive’s logical partitions. – The boot loader is a small bit of code that generally loads the larger boot loader from another partition on a drive – For example,. If you have Windows installed, the initial bits of the Windows boot loader reside here—that’s why you may have to repair your MBR if it’s overwritten and Windows won’t start. If you have Linux installed, the GRUB boot loader will typically be located in the MBR. – GPT(GUID Partition Table) – GPT stands for GUID Partition Table. It’s a new standard that’s gradually replacing MBR. It’s associated with UEFI – GPT, in turn, replaces the clunky old MBR partitioning system with something more modern. It’s called GUID Partition Table because every partition on your drive has a “globally unique identifier,” or GUID—a random string so long that every GPT partition on earth likely has its own unique identifier. – GPT stores multiple copies of this data across the disk, so it’s much more robust and can recover if the data is corrupted
  • 6. Knowledge Tips: Partitions Types – BIOS boot/ Boot partition sda1 – #mkfs.ext2 /dev/sda1 – Swap partition sda2 #mkswap /dev/sda2 #swapon /dev/sda2 In it’s simplest sense, the SWAP partition acts as an overflow to your (RAM) memory. If your memory is filled up completely, any additional applications will be run off of the SWAP partition rather than memory. Advantages: Provides overflow space when your memory fills up completely Can move rarely-needed items away from your high-speed memory Allows you to hibernate Disadvantages: Takes up space on your hard drive as SWAP partitions do not resize dynamically Can increase wear and tear to your hard drive Does not necessarily improve performance (see below) – Encrypted root partition sda3 root partition sda3 – Encrypt the block device and designate a passphrase, by using the following command: #cryptsetup luksFormat /dev/sda3 – Unlock the encrypted volume and assign it a logical volume, as follows: #cryptsetup luksOpen /dev/sda3/root – Create a file system in the decrypted volume, using the following command: #mkfs.ext4 /dev/mapper/root As shown in Figure 1, the partition has been encrypted and opened and, finally, a file system is associated with the partition. – Create a mount point for the file system, mount it, and then access its contents as follows: #mkdir /mnt/gentoo #mount /dev/mapper/ root /mnt/gentoo – We can verify the mounted partition using the df -h command #cd /mnt/gentoo
  • 7. Creating file systems to ext2 ext4 – ext4 – Initially created as a fork of ext3, ext4 brings new features, performance improvements, and removal of size limits with moderate changes to the on-disk format. It can span volumes up to 1 EB and with maximum file size of 16TB. Instead of the classic ext2/3 bitmap block allocation ext4 uses extents, which improve large file performance and reduce fragmentation. Ext4 also provides more sophisticated block allocation algorithms (delayed allocation and multiblock allocation) giving the filesystem driver more ways to optimize the layout of data on the disk. Ext4 is the recommended all-purpose all-platform filesystem. – ext2 – This is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer- generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when the system is booted and the filesystem happens to be in an inconsistent state. – Luks Linux Unified Key Setup – LUKS is the standard for Linux hard disk encryption. By providing a standard on-disk- format, it does not only facilitate compatibility among distributions, but also provides secure management of multiple user passwords. In contrast to existing solution, LUKS stores all setup necessary setup information in the partition header, enabling the user to transport or migrate his data seamlessly. – #fdisk
  • 8. Activating the swap partition Mounting the root partation – Command Lines #mkfs.ext2 /dev/sda1 #mkswap /dev/sda2 #swapon /dev/sda2 #cryptsetup luksFormat /dev/sda3 #cryptsetup luksOpen /dev/sda3/root #mkfs.ext4 /dev/mapper/root #mount /dev/mapper/root /mnt/gentoo #cd /mnt/gentoo
  • 9. Device mapper – The device mapper is a framework provided by the Linux kernel for mapping physical block devices onto higher-level virtual block devices. It forms the foundation of the logical volume manager (LVM), software RAIDs and dm-crypt disk encryption, and offers additional features such as file system snapshots. – Device mapper works by passing data from a virtual block device, which is provided by the device mapper itself, to another block device. Data can be also modified in transition, which is performed, for example, in the case of device mapper providing disk encryption or simulation of unreliable hardware behavior. – cryptsetup – utility used to conveniently setup disk encryption based on dm- crypt – dm-crypt/LUKS – mapping target that provides volume encryption
  • 10. #cd /mnt/gentoo/ #links https://gentoo.org/downloads/ # tar xpvf stage3*.tar.xz Installing the Gentoo installation files Download and unzip Stage3*.tar.xz
  • 11. Choosing a stage tarball according to 64-bit<amd64> /32-bit<x86> architecture
  • 12. Knowledge Tips: Logical Volume Manager(Linux) /dev/mapper – Applications (like LVM2 and Enterprise Volume Management System (EVMS)) that need to create new mapped devices talk to the device mapper via the libdevmapper.so shared library, which in turn issues ioctls to the /dev/mapper/control device node. – Configuration of the device mapper can be also examined and configured interactively—or from shell scripts—by using the dmsetup utility
  • 13. Open /mnt/gentoo/etc/portage/make.conf file and configure the system with your preferred optimization variables #mkdir /mnt/gentoo/etc/portage/repos.conf #cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf To optimize Gentoo, it is possible to set a couple of variables which impacts the behavior of Portage, Gentoo's officially supported package manager. All those variables can be set as environment variables (using export) but that isn't permanent. To keep the settings, Portage reads in the /etc/portage/make.conf file, a configuration file for Portage. Configuring compile options
  • 15. Prepare the System for Rooting Mounting the necessary filesystems – Mount proc, dev filesystems # mount --types proc /proc /mnt/gentoo/proc # mount --rbind /sys /mnt/gentoo/sys # mount --make-rslave /mnt/gentoo/sys # mount --rbind /dev /mnt/gentoo/dev # mount --make-rslave /mnt/gentoo/dev Chrooting to the new environment: # chroot /mnt/gentoo /bin/bash # source /etc/profile # export PS1="(chroot) ${PS1}“ mounting the boot partition # mount /dev/sda1 /boot Then updating your @world packages (all installed packages): # emerge-webrsync –q Setting the timezone: from /usr/share/zoneinfo we find our timezone to be Europe/Paris # echo "Europe/Paris" > /etc/timezone # emerge --config timezone-data CHROOT CHROOT
  • 16. Purpose of chroot – Chroot was first utilized in the development of Unix version 7 in 1979. It was later added to BSD on March 18, 1982. Computer programmers can use a chroot virtual environment to develop and test software programs, especially if doing so on a production system is too risky. They can also use a chroot virtual environment to run software programs that have compatibility issues with the computer's operating system. They can set up the software in the virtual environment, along with the supported libraries and files needed to run the software. Chroot has also been used by POSIX systems for their FTP servers, to isolate untrusted FTP clients. Some common uses are: Software Development and Product Verification. Reducing Development Risk. Running Deprecated Software. Recovery and Filesystem Upgrades Ringfencing Applications.
  • 17. #emerge in portage Portage is the official package manager and distribution system for Gentoo. It functions as the heart of Gentoo-based operating systems. Portage includes many commands for repository and package management, the primary of which is the emerge command. – Sync the system in case it is a bit behind on the current Gentoo repository, update to the latest version # emerge –sync #emerge --sync – CONFIGURATION FILES – Portage has a special feature called "config file protection". The purpose of this feature is to prevent new package installs from clobbering existing configuration files. By default, config file protection is turned on for /etc and the KDE configuration dirs; more may be added in the future. When Portage installs a file into a protected directory tree like /etc, any existing files will not be overwritten. If a file of the same name already exists, Portage will change the name of the to-be-installed file from 'foo' to '._cfg0000_foo'. If '._cfg0000_foo' already exists, this name becomes '._cfg0001_foo', etc. In this way, existing files are not overwritten, allowing the administrator to manually merge the new config files and avoid any unexpected changes. – In addition to protecting overwritten files, Portage will not delete any files from a protected directory when a package is unmerged. While this may be a little bit untidy, it does prevent potentially valuable config files from being deleted, which is of paramount importance. – Protected directories are set using the CONFIG_PROTECT variable, normally defined in make.globals. Directory exceptions to the CONFIG_PROTECTed directories can be specified using the CONFIG_PROTECT_MASK variable. To find files that need to be updated in /etc, type find /etc -name '._cfg????_*'. – You can disable this feature by setting CONFIG_PROTECT="-*" in make.conf(5). Then, Portage will mercilessly auto-update your config files. Alternatively, you can leave Config File Protection on but tell Portage that it can overwrite files in certain specific /etc subdirectories. For example, if you wanted Portage to automatically update your rc scripts and your wget configuration, but didn't want any other changes made without your explicit approval, you'd add this to make.conf(5): – CONFIG_PROTECT_MASK=/etc/wget /etc/rc.d
  • 18. /etc/portage/repos.conf /etc/portage/repos.conf can be a file or directory which specifies the location and settings for the repositories used by the current system. It refers to the Gentoo repository and perhaps ebuild repositories used on a system. – # mkdir /mnt/gentoo/etc/portage/repos.conf # cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
  • 19. #make.conf – SYNOPSIS – /etc/make.conf and /etc/portage/make.conf DESCRIPTION – This file contains various variables that are used by Portage. The file has a newline-delimited list of <key>=<value> pairs (see the default file for examples) which are accessible from the environment of ebuilds. It supports simple shell-like expansion of the form var="${var}", the source keyword and variable substitution, but not some of the more advanced BASH features like arrays and special parameter expansions. For more details, see the Simple lexical analysis documentation: https://docs.python.org/3/library/shlex.html. Note that if you source files, they need to be in the same shlex syntax for portage to read them. If make.conf is a directory, then all the files in that directory will be sorted in ascending alphabetical order by file name and summed together as if it were a single file. Portage will check the currently-defined environment variables first for any settings. If no environment settings are found, Portage then checks the make.conf files. Both /etc/make.conf and /etc/portage/make.conf are checked (if present), and settings from /etc/portage/make.conf will override settings from /etc/make.conf. If no setting is found in the make.conf files, Portage checks make.globals. If no setting is found there, the profile's default setting is grabbed from /etc/portage/make.profile/make.defaults. Please note that all user settings should be made in the environment or in the make.conf files, which are intended to be customized by the user. Exceptions are incremental variables such as USE, CONFIG_PROTECT*, and ACCEPT_KEYWORDS. Incremental variables are propagated down from make.defaults to make.globals to make.conf to the environment settings. Clearing these variables requires a clear-all as in: export USE="-*" In order to create per-package environment settings, refer to package.env in portage(5).
  • 20. USE flag in gentoo To help users in deciding what to install/activate and what not, Gentoo wanted the user to specify his/her environment in an easy way. This forces the user into deciding what they really want and eases the process for Portage to make useful decisions. # nano /etc/portage/make.conf – and add cryptsetup to the USE flags so it becomes a dependency of genkernel and gets installed to decrypt /dev/sda3 at boot: – USE="cryptsetup" Precedence Of course there is a certain precedence on what setting has priority over the USE setting. The precedence for the USE setting is, ordered by priority (first has lowest priority): Default USE setting declared in the make.defaults files part of your profile User-defined USE setting in /etc/portage/make.conf User-defined USE setting in /etc/portage/package.use User-defined USE setting as environment variable To view the final USE setting as seen by Portage, run emerge --info. This will list all relevant variables (including the USE variable) with their current definition as known to Portage.
  • 21. GRUB install and configuration on the boot loader Install GRUB using grub-install command for boot loader. This command to copy relevant /boot/grub/ #grub-install /dev/sda If everything goes well then the output of the command will be as below: #grub-install /dev/sda Installation finished. No error reported. Following command for updating the GRUB’s configuration file which means when the new Kernel installed, the GRUB must be reconfigured. #grub-mkconfig -o /boot/grub/grub.cfg
  • 22. Install DHCP which will enable for handling IPv4 and IPv6 configuration. The DHCP will be installed by following command. # emerge dhcpcd To verify network IP address and name, we can use “ifconfig” in Linux as below: #ifconfig DHCP configuration #nano /etc/conf.d/net >> config_enp0s3="dhcp“ The service script will be created by using symlink and the configuration will be done in “etc/conf.d/net” under path of “/etc/init.d” # cd /etc/init.d #ln -s net.lo net.enp0s3 Running the rc-update is the final step in the configuration process. Add each interface to the system's init process so they are automatically started when the system boots. Normally interfaces are added to the default run level: #rc-update add net.enp0s3 default Enable at Boot Create symlink Install DHCP client
  • 23. Installing system tools: System logging & Cron daemon To set the hostname to selected host as below: #nano /etc/conf.d/hostname >> hostname=“hostname” To keyboard configuration will be done with below command and edit it to select right keyboard # nano /etc/conf.d/keymaps keymap=“us” Install the logging tool and add it to the default run level using rc- update to load in the boot list as below #emerge cronie sysklogd # rc-update add cronie default # rc-update add sysklogd default
  • 24. Set password for root and unmount Setup password for root #passwd root Once you set the root password, you have to “exit” from chroot Unmount the all the mounted devices # umount /mnt/gentoo/boot # umount /mnt/gentoo/proc # umount -R /mnt/gentoo/dev # umount -R /mnt/gentoo/sys # umount /mnt/gentoo Then reboot the system #reboot
  • 25. Customize the Portage environment Create a user and named as John #useradd -m -G users,wheel,audio -s /bin/bash john Set the password for user “John” #passwd john The CFLAGS and CXXFLAGS variables define the build and compile flags that will be used for all package deployments. It is used to customize the Portage environment on a global level. #nano e/etc/portage/make.conf Inside the script: USE="cryptsetup -cups -ldap -bluetooth -firmware -sound -alsa" User creation CFLAGS and CXXFLAGS
  • 26. Make an own rebuild environment dependencies to your new profile. # emerge --update --deep --newuse @world Edit .xinitrc file and add the command on the script to define which application should run when startx is run. # nano .xinitrc exec i3 Ranger is a console file manager that gives you greater flexibility and a good overview of your files without having to leave your console. By following command we can install this package. #emerge ranger
  • 27. References: – Official Gentoo Installation Book [REF] – How to install Gentoo with LUKS LVM and systemd[REF]