These installation notes and kernel config are configured for me and my
computer (Lenovo G580). It can work for you but it does not have to.
Feel free to follow my instructions, but keep in mind that you will probably have to
add some drivers while kernel configuration and use different USE flags in
/etc/portage/make.conf
.
# install a package:
emerge <name>
# install a package and update all packages it depends on:
emerge -u <name>
# update a package, all packages it depends on and all packages they depend on (--update --deep):
emerge -uD <name>
# uninstall a package:
emerge -C package
# search for packages - names only (--search):
emerge -s <keyword>
# search for packages (their description):
emerge -S <keyword>
# view what would have been installed (--pretend):
emerge -p <name>
# only download archive + dependencies (--fetchonly):
emerge -f <name>
# complete system update:
emerge -uD @world
# view what USE flags are used to configure and install a package:
emerge -pv <name>
# sync the Gentoo ebuild repository using the mirrors by obtaining a snapshot that is (at most) a day old:
emerge-webrsync
links https://wiki.gentoo.org/wiki/Handbook:AMD64
boot: gentoo
ping google.com
If there's no connection:
ip link
ip link set <interface> up
# -t dos option forces to read the partition table using the MBR format.
fdisk -t dos /dev/sda
# create partitions:
# /dev/sda1 -> /boot (Type 'a' to toggle the bootable flag)
# /dev/sda2 -> /
# /dev/sda3 -> /swap (optional)
n - new partition
...
a - makes bootable
p - print all partitions
l - list of partition codes
t - change type of partitions
82 - swap
83 - Linux
d - delete partitions
w - write changes
mkfs.ext2 /dev/sda1
mkfs.ext4 /dev/sda2
mkswap /dev/sda3
swapon /dev/sda3
mount /dev/sda2 /mnt/gentoo
cd /mnt/gentoo
date
date MMDDhhmmYYYY
links www.gentoo.org/main/en/mirrors.xml
select server -> releases/amd64/autobuilds/stage3*.tar.bz2
tar xf stage3*
vi /mnt/gentoo/etc/portage/make.conf
CFLAGS="-march=native -O2 -pipe"
# Use the same settings for both variables
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j4"
VIDEO_CARDS="intel vesa"
INPUT_DEVICES="evdev keyboard mouse synaptics libinput"
NOTUSE="-qt4"
USE="${NOTUSE} X acpi alsa ffmpeg flac ftp fuse gif git ipv6 jpeg latex libnotify mp3 mp4 mpeg mtp mysql ncurses ogg opengl png python python3 ssl svg wifi xft zsh-completion"
# which software licenses are allowed
ACCEPT_LICENSE="*"
#ACCEPT_LICENSE="-* @FREE"
PORTAGE_TMPDIR=/var/tmp
# the location of the temporary files for Portage
PORTAGE_TMPDIR="/var/tmp"
# the location where Portage will store the downloaded source code archives
DISTDIR=/var/gentoo/distfiles
AUTOCLEAN="yes"
LINGUAS="pl en_US"
# BIOS/MBR is pc, 64-bit UEFI is efi-64, 32-bit UEFI is efi-32
GRUB_PLATFORMS="pc"
In order to download source code quickly it is recommended to select a fast/close mirror.
mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf
A second important step in selecting mirrors is to configure the Gentoo ebuild
repository via the /etc/portage/repos.conf/gentoo.conf
. This file
contains the sync information needed to update the package repository.
mkdir -p /mnt/gentoo/etc/portage/repos.conf
Next, copy the Gentoo repository configuration file provided by Portage
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
One thing still remains to be done before entering the new environment and that is copying over the DNS information in /etc/resolv.conf
. This needs to be done to ensure that networking still works even after entering the new environment. /etc/resolv.conf
contains the name servers for the network.
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
In a few moments, the Linux root will be changed towards the new location. To make sure that the new environment works properly, certain filesystems need to be made available there as well.
mount -t 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
This means that the session will change its root (most top-level location that can be accessed) from the current installation environment (installation CD or other installation medium) to the installation system (namely the initialized partitions). Hence the name, change root or chroot.
The root location is changed from /
(on the installation medium) to /mnt/gentoo/
(on the partitions) using chroot
chroot /mnt/gentoo /bin/bash
Some settings (those in /etc/profile) are reloaded in memory using the source command
source /etc/profile
The primary prompt is changed to help us remember that this session is inside a chroot environment.
export PS1="(chroot) ${PS1}"
mkdir /boot
mount /dev/sda2 /boot
mkdir /usr/portage
emerge-webrsync
emerge --sync
emerge app-editors/vim dev-vcs/git
A profile is a building block for any Gentoo system. Not only does it specify default values for USE, CFLAGS, and other important variables, it also locks the system to a certain range of package versions. These settings are all maintained by Gentoo's Portage developers.
eselect profile list
eselect profile set <nr>
It is wise to update the system's @world set so that a base can be established for the new profile.
emerge --ask --update --deep --newuse @world
USE is one of the most powerful variables Gentoo provides to its users. Several programs can be compiled with or without optional support for certain items.
The easiest way to check the currently active USE settings is to run
emerge --info | grep ^USE
A full description on the available USE flags can be found on the system in /usr/portage/profiles/use.desc
.
Users who want to ignore any default USE settings and manage it completely themselves should start the USE definition in /etc/portage/make.conf
with -*:
USE="-* X acl alsa"
echo "Europe/Warsaw" > /etc/timezone
emerge --config sys-libs/timezone-data
vim /etc/locale.gen
locale-gen
eselect locale list
eselect locale set <nr>
env-update && source /etc/profile && export PS1="(chroot) $PS1"
emerge --ask sys-kernel/gentoo-sources
git clone https://github.com/qeni/gentoo.git
cp gentoo/kernel-config /usr/src/linux/
cd /usr/src/linux
make menuconfig
> load kernel-config file
make && make modules_install
make install
Some drivers require additional firmware to be installed on the system before they work. This is often the case for network interfaces, especially wireless network interfaces.
emerge --ask sys-kernel/linux-firmware
vim /etc/fstab
/dev/sda1 /boot ext2 defaults,noatime 0 2
/dev/sda2 / ext4 noatime 0 1
/dev/sda3 none swap sw 0 0
set /dev/sda3 only if you've created a swap partition
vim /etc/conf.d/hostname
emerge --ask net-misc/dhcpcd net-wireless/iw net-wireless/wpa_supplicant net-misc/wicd sys-firmware/b43-firmware sys-apps/iproute2 net-wireless/wireless-tools
rc-update add wicd default
rc-update add dhcpcd default
useradd -G users,wheel,audio,portage,cron -s /bin/bash <username>
passwd
passwd <username>
emerge sudo
visudo
emerge -av sys-boot/grub:2
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
vim /boot/grub/grub.cfg
exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -l -R /mnt/gentoo{/boot,/proc,}
reboot
mkdir -p $HOME/{tmp, mnt, documents, music, movies, downloads, repo, pictures/screenshots}
sudo emerge-webrsync
sudo emerge --update --deep \
x11-base/xorg-server x11-apps/xinit x11-wm/i3-gaps x11-misc/rofi \
x11-misc/i3status x11-misc/i3lock media-gfx/scrot lxde-base/lxrandr \
x11-misc/redshift app-editors/vim app-vim/jedi net-misc/youtube-dl net-p2p/rtorrent \
app-text/zathura app-misc/mc x11-terms/xterm www-client/links \
sys-libs/ncurses media-sound/mpd media-sound/ncmpcpp media-sound/mpc media-video/vlc \
media-gfx/feh media-plugins/alsa-plugins media-sound/alsamixer-app media-libs/alsa-lib x11-apps/xbacklight \
dev-util/cmake net-misc/curl net-misc/dhcpcd sys-apps/dbus dev-lang/lua media-sound/gmtp \
app-misc/neofetch app-arch/p7zip app-arch/unrar app-portage/genlop app-editors/leafpad \
app-arch/unzip dev-lang/python sys-devel/gcc dev-vcs/git net-misc/openssh \
media-fonts/terminus-font app-shells/zsh sys-power/acpi sys-process/htop \
x11-apps/xbacklight sys-fs/ntfs3g games-roguelike/nethack www-client/firefox
When the installation is finished, some environment variables will need to re-initialized before continuing.
sudo env-update
sudo source /etc/profile
git clone https://github.com/qeni/dotfiles /home/qeni/repo/dotfiles
rsync -rvlkEth /home/qeni/dotfiles/.* ~/
rc-update add sshd default
chsh -s /bin/zsh $USER
sudo mkdir -p /var/games/nethack
sudo mv ~/.nethack_record /var/games/nethack/record
startx