sudo su
mkdir /mnt/gentoo
apt install -y vim git
curl 'https://raw.githubusercontent.com/cemkeylan/genfstab/master/genfstab' > /mnt/genfstab
chmod +x /mnt/genfstab
# Format the Disk
fdisk /dev/sda
mkfs.fat -F32 -n EFI /dev/sda1
mkswap -L SWAP /dev/sda2
swapon /dev/sda2
mkfs.btrfs -L GENTOO /dev/sda3
mount /dev/sda3 /mnt/gentoo
cd /mnt/gentoo
btrfs subvolume create @
btrfs subvolume create @home
cd -
umount /mnt
mount -o noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=@ /dev/sda3 /mnt/gentoo
mkdir -p /mnt/gentoo/{home,boot/efi}
mount -o noatime,space_cache=v2,compress=zstd,ssd,discard=async,subvol=@home /dev/sda3 /mnt/gentoo/home
mount /dev/sda1 /mnt/gentoo/boot/efi
# Download Tarball and Extract it
cd /mnt/gentoo
# get the url from the gentoo website
wget 'https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20221002T170543Z/stage3-amd64-desktop-systemd-20221002T170543Z.tar.xz'
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
# Basic Portage Config
vim /mnt/gentoo/etc/portage/make.conf
#COMMON_FLAGS="-march=native -O2 -pipe"
#MAKEOPTS="-j4"
#ACCEPT_LICENSE="*"
#USE=""
echo "GENTOO_MIRRORS=\"https://gentoo.c3sl.ufpr.br/\"" > /mnt/gentoo/etc/portage/make.conf
mkdir --parents /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
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
mount --bind /run /mnt/gentoo/run
mount --make-slave /mnt/gentoo/run
test -L /dev/shm && rm /dev/shm && mkdir /dev/shm
mount --types tmpfs --options nosuid,nodev,noexec shm /dev/shm
chmod 1777 /dev/shm /run/shm
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"
emerge-webrsync
emerge --sync
eselect profile list
eselect profile set 12 # Desktop + SystemD
emerge vim
vim /etc/portage/make.conf # Add USE="pam harfbuzz"
emerge --ask --verbose --update --deep --newuse @world
emerge --ask networkmanager
ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/timezone
ln -snf /run/systemd/resolve/resolv.conf /etc/resolv.conf
systemctl enable systemd-resolved.service
timedatectl set-ntp true
vim /etc/hostname
vim /etc/hosts
systemctl enable systemd-networkd.service
systemctl enable NetworkManager
vim /etc/locale.gen
locale-gen
eselect locale list
eselect locale set 4 # (en_US)
echo "KEYMAP=br-abnt2" >> /etc/vconsole.conf
emerge --ask sudo
EDITOR=vim visudo
vim /etc/security/passwdqc.conf # min=0,0,0,0,0
useradd -m kenielf
usermod -aG wheel,audio,video,users,input kenielf
passwd kenielf
passwd
env-update && source /etc/profile && export PS1="(chroot) ${PS1}"
# Kernel
emerge --ask sys-kernel/installkernel
emerge --ask sys-kernel/gentoo-kernel-bin
emerge --ask sys-kernel/linux-firmware sys-firmware/intel-microcode
dracut --add btrfs
systemctl enable sshd
systemctl enable fstrim.timer
# Bootloader
emerge --ask refind sys-fs/dosfstools efibootmgr os-prober
refind-install --alldrivers --usedefault /dev/sda1
vim /boot/refind_linux.conf
# Extra
emerge --ask neofetch
cd /
rm stage3-*
exit
umount -a
Last active
October 9, 2022 01:59
-
-
Save kenielf/7e1092dd2bc156d6fdaf212086acef48 to your computer and use it in GitHub Desktop.
Gentoo Base Installation - Linux Mint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment