Gentoo เหมาะกับผู้ที่พอจะมีประสบการณ์กับลีนุกซ์ หรือยูนิกซ์ มาพอสมควร ถ้าไม่แน่ใจว่ากำลังทำอะไรอยู่ กรุณาทดลองติดตั้งผ่าน VMware หรือ virtual machine อื่นๆ ไม่เช่นนั้น ข้อมูลใน Harddisk ของคุณอาจสูญหายได้
ผมว่า Gentoo มันสอนอะไรหลายๆ อย่างในตอนติดตั้ง ใครที่เคยเล่นลีนุกซ์ตัวอื่นมาแล้ว น่าจะลองติดตั้งดู จะได้รสชาติไปอีกแบบ แต่เสียเวลาติดตั้งนานหน่อย
ผมติดตั้งโดยอิงตามคู่มือของ gentoo เป็นหลัก แต่ไม่ได้ทำตามทั้งหมด ถ้าต้องการรายละเอียด โปรดดูจากคู่มือ
ผมใช้ livecd จากที่นี่
http://mirror.in.th/gentoo/releases/x86/2007.0/livecd/livecd-i686-installer-2007.0.iso
หรือ
http://mirrors1.mirrors.64hosting.com/pub/mirrors/gentoo/releases/x86/2007.0/livecd/livecd-i686-installer-2007.0.iso
คู่มือการติดตั้ง
ติดตั้งผ่านอินเตอร์เน็ต
Gentoo Handbook
http://www.gentoo.org/doc/en/handbook/index.xml
ถ้าไม่ได้ติดตั้งผ่านอินเตอร์เน็ต
Gentoo 2007.0 Networkless Handbook
http://www.gentoo.org/doc/en/handbook/2007.0/index.xml
Gentoo Linux x86 Handbook (ผมติดตั้งโดยอิงกับคู่มือนี้)
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml
เมื่อ boot จาก livecd ถ้าไม่ได้ทำอะไรเลย มันจะบูตเข้าสูโหมดกราฟิก
มี installer ทั้งในแบบกราฟิก และ คอนโซล แต่มันมีปัญหาสำหรับผม ไม่สามารถติดตั้งได้
แต่ถ้าต้องการเข้า text mode พิมพ์ (ในที่นี้ผมติดตั้งแบบ text mode)
boot: gentoo nox
3. Configuring your Network
ถ้ามี dhcp server ระบบก็จะได้รับการตั้งค่า ip เรียบร้อยแล้ว เช็คโดยใช้คำสั่ง ifconfig
แต่ถ้าไม่มี หรือต้องการเซตค่าไอพีเอง ใช้คำสั่ง
# net-setup eth0
ถ้าต้องการรีโมทโดย ssh เพื่อติดตั้ง (ผมเองจะใช้วิธีนี้เพราะสามารถ copy คำสั่งต่างๆ ได้ เนื่องจากผมจิ้มดีดไม่แข็งแรง) ต้องกำหนดรหัสผ่านให้ root
# passwd
เปิดการใช้งาน sshd
# /etc/init.d/sshd start
ทดสอบค่าไอพี
livecd ~ # ping -c 3 www.gentoo.org
PING www.gentoo.org (209.177.148.229) 56(84) bytes of data.
64 bytes from loon.gentoo.org (209.177.148.229): icmp_seq=1 ttl=47 time=220 ms
64 bytes from loon.gentoo.org (209.177.148.229): icmp_seq=2 ttl=47 time=219 ms
64 bytes from loon.gentoo.org (209.177.148.229): icmp_seq=3 ttl=47 time=222 ms
— www.gentoo.org ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2020ms
rtt min/avg/max/mdev = 219.706/220.753/222.157/1.165 ms
4. Preparing the Disks
ขั้นตอนการแบ่งพาทิชัน
ตรวจสอบ device file ของ hdd
livecd ~ # fdisk -l
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sda doesn’t contain a valid partition table
ผมจะแบ่งพาทิชันโดยอิงตามคู่มือ เพื่อความง่าย คือ
Partition Filesystem Size Description
/dev/hda1 ext2 100M Boot partition
/dev/hda2 (swap) 512M Swap partition
/dev/hda3 ext3 Rest of the disk Root partition
livecd ~ # fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.
The number of cylinders for this disk is set to 15665.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-15665, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-15665, default 15665): +100M
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 13 104391 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14-15665, default 14):
Using default value 14
Last cylinder or +size or +sizeM or +sizeK (14-15665, default 15665): +512M
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 13 104391 83 Linux
/dev/sda2 14 76 506047+ 83 Linux
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 13 104391 83 Linux
/dev/sda2 14 76 506047+ 82 Linux swap / Solaris
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (77-15665, default 77):
Using default value 77
Last cylinder or +size or +sizeM or +sizeK (77-15665, default 15665): กด Enter
Using default value 15665
Command (m for help): p
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 13 104391 83 Linux
/dev/sda2 14 76 506047+ 82 Linux swap / Solaris
/dev/sda3 77 15665 125218642+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
livecd ~ #
livecd ~ # mkfs.ext2 /dev/sda1
livecd ~ # mkfs.ext3 /dev/sda3
livecd ~ # mkswap /dev/sda2
Setting up swapspace version 1, size = 518184 kB
no label, UUID=8245ae8c-07d7-41b9-89e4-497514e1743c
livecd ~ # swapon /dev/sda2
ทำการ mount
livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ #
5. Installing the Gentoo Installation Files
ตรวจสอบวันเวลา ถ้าไม่ตรง ต้องปรับให้ตรง ไม่เช่นนั้นอาจจะมีปัญหาแปลกๆ ในอนาคต
## date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
livecd ~ # date
Sun Jan 13 13:01:01 UTC 2008
livecd ~ # cd /mnt/gentoo
ดาวน์โหลด satge3 tarball ให้ตรงกับสถาปัตยกรรมของ cpu ลองใช้คำสั่ง uname -m ตรวจสอบดู ในที่นี้ผมใช้ i686
livecd ~ # uname -m
i686
livecd ~ #
ผมโหลดจาก http://mirrors1.mirrors.64hosting.com/pub/mirrors/gentoo/releases/x86/2007.0/stages/stage3-i686-2007.0.tar.bz2
livecd gentoo # wget http://mirrors1.mirrors.64hosting.com/pub/mirrors/gentoo/releases/x86/2007.0/stages/stage3-i686-2007.0.tar.bz2
livecd gentoo # tar xvjpf stage3-i686-2007.0.tar.bz2
ดาวน์โหลด portage ล่าสุด จาก
http://mirrors1.mirrors.64hosting.com/pub/mirrors/gentoo/snapshots/portage-latest.tar.bz2
livecd gentoo # wget http://mirrors1.mirrors.64hosting.com/pub/mirrors/gentoo/snapshots/portage-latest.tar.bz2
livecd gentoo # tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
ถ้าต้องการก็สามารถแก้ไข /mnt/gentoo/etc/make.conf
livecd gentoo # cat /mnt/gentoo/etc/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /etc/make.conf.example for a more detailed example.
CFLAGS=”-O2 -march=i686 -pipe”
CXXFLAGS=”${CFLAGS}”
# This should not be changed unless you know exactly what you are doing. You
# should probably be using a different stage, instead.
CHOST=”i686-pc-linux-gnu”
.
.
6. Installing the Gentoo Base System
6.a. Chrooting
Optional: Selecting Mirrors
livecd gentoo # mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
เลือก http://mirrors.64hosting.com/pub/mirrors/gentoo/ 64 Hosting Mirror (Thailand/http)
และ ftp://mirrors.64hosting.com/pub/mirrors/gentoo/ 64 Hosting Mirror (Thailand/ftp)
livecd gentoo # cat /mnt/gentoo/etc/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /etc/make.conf.example for a more detailed example.
CFLAGS=”-O2 -march=i686 -pipe”
CXXFLAGS=”${CFLAGS}”
# This should not be changed unless you know exactly what you are doing. You
# should probably be using a different stage, instead.
CHOST=”i686-pc-linux-gnu”
GENTOO_MIRRORS=”http://mirrors.64hosting.com/pub/mirrors/gentoo/ ftp://mirrors.64hosting.com/pub/mirrors/gentoo/ “
livecd gentoo #
Copy DNS Info
livecd gentoo # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd gentoo # mount -t proc none /mnt/gentoo/proc
livecd gentoo # mount -o bind /dev /mnt/gentoo/dev
livecd gentoo # chroot /mnt/gentoo /bin/bash
livecd / # env-update
>>> Regenerating /etc/ld.so.cache…
livecd / # source /etc/profile
livecd / # export PS1=”(chroot) $PS1″
(chroot) livecd / #
6.b. Configuring Portage
(chroot) livecd / # emerge --sync
…
>>> Updating Portage cache: 100%
* An update to portage is available. It is _highly_ recommended
* that you update portage now, before any other packages are updated.
* Please run ‘emerge portage’ and then update ALL of your
* configuration files.
* To update portage, run ‘emerge portage’.
บรรทัดด้านล่างนี้ ไม่ได้บอกไว้ในคู่มือ ผมทำเองตามที่ระบบ recommend จากด้านบน
######### (chroot) livecd / # emerge portage
.
.
Optional: glibc Locales
# nano -w /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
# locale-gen
7.a. Timezone
(chroot) livecd / # cp /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
7.b. Installing the Sources
(chroot) livecd / # emerge gentoo-sources
7.d. Alternative: Using genkernel
(chroot) livecd / # emerge genkernel
(chroot) livecd / # zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-config-2.6
(chroot) livecd / # genkernel all
(chroot) livecd / # ls /boot/kernel* /boot/initramfs*
/boot/initramfs-genkernel-x86-2.6.23-gentoo-r3 /boot/kernel-genkernel-x86-2.6.23-gentoo-r3
(chroot) livecd / #
.
.
8. Configuring your System
(chroot) livecd / # nano -w /etc/fstab
…
# <fs> <mountpoint> <type> <opts> <dump/pass>
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda1 /boot ext2 defaults,noatime 1 2
/dev/sda3 / ext3 noatime 0 1
/dev/sda2 none swap sw 0 0
/dev/cdrom /mnt/cdrom audo noauto,ro 0 0
#/dev/fd0 /mnt/floppy auto noauto 0 0
# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files)
shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
(chroot) livecd / # nano -w /etc/conf.d/hostname
# /etc/conf.d/hostname
# Set to the hostname of this machine
HOSTNAME="mygentoo"
(chroot) livecd / # nano -w /etc/conf.d/net
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d. To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
#config_eth0=( "dhcp" )
#dhcp_eth0="nodns nontp nonis"
config_eth0=( "192.168.1.10 netmask 255.255.255.0 brd 192.168.1.255" )
routes_eth0=( "default via 192.168.1.1" )
(chroot) livecd / # rc-update add net.eth0 default
* net.eth0 added to runlevel default
(chroot) livecd / #
(chroot) livecd / # nano -w /etc/hosts
# /etc/hosts: Local Host Database
#
…
192.168.1.10 mygentoo.mydomain mygentoo
Set root password
(chroot) livecd / # passwd
New UNIX password:
Retype new UNIX password:
passwd: password updated successfully
(chroot) livecd / #
(chroot) livecd / # nano -w /etc/conf.d/clock
# /etc/conf.d/clock
# Set CLOCK to “UTC” if your system clock is set to UTC (also known as
# Greenwich Mean Time). If your clock is set to the local time, then
# set CLOCK to “local”. Note that if you dual boot with Windows, then
# you should set it to “local”.
#CLOCK="UTC"
CLOCK="local"
# Select the proper timezone. For valid values, peek inside of the
# /usr/share/zoneinfo/ directory. For example, some common values are
# “America/New_York” or “EST5EDT” or “Europe/Berlin”.
#TIMEZONE=”Factory”
TIMEZONE="Asia/Bangkok"
…
9.a. System Logger
(chroot) livecd / # emerge syslog-ng
(chroot) livecd / # rc-update add syslog-ng default
* syslog-ng added to runlevel default
.
9.b. Optional: Cron Daemon
(chroot) livecd / # emerge vixie-cron
(chroot) livecd / # rc-update add vixie-cron default
* vixie-cron added to runlevel default
.
.
10. Configuring the Bootloader
(chroot) livecd / # emerge grub
(chroot) livecd / # nano -w /boot/grub/grub.conf
default 0
timeout 5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title=Gentoo Linux 2.6.23-gentoo-r3
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.23-gentoo-r3 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 udev doscsi
initrd /boot/initramfs-genkernel-x86-2.6.23-gentoo-r3
(chroot) livecd / # grep -v rootfs /proc/mounts > /etc/mtab
(chroot) livecd / # grub-install --no-floppy /dev/sda
10.d. Rebooting the System
(chroot) livecd / # exit
exit
livecd gentoo # cd
livecd ~ # umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
livecd ~ # reboot
#################################################################
ถ้าตอน Boot มี error message
“One of the files in /etc/{conf.d,init.d} or /etc/rc.conf has a modification time in the future!”
run command
# touch /etc/{conf.d,init.d}/*
ถ้าต้องการรีโมทผ่าน ssh
# emerge openssh
# rc-update add sshd default
ถ้าต้องการ update package ในระบบทั้งหมด
# emerge --sync
# emerge --update --deep world
ถ้าผมจะลงพร้อมกับ vista แล้วทำ Dual Boot โดยที่ผมลง vista ไปแล้ว แล้วต้องแบ่งพาติชันยังงัยให้กับ gentoo ครับ แบบว่าผมเพิ่งหัดเล่น linux ครับ
ความเห็น โดย por — กุมภาพันธ์ 25, 2008 @ 1:45 am