새소식

개발+공부/Linux 리눅스

[Gentoo] Gentoo Handbook: Installation (4) Installing base system

  • -
728x90

Chrooting

Copy DNS info

root # cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Mounting the necessary filesystems

(자세한 설명은 Handbook 참고)

root # mount --types proc /proc /mnt/gentoo/proc
root # mount --rbind /sys /mnt/gentoo/sys
root # mount --make-rslave /mnt/gentoo/sys
root # mount --rbind /dev /mnt/gentoo/dev
root # mount --make-rslave /mnt/gentoo/dev
root # mount --bind /run /mnt/gentoo/runaldks
root # mount --make-slave /mnt/gentoo/run

Entering the new environment

chrooting을 통해 새로운 설치 환경에 들어간다. 세션이 root에서 현재 설치 환경으로 들어간다는 말이다.

  • chroot: root 위치를 / 에서 /mnt/gentoo/ 로 변경한다.
  • source: /etc/profile 내에 있는 설정들을 메모리로 reload한다.
  • export: (chroot)를 표시하여 chroot 환경 내에 있음을 기억하게 한다.
root # chroot /mnt/gentoo /bin/bash
root # source /etc/profile
root # export PS1="(chroot) ${PS1}"
(chroot) root #

이 시점부터 모든 actions은 즉시 새로운 Gentoo Linux 환경에서 이뤄진다.

Mounting the boot partition

boot partition을 mount해야 한다. kernel을 컴파일하고 bootloader를 설치할 때 중요할 것이다.

(chroot) root # mount /dev/sda1 /boot

Configurig Portage

Installing a Gentoo ebuild repository snapshot from the web

(chroot) root # emerge-webrsync

Choosing the right profile

  • eselect profile list: 현재 시스템이 어떤 프로필을 사용하는 지 확인
(chroot) root # eselect profile list
Available profile symlink targets:
  [1]   default/linux/amd64/17.1 (stable) *
  [2]   default/linux/amd64/17.1/selinux (stable)
  [3]   default/linux/amd64/17.1/hardened(stable)
  [4]   default/linux/amd64/17.1/hardened/selinux (stable)
	[5]   default/linux/amd64/17.1/desktop (stable)
  [6]   default/linux/amd64/17.1/desktop/gnome (stable)
  [7]   default/linux/amd64/17.1/desktop/gnome/systemd (stable)
	...
systemd가 아닌 것은 openRC라고 봐도 된다. (혹시 모르니 검색해보자. 검색하면 나온다.)

openRC, gnome 을 사용해야 하므로 6번 profile로 설정한다.

(chroot) root #eselect profile set 6
(chroot) root # eselect profile list
Available profile symlink targets:
  [1]   default/linux/amd64/17.1 (stable)
  [2]   default/linux/amd64/17.1/selinux (stable)
  [3]   default/linux/amd64/17.1/hardened(stable)
  [4]   default/linux/amd64/17.1/hardened/selinux (stable)
	[5]   default/linux/amd64/17.1/desktop (stable)
  [6]   default/linux/amd64/17.1/desktop/gnome (stable) *
  [7]   default/linux/amd64/17.1/desktop/gnome/systemd (stable)
	...

Updating the @world set

오래 걸린다. 그 동안 Handbook을 읽어보자.

(chroot) root # emerge --ask --verbose --update --deep --newuse @world

Configuring the USE variable

굳이 수정하지 않아도 된다. default로 두고 넘어간다.

Timezone

이후에 설정가능하고, 지금 굳이 할 필요가 없다.

Configure locales

Locale generation

대부분의 사용자들은 시스템에 1~2개의 locale을 사용한다.

Locale은 언어 뿐만 아니라 string 정렬, date/time, 등을 명시한다.

지원되는 시스템 locale은 /etc/locales.gen 파일 내에 정의되어야 한다.

(chroot) root # nano -w /etc/locale.gen
// /etc/locale.gen

C.UTF8 UTF-8
en_US ISO-8859-1
en_US.UTF-8 UTF-8
  • locale-gen: /etc/locale.gen 파일에 정의된 모든 locale을 생성한다.
(chroot) root # locale-gen

Locale selection

system-wide locale setting을 설정해보자.

  • locale: eselect의 locale 모듈
(chroot) root # eselect locale list
Available targets for the LANG variable:
  [1]  C
  [2]  C.utf8
  [3]  en_US
  [4]  en_US.iso88591
  [5]  en_US.utf8
	[6]  PSIX
	[ ]  (free form)

locale list로 표시된 locale 목록 중 하나를 선택한다.

(chroot) root # eselect locale set 5

환경을 reload한

(chroot) root # env-update && source /etc/profile && export PS1="(chroot) ${PS1}"
728x90
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.