Gentoo Linux 설치 20121213

12811 단어 Linux
[!NOTE]
이 글은 2013/03/16momoto.github.io에 기고한 내용을 Qita로 옮긴 것이다
Gentoo Linux 201213이 설치된 프로그램의 기록입니다.설치 미디어는 install-x86-minimia-20213입니다.iso를 사용합니다.네트워크가 이미 연결되어 있는 상태를 전제로 하는 DHCP 기반

1. 시작



커널 및 부팅 옵션이 지정된 화면에서 별도의 지정 없이 Enter 키를 눌러 설치를 시작합니다.키보드 레이아웃의 선택 화면이 바로 나타나기 때문에 일본어 레이아웃의 키보드를 사용한 상태에서 입력22한다.

시작이 완료되고 루트에 로그인할 때 ping 명령 등을 통해 네트워크와의 연결을 확인합니다.

2. 스토리지 디바이스 준비


Gentoo Linux를 설치할 스토리지 디바이스를 준비합니다.SCSI 또는 직렬 ATA로 연결된 장치는 명령lsscsi 목록을 통해 레코드 시스템의 블록 장치(/dev/sda 등)를 확인할 수 있습니다.본고는 parted/dev/sda에서 간단한 안내 구역과 루트 구역을 만듭니다.
블록 장치 확인
livecd ~ # lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[2:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0
parted에 사용된 명령help에서 확인할 수 있습니다.mklabel에서 구역 라벨을 지정하고 mkpart에서 구역을 구분합니다.
파티션 사용
livecd ~ # parted /dev/sda

GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) mklabel msdos # パーティンションラベルを指定
(parted) mkpart primary ext2 0 32mb # ブートパーティションを作成

Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i # 開始位置がディスクのオフセットとアラインメント要求に一致しない場合の警告

(parted) mkpart primary ext4 32mb -1s # ルートパーティションを作成

Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i

(parted) print # 作成したパーティションの確認

Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      512B    32.0MB  32.0MB  primary
 2      32.0MB  8590MB  8558MB  primary

(parted) quit # 対話を終了する

Information: You may need to update /etc/fstab.
그리고 파일 시스템을 위에서 만든 구역에 적용합니다.상기 예시mkpart에서 지정한 대로 ext2를/dev/sda1에 적용하고 ext4를/dev/sda2에 적용합니다.
파일 시스템 형식
livecd ~ # mkfs.ext2 /dev/sda1
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
...
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

livecd ~ # mkfs.ext4 /dev/sda2
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
...
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
구역과 파일 시스템이 준비되면 루트 구역을/mnt/gentoo에 설치하고, 가이드 구역을/mnt/gentoo/boot에 설치합니다.
영구 마운트
livecd ~ # mount /dev/sda2 /mnt/gentoo/
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot/

3. 시스템 설치


3-1. stage 3tarball과portage 다운로드


우선 시스템을 설치할 설치점/mnt/gentoo로 이동하여 links 명령으로Gentoo 렌즈 목록에 접근합니다.
Gentoo 미러 목록 액세스
livecd ~ # cd /mnt/gentoo/
livecd gentoo # links http://www.gentoo.org/main/en/mirrors.xml
텍스트/그래픽 웹 브라우저links에서 대칭복사 목록에 액세스하면 다음 이미지가 표시됩니다.
links 시동 후 거울 목록에서 국내 거울로 이동하여 다운로드stage3-<architecture>–<release>.tar.bz2とportage-latest.tar.bz2.JAIST(북륙첨단과학기술대학)의 거울이라면 releases/x86/current-stage3/snapshots/의 디렉터리에 설정합니다.다운로드 후 tarball마다 아래 옵션으로 펼칩니다.
talball의 전개
livecd gentoo # tar xvjpf stage3-*.tar.bz2
livecd gentoo # tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

3-2. Portage 설정


이어서/etc/make.conf에서 Portage 변수를 설정합니다.최소한 필요한 변수인 -march에서 명령 집합 구조를 지정합니다.환경과 프로그램의 최적 설정이 다르고 Portage의 설정이 시스템에 광범위하게 영향을 미칠 수 있기 때문에 본고는 Gentoo Linux 설명서에서 일반적으로 소개한 예시를 사용한다.
Portage 변수 설정
livecd gentoo # touch /mnt/gentoo/etc/make.conf
livecd gentoo # nano -w /mnt/gentoo/etc/make.conf

  ---
  CFLAGS="-O2 -march=i686 -pipe"
  CXXFLAGS="${CFLAGS}"
  MAKEOPT="-j2"
mirrorselect 명령 선택경을 사용합니다.선택한 거울의 정보는/etc/make입니다.conf에 기록됩니다.
미러 선택
livecd gentoo # mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
* Downloading a list of mirrors... Got 222 mirrors.

3-3. /마운트, chroot, 로켈 및 시간대 설정


/proc 및/dev 마운트
livecd gentoo # mount -t proc none /mnt/gentoo/proc/
livecd gentoo # mount --rbind /dev/ /mnt/gentoo/dev/
새로 설치한 환경에 chroot
livecd gentoo # chroot /mnt/gentoo/ /bin/bash
livecd / # env-update
>>> Regenerating /etc/ld.so.cache...
livecd / # source  /etc/profile
livecd / # export PS1="(chroot) $PS1"
/etc/locale.gen에서 지정한 위치의 행(ja JP.UTF-8 UTF-8)을 재연하고 locele-gen 명령을 실행합니다.
로켈 지정
(chroot) livecd / # nano -w /etc/locale.gen
(chroot) livecd / # locale-gen
 * Generating 1 locales (this might take a while) with 1 jobs
 *  (1/1) Generating ja_JP.UTF-8 ... [ ok ]
 * Generation complete
(chroot) livecd / #
시간대 설정
(chroot) livecd / # cp /usr/share/zoneinfo/Japan /etc/localtime

3-4. Portage를 통한 설치


Portage 트리를 최신 상태로 업데이트
(chroot) livecd / # emerge --sync

 ...
 * An update to portage is available. It is _highly_ recommended
 * that you update portage now, before any other packages are updated.

 * To update portage, run 'emerge portage' now.


 * IMPORTANT: 7 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

(chroot) livecd / #
지원되는 프로파일 목록을 확인하고 선택합니다.
프로파일 선택
(chroot) livecd / # eselect profile list
Available profile symlink targets:
  [1]   default/linux/x86/13.0
  [2]   default/linux/x86/13.0/selinux
  [3]   default/linux/x86/13.0/desktop
  [4]   default/linux/x86/13.0/desktop/gnome
  [5]   default/linux/x86/13.0/desktop/kde
  [6]   default/linux/x86/13.0/developer
  [7]   hardened/linux/x86
  [8]   hardened/linux/x86/selinux
  [9]   hardened/linux/uclibc/x86
(chroot) livecd / #
(chroot) livecd / # eselect profile set 1
gentoo-sources를 설치합니다.이 가방에는 리눅스 커널이 들어 있다.
gentoo-sources 설치
(chroot) livecd / # emerge gentoo-sources
내부 원본 설정을 컴파일합니다.여기서는 수동이 아니라genkernel을 사용합니다.
내부 원본 설정 및 컴파일
(chroot) livecd / # emerge genkernel
(chroot) livecd / # genkernel all

4. 재부팅


다시 기동하기 전에 시스템에서 사용하는 구역은/etc/fstab에 기술되어 있습니다.상술한 예라면/dev/sda1과/dev/sda2 두 개를 기술합니다.
/etc/fstab 편집
(chroot) livecd / # nano -w /etc/fstab

  ---
  /dev/sda1               /boot           ext2            noauto,noatime  1 2
  /dev/sda2               /               ext4            noatime         0 1
  #/dev/cdrom              /mnt/cdrom      auto            noauto,ro       0 0
그런 다음 부팅 로더를 설치합니다.GRUB를 사용할 때는 emerge에/boot/grub/grub를 설치합니다.conf를 고친 후 실행grub-install합니다.
GRUB 설치
(chroot) livecd / # emerge grub
(chroot) livecd / # nano -w /boot/grub/grub.conf

  ---
  default 0
  timeout 30
  splashimage=(hd0,0)/boot/grub/splash.xpm.gz

  title Gentoo Linux 3.7.10
  root (hd0,0)
  kernel /boot/kernel-genkernel-x86-3.7.10-gentoo root=/dev/ram0 real_root=/dev/sda2
  initrd /boot/initramfs-genkernel-x86-3.7.10-gentoo
  ---

(chroot) livecd / # grep -v rootfs /proc/mounts > /etc/mtab
(chroot) livecd / # grub-install --no-floppy /dev/sda
마지막으로 설치된 구역을 마운트 해제하고 다시 시작합니다.
재부팅
(chroot) livecd / # exit
livecd gentoo # cd
livecd ~ # umount -l /mnt/gentoo/dev{/shm,/pts,}
livecd ~ # umount -l /mnt/gentoo{/boot,/proc,}
livecd ~ # reboot
재부팅 후 부팅 부팅 시스템 부팅 후 설치가 완료됩니다.설치 후 상기 단계에서 생략된 시스템 설정(사용자의 추가, 비밀번호 변경)을 진행한다.


참고 자료

  • Gentoo 설명서(일본어)
  • 좋은 웹페이지 즐겨찾기