젠투 리눅스 설치 가이드

Last Modified: 21.09.08, 5:24 pm

Update Log
21.09.07재작성
21.06.23 가독성 업데이트
21.02.17전체 업데이트
20.03.15전체 업데이트
V.3.1.1-200103 오타수정(euedev > eudev)
V.3.1.0-191230 일부 수정, 내용 추가(genkernel, etc-update)
V.3.0.0-190330 목차 추가, Git에 올려두었던 자료들 통합
V.2.1.2-181203 커맨드 리스트 추가
V.2.0.2-181110 양식 통일
V.2.0.1-181106 전면 업데이트(오타 수정, 업데이트 로그 추가)
V.1.0.1-171105초판

Preface

젠투 리눅스 설치 가이드는 문서 방향성을 전면 수정합니다.

설치에 익숙한 분들이 핸드북을 참조하기 번거로울 때 활용할 수 있도록 수정합니다. 젠투 리눅스가 처음이신 분들이나 리눅스가 익숙하지 않으신 분들은 핸드북을 통해 천천히 진행하시는 것을 권장합니다.

Gentoo Linux Logo

Prerequisite

설치 환경에서의 터미널 프롬프트는 루트 사용자이므로 #입니다. 현재 글 작성 환경의 문제로 #가 주석 처리되어 명확하게 눈에 띄지 않고 있습니다.

따라서, 부득이하게 일반 사용자 프롬프트인 $로 작성한 점 양해부탁드립니다.

## 본인 Git에서 필요한 파일을 다운받아야 할 때,

# Gitlab
$wget https://gitlab.com/YOUR_USER_ID/YOUR_REPOSITORY_NAME/-/raw/master/FILE_DIRECTORY/SOME_FILE

# Github
$wget https://github.com/YOUR_USER_ID/YOUR_REPOSITORY_NAME/raw/master/FILE_DIRECTORY/SOME_FILE

Live USB

젠투 위키의 미러 페이지 혹은 http://ftp.daum.net/gentoo/

$wipefs --all /dev/sdb
$dd if=./Downloads/install-amd(tab) of=/dev/sdb status=progress && sync

Base

Ping

$ping

Partition

$ls /sys/firmware/efi

Format

# /boot
$mkfs.vfat -F 32 /dev/sdaN

# swap
$mkswap /dev/sdaN
$swapon /dev/sdaN

# /
$mkfs.ext4 -j /dev/sdaN

# xfs, btrfs
$mkfs.xfs /dev/sdaN
$mkfs.btrfs /dev/sdaN

Mount

# 다른 배포판 환경에서 설치하는 경우, /mnt/gentoo 디렉터리가 없으므로,
$mkdir -pv /mnt/gentoo

$mount -v -t ext4 /dev/sda3 /mnt/gentoo

$mkdir -pv /mnt/gentoo/boot
$mount -v -t vfat /dev/sda1 /mnt/gentoo/boot

TIME

# 2018년 3월 1일 17시 53분
$date 030117532018

# 혹은
$ntpd -q -g

$hwclock --systohc --utc

Stage 3 Tarball

$cd /mnt/gentoo
$links https://www.gentoo.org/downloads/mirrors/
$tar xvpf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner

Edit make.conf

$nano -w /mnt/gentoo/etc/portage/make.conf

## 본인 깃 에서 다운받기
# Gitlab
$wget https://gitlab.com/YOUR_USER_ID/YOUR_REPOSITORY_NAME/-/raw/master/YOUR_MAKE_CONF_DIRECTORY/make.conf
# Github
$wget https://github.com/YOUR_USER_ID/YOUR_REPOSITORY_NAME/raw/master/YOUR_MAKE_CONF_DIRECTORY/make.conf
### TEMPLATE
### You can download this via
### wget https://gitlab.com/jeonwh/dotfiles/-/raw/master/Gentoo/make.conf.temp

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-march=native -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j16"

# USE Flags
#USE="networkmanager xinerama jumbo-build ibus cjk"

# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/var/db/repos/gentoo"
DISTDIR="/var/cache/distfiles"
PKGDIR="/var/cache/binpkgs"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

# GRUB:2/UEFI
GRUB_PLATFORMS="efi-64"

# XORG
INPUT_DEVICES="libinput"	# You can add synaptics, if you're using laptop. 
#VIDEO_CARDS="nvidia"
#VIDEO_CARDS="amdgpu radeonsi"

# Language Support
L10N="ko"

# License
#ACCEPT_LICENSE="*"

# Accept Keywords
#ACCEPT_KEYWORDS="~amd64"

# Mirrors for South Korea
GENTOO_MIRRORS="http://ftp.daum.net/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/ ftp://ftp.kaist.ac.kr/gentoo/ http://ftp.lanet.kr/pub/gentoo/ https://ftp.lanet.kr/pub/gentoo/ ftp://ftp.lanet.kr/pub/gentoo/"

Mirror

# 위의 템플릿 다운 받으신 분은 적혀 있습니다.
$mirroselect -i -o >> /mnt/gentoo/etc/portage/make.conf

Copy repos.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

Copy resolv.conf

$cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Mount /proc, /sys, /dev

# 아래 등장할 명령어중 '--make-rslave'옵션은 systemd 설치하실 분만 진행
$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

Chroot

$chroot /mnt/gentoo /bin/bash
$source /etc/profile
$export PS1="(chroot) $PS1"

Portage

$emerge-webrsync
# 혹은
$emerge --sync

$emerge -avuDN @world
$emerge -av gentoolkit eix genlop

News

$eselect news list
$eselect news read N

Profile

$eselect profile list
$eselect profile set N

Timezone

$ls /usr/share/zoneinfo
$echo "Asia/Seoul" > /etc/timezone
$emerge --config sys-libs/timezone-data

Locale

$nano -w /etc/locale.gen
# en_US.UTF-8 UTF-8
$locale-gen
$eselect locale list
$eselect locale set N

Update env

$env-update && source /etc/profile && export PS1="(chroot) $PS1"

Kernel

# 정품
$emerge --ask sys-kernel/gentoo-sources pciutils sys-kernel/linux-firmware

# 진품
$git clone https://github.com/torvalds/linux.git
$wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.14.1.tar.xz

# 유사품 1 [2020-09-15: Gentoo 측 업데이트]
$emerge -a sys-kernel/gentoo-sources-bin
$emerge -a sys-kernel/gentoo-kernel-bin
$emerge -a sys-kernel/gentoo-kernel

# 유사품 2
$emerge -a sys-kernel/gentoo-kernel
$emerge -a sys-kernel/vanilla-sources
$emerge -a sys-kernel/git-sources
$cd /usr/src/linux 

$make mrproper
$make defconfig
$make menuconfig

$make -jN
$make modules_install
$make install

# When updating the kernel
$cp /usr/src/linux/.config /usr/src/linux/NEW_KERNEL
$make olddefconfig
# If you need initramfs
$genkernel --install --kernel-config=/usr/src/linux/.config initramfs
# Microcode
# TIP: Enable 'initramfs' USE Flag
# ex) /etc/portage/package.use/package.use 
# >> sys-firmware/intel-microcode	initramfs

$emerge -av sys-firmware/intel-microcode

Edit fstab

$blkid >> /etc/fstab
$nano -w /etc/fstab

#/dev/sda1    /boot    vfat    defaults,noatime    0 2
#/dev/sda2    none     swap    sw                  0 0
#/dev/sda3    /        ext4    noatime             0 1
#/dev/sda4    /home    ext4    noatime    0 1
# UUID <= remove quotation(")
# PARTUUID <= remove quotation(")

Hostname

$nano -w /etc/conf.d/hostname
$nano -w /etc/conf.d/net
$nano -w /etc/hosts

Netifrc

# netifrc 사용시
$emerge --ask --noreplace net-misc/netifrc
$nano -w /etc/conf.d/net
>config_enp3s0="dhcp"

$cd /etc/init.d
$ln -s net.lo net.enp3s0 

# 본인 드라이버의 이름을 넣어야 합니다.
$rc-update add net.enp3s0 default

# TIP
$emerge -av ifplugd

Passwd

$passwd

Edit rc.conf

$nano -w /etc/rc.conf
>> rc_logger="YES"
>> rc_log_path="/var/log/rc.log"

$nano -w /etc/conf.d/keymaps
$nano -w /etc/conf.d/hwclock

Install logroate, sysklogd, cronie

# TIP: Enable 'logrotate' USE Flag
# ex) /etc/portage/package.use/package.use 
# >> app-admin/sysklogd		logrotate
$emerge --ask app-admin/sysklogd cronie mlocate
$rc-update add sysklogd default
$rc-update add cronie default

$emerge --ask net-misc/dhcpcd
# or
$emerge -av networkmanger
$rc-update add NetworkManager default

GRUB:2

$emerge --ask --verbose sys-boot/grub:2
$grub-install --target=x86_64-efi --efi-directory=/boot
$grub-mkconfig -o /boot/grub/grub.cfg

Reboot

$exit
$cd
$umount -lR /mnt/gentoo
$reboot

Useradd

$useradd -m -g users -G wheel,audio,video,portage -s /bin/bash USER_NAME
$passwd USER_NAME

Remove stage3*tar.xz

$rm /stage3*.tar.xz

XORG

Xorg Logo
$eselect profile list
$eselect profile set N
$emerge -avuDN @world

$env-update && source /etc/profile

$emerge --ask x11-base/xorg-server
$env-update && source /etc/profile

KDE Logo

PLASMA

$eselect profile list
$eselect profile set N
$emerge -avuDN --with-bdeps=y @world

$emerge --noreplace -av elogind udev dbus polkit udisks

$rc-update add dbus default
$rc-update add elogind boot

$emerge -av plasma-meta kde-aps-meta

$emerge --noreplace -av sddm
$usermod -a -G video sddm
$emerge --renoplace -av gui-libs/display-manager-init
$vim /etc/conf.d/display-manager
>> CHECKVT=7
>> DISPLAYMANAGER="sddm"
$rc-update add display-manager default