젠투(Gentoo) 리눅스 설치

from Linux 2009/12/29 01:17
사용자 삽입 이미지

젠투(Gentoo) 리눅스는 직접 소스 컴파일 하여 하드웨어에 가장 알맞게 최적화를 시키기에 좋은 배포판입니다.
이 글은 젠투(Gentoo) 리눅스의 Stage3 설치 방식으로 진행합니다.

국내 미러 사이트에서 Gentoo Livecd를 다운로드하고 시디 버닝을 합니다.
ftp://ftp.daum.net/gentoo/releases/x86/current-iso/

- 원격 설치 설정
Gentoo Livecd 로 부팅이 된 화면입니다.
사용자 삽입 이미지

원격 설치를 위해 네트워크 설정을 합니다.
livecd ~ # net-setup eth0
인터페이스 정보 화면이며 Yes를 눌러 넘어갑니다.
사용자 삽입 이미지

네트워크 설정 화면에서 자신의 환경이 무선, 유선임에 따라 적절히 선택하고 넘어갑니다.
사용자 삽입 이미지

유선 네트워크로 설정시 TCP/IP 설정 화면이 나옵니다. 2번을 눌러 고정 아이피로 설정 해줍니다.
사용자 삽입 이미지

아이피 주소를 적어 줍니다.
사용자 삽입 이미지

브로드캐스트 주소를 적어줍니다.
사용자 삽입 이미지

 넷마스크를 적어줍니다.
사용자 삽입 이미지

기본 게이트웨이를 적어줍니다.
사용자 삽입 이미지

DNS 서버 아이피를 적어줍니다.
사용자 삽입 이미지

DNS 쿼리시 찾을 도메인을 적어줍니다.
사용자 삽입 이미지

원격으로 설치하기 위해 ssh 데몬을 시작합니다.
livecd ~ # /etc/init.d/sshd start

원격 접속에 필요한 루트 비밀번호를 설정 해줍니다.
livecd ~ # passwd root
New password:
Retype new password:
passwd: password updated successfully

PuTTY, SecureCRT 와 같은 프로그램으로 젠투 서버에 원격으로 로그인 합니다.
사용자 삽입 이미지

 - 파티션  설정
현재의 디스크를 살펴봅니다. 200기가 정도 있군요..
livecd ~ # fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sda doesn't contain a valid partition table

루트 파티션과 스왑 파티션을 적절히 나눠 줍니다.
livecd ~ # fdisk /dev/sda

The number of cylinders for this disk is set to 26108.
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)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-26108, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-26108, default 26108): 25084

스왑 파티션을 만들어 줍니다.
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (25085-26108, default 25085):
Using default value 25085
Last cylinder, +cylinders or +size{K,M,G} (25085-26108, default 26108):
Using default value 26108

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)
스왑 파티션은 82번 입니다.
사용자 삽입 이미지

 만든 파티션을 확인 합니다.
Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x20a0619f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       25084   201487198+  83  Linux
/dev/sda2           25085       26108     8225280   82  Linux swap / Solaris

위에 설정들을 저장하고 빠져 나옵니다.
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

생성된 루트 파티션(/dev/sda1)을 ext3 파일 시스템으로 포멧합니다.
livecd ~ # mkfs -t ext3 /dev/sda1
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
12599296 inodes, 50371799 blocks
2518589 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1538 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

스왑 파티션(/dev/sda2)을 사용할수 있도록 생성 해줍니다.
livecd ~ # mkswap /dev/sda2
Setting up swapspace version 1, size = 8225276 KiB
no label, UUID=454fa1b3-76aa-40da-9e15-01bf0b7181df

스왑을 활성화 합니다.
livecd ~ # swapon /dev/sda2
livecd ~ # cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       8225272 0       -1

- Stage3 설치
/mnt/gentoo 를 마운트 합니다.
livecd ~ # mount /dev/sda1 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ # cd /mnt/gentoo

국내 미러 사이트에서 Stage3 을 다운로드 합니다.
livecd gentoo # wget \
ftp://ftp.daum.net/gentoo/releases/x86/current-stage3/stage3-i686-20091229.tar.bz2

Stage3 을 압축을 풀어줍니다.
livecd gentoo # tar xjvf stage3-i686-20091229.tar.bz2

proc를 사용할수 있도록 마운트 해줍니다.
livecd gentoo # mount -t proc proc /mnt/gentoo/proc
livecd gentoo # mount | grep /mnt/gentoo/proc
proc on /mnt/gentoo/proc type proc (rw)

- 미러 설정
Gentoo 리눅스는 미러서버를 통하여 패키지들을 받아오기 때문에 적당한 미러 서버를 선택 합니다.
livecd ~ # mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
사용자 삽입 이미지

- chroot 진입
설치될 파티션을 "/" 최상위 디렉토리로 변경하여 설치를 하도록 설정 해줍니다.
livecd ~ # cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
livecd ~ # chroot /mnt/gentoo /bin/bash
livecd / # env-update
>>> Regenerating /etc/ld.so.cache...
livecd / # source /etc/profile

- Portage 받기
Portage 스냅샷을 다운로드 받습니다.
livecd / # cd /usr
livecd usr # wget ftp://ftp.daum.net/gentoo/snapshots/portage-latest.tar.bz2
livecd usr # tar xjvf portage-latest.tar.bz2

- 최적화 설치 작업
사용자의 취향에 맞는 최적화 기능을 위해서 /etc/make.conf 파일을 아래와 같이 nano 에디터로 수정합니다.
(필요없는 분들은 안하셔도..)
livecd / # nano /etc/make.conf
CFLAGS="-O2 -march=i686 -pipe"
CXXFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
LINGUAS="en ko"
PORTDIR_OVERLAY="/usr/portage"

GENTOO_MIRRORS="ftp://ftp.daum.net/gentoo/ "

- 지역별 시간대 설정
기본 시간대는 GMT 기준으로 되어있으므로 아래와 같이 설정 해줍니다.
livecd / # echo 'ko_KR UTF-8' >> /etc/locale.gen
livecd / # echo 'ko_KR.UTF-8 UTF-8' >> /etc/locale.gen
livecd / # echo 'ko_KR.EUC-KR EUC-KR' >> /etc/locale.gen
livecd / # locale-gen
livecd / # cp /usr/share/zoneinfo/Asia/Seoul /etc/localtime
livecd / # nano /etc/conf.d/clock
CLOCK="UTC"
TIMEZONE="Asia/Seoul"

- fstab 설정
livecd / # nano /etc/fstab
# <fs>                  <mountpoint>    <type>          <opts>                    <dump/pass>
/dev/sda1                     /                  ext3             noatime                          0 1
/dev/sda2                    none             swap             sw                               0 0
shm                           /dev/shm        tmpfs            nodev,nosuid,noexec       0 0
사용자 삽입 이미지

- 커널(Kernel) 설치
커널 설치는 genkernel 을 사용하여 컴파일 하는 방법과 소스를 다운받아 설치하는 방법이 있습니다.
처음 설치하시는 분들은 genkernel 을 사용하는 것이 더 맘편합니다.

- genkernel을 이용한 커널 설치
livecd / # emerge gentoo-sources
livecd / # emerge genkernel
livecd / # genkernel --menuconfig all

- 필요한 패키지 설치
필요한 패키지들을 설치 해줍니다.

- System 로그 데몬
livecd / # emerge syslog-ng
livecd / # rc-update add syslog-ng  default

- cron 데몬 설치
livecd / # emerge vixie-cron
livecd / # rc-update add vixie-cron default

- reiserfsprogs 설치
livecd / #emerge reiserfsprogs

- Hotplug 설치
livecd / # emerge hotplug
livecd / # rc-update add hotplug default

- vim 에디터
livecd / # emerge vim

- cvs
livecd / # emerge cvs

- dhcpd
livecd / # emerge dhcpcd

부팅시 SSH 데몬이 자동 실행되도록 등록해줍니다.
livecd / # rc-update add sshd  default

- 루트 비밀번호 설정
처음에 livecd 에서 설정한 루트 비밀번호와 다르므로 꼭 설정 해주셔야 합니다.
livecd / # passwd
New password:
Retype new password:
passwd: password updated successfully

- 호스트네임 설정
livecd / # echo 'HOSTNAME="ruo91"' > /etc/conf.d/hostname

- 네트워크 설정
livecd / # echo 'dns_servers_eth0="168.126.63.1 168.126.63.2"' >> /etc/conf.d/net
livecd / # echo 'routes_eth0="default via 192.168.0.1"' >> /etc/conf.d/net
livecd / # echo 'config_eth0="192.168.0.100 netmask 255.255.255.0"' >> /etc/conf.d/net
livecd / # cat /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 :]!).
dns_servers_eth0="168.126.63.1 168.126.63.2"
routes_eth0="default via 192.168.0.1"
config_eth0="192.168.0.100 netmask 255.255.255.0"

- 부트로더 설치

grub 설치
livecd / # emerge grub
livecd / # grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
사용자 삽입 이미지

genkernel 로 커널 컴파일시 아래 예제 처럼 설정 해줍니다.
livecd / # vim /boot/grub/grub.conf
default 0
timeout 3
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title Gentoo Linux 2.6.31-gentoo-r6
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.31-gentoo-r6 root=/dev/sda1
initrd /initramfs-genkernel-x86-2.6.31-gentoo-r6

- 설치 마무리
모든 설정을 적용하고 마운트한 것들을 umount 과 재부팅을 해줍니다.
livecd / # etc-update
livecd / # exit
livecd / # cd /
livecd / # umount /mnt/gentoo/boot
livecd / # umount /mnt/gentoo/proc
livecd / # umount /mnt/gentoo
livecd / # reboot

참고
http://wiki.kldp.org/wiki.php/GentooInstall
http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml

도움 주신분
Google, HanIRC #Gentoo 채널의 badung 님 (fstab 에서 막힌 문제를 한번에 해결 해주셨음..)
2009/12/29 01:17 2009/12/29 01:17
FreeBSD 에서 리눅스 바이너리 호환성이 기본적으로 설정되어 있지 않기 때문에 커널에 모듈을 적재하는 방식인 kldload를 사용합니다.
( FreeBSD 8.0 부터는 기본으로 Fedora4 리눅스 런타임 라이브러리가 설치가 되어 있다고 합니다. )

linux 호환성 모듈을 적재 합니다.
[root@yongbok ~]# kldload linux

모듈이 정상적으로 올라왔는지 확인을 합니다.
[root@yongbok ~]# kldstat
Id Refs Address    Size     Name
1    9 0xc0400000 847a08   kernel
 2    1 0xc8250000 26000    linux.ko
3    1 0xc8943000 2000     accf_http.ko

/etc/rc.conf 설정 파일에 리눅스 호환성 모듈을 활성화 시켜 줍니다.
[root@yongbok ~]# echo 'linux_enable="YES"' >> /etc/rc.conf

FreeBSD 의 Ports 를 이용하여 최신의 Fedora10 리눅스 런타임 라이브러리를 설치를 해주시면 됩니다.
( http://www.freebsd.org/cgi/ports.cgi?query=linux_base&stype=all&sektion=emulators )
[root@yongbok ~]# cd /usr/ports/emulators/linux_base-f10 && make install distclean

참고
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu-lbc-install.html
2009/12/25 13:06 2009/12/25 13:06
jline를 설치시 JAVA_HOME 이 미리 정의되어 있다면 아래와 같이 에러를 냅니다.
(이 경우 JDK를 미리 설치해서 export 시켰을때..)
[root@yongbok ~]# cd /usr/ports/devel/jline && make install clean
jline-0.9.91_1: Environment error: "JAVA_HOME" should not be defined.
*** Error code 1

Stop in /usr/ports/devel/jline.
*** Error code 1

Stop in /usr/ports/devel/jline.

정의되어 있는 JAVA_HOME 을 unset 시켜 주시면 됩니다.
[root@yongbok /usr/ports/devel/jline]#  unset JAVA_HOME
2009/12/23 12:39 2009/12/23 12:39
BackTrack 는 Ubuntu 리눅스의 기본 베이스에 보안에 관련 된 해킹 도구들을 한데 모아논 배포판입니다.
BackTrack 리눅스 배포판은 아래 영문 사이트에서 다운로드 하실수 있으며 설치 방법에 대해 그림과 같이 설명 드리고자 합니다. 필자는 Vmware 에서 설치 시도를 해보았습니다. 본 글은 BackTrack 4 Final Release 기준으로 작성 되었습니다.

BackTrack Download
http://www.backtrack-linux.org/downloads/
기본값 선택은 첫번째 1024X768 해상도로 들어가게 되니 사용자가 원하는 해상도에 들어가 줍니다.
사용자 삽입 이미지

그래픽 모드로 입장하기 위해서 startx 를 입력하여 X-Window 를 실행합니다.
사용자 삽입 이미지

BackTrack4 에서는 기본적으로 KDE 데스크톱 환경으로 설치가 되어 있습니다.
우분투 사용자라면 Kubuntu 환경과 같다고 보시면 되겠습니다.
설치를 위해 바탕화면에 있는 install.sh 쉘 스크립트를 한번 클릭 해줍니다.
사용자 삽입 이미지

시간 설정 화면이며 기본값으로 New York 으로 되어 있으니 수동으로 Seoul 로 맞추고 넘어갑니다.
사용자 삽입 이미지

한국 키보드 레이아웃으로 선택합니다.
사용자 삽입 이미지

파티션 나누는 화면입니다. 일반 사용자라면 그냥 기본값으로 넘어가주고 고급 사용자라면 Manual 에 들어가셔서 직접 파티션을 나눠 주시고 넘어 갑니다.
사용자 삽입 이미지

설치할 준비가 되었으니 Install 를 눌러줍니다.
사용자 삽입 이미지

소요 시간 보통 5~20분 사이로 예상됩니다.
사용자 삽입 이미지

설치가 완료 되었으니 재부팅 해줍니다.
사용자 삽입 이미지

키보드의 엔터키를 눌러 재부팅을 합니다.
사용자 삽입 이미지

BackTrack4 Final 버전의 로그인 루트 아이디는 root 비밀번호는 toor 입니다.
사용자 삽입 이미지

startx 로 X-Windows 로 부팅합니다.
사용자 삽입 이미지

한글 설정을 위해 콘솔을 눌러 터미널을 띄웁니다.
사용자 삽입 이미지

한글을 설정하기 위한 패키지들을 검색 해봅니다.
root@bt:~# apt-cache search language-pack | grep Korean
사용자 삽입 이미지

인터넷 연결이 안되어 있으므로 네트워킹을 재시작 하겠습니다.
root@bt:~# /etc/init.d/networking restart

BackTrack4 는 KDE 데스크톱 환경을 사용하니 KDE 와 관련된 한글 패키지들을 설치 해줍니다.
root@bt:~# apt-get install -y language-support-ko language-pack-kde-ko language-support-input-ko language-pack-kde-ko-base language-support-fonts-ko language-pack-ko language-support-translations-ko language-pack-ko-base language-support-extra-ko

사용자 삽입 이미지

패키지 설치 완료 후 로케일 설정을 위해 콘솔에 아래와 같이 입력 후 Default -> Asia, East -> South Korea 로 선택 해줍니다.

root@bt:~# kcmshell language

사용자 삽입 이미지

변경 된 모습

사용자 삽입 이미지

euckr 로 로케일 변경

root@bt:~# locale-gen ko_KR.EUC-KR
root@bt:~# dpkg-reconfigure locales

사용자 삽입 이미지

/etc/environment 에 euckr 추가

root@bt:~# echo 'LANG="ko_KR.EUC-KR"' >> /etc/environment
root@bt:~# cat /etc/environment | grep LANG
LANG="ko_KR.EUC-KR"
사용자 삽입 이미지

루트 .profile 에 LANG=C, LANGUAGE=C 를 LANG="ko_KR.EUC-KR", LANGUAGE="ko_KR.EUC-KR" 으로 모두 변경 합니다.
root@bt:~# kate ~/.profile
#LANG=C
#LANGUAGE=C
LANG="ko_KR.EUC-KR"
LANGUAGE="ko_KR.EUC-KR"

시스템을 재부팅 합니다.
root@bt:~# reboot

루트로 로그인 후 루트 비밀번호를 원하는 것으로 재설정 합니다.
root@bt:~# passwd root
Enter new INIX password:
Retype new INIX password:
passwd: password updated successfully

사용자 삽입 이미지

euckr 로 변경 되었는지 로케일 정보를 확인 합니다.

root@bt:~# locale

사용자 삽입 이미지

SCIM에서 Ctrl + Space Bar 를 통해서 한/영 전환을 할수 있게 되었습니다.

한글 입력기를 SCIM 대신 navi 로 변경 하고 싶을 경우 아래와 같이 im-switch 로 변경 할수도 있습니다.

root@bt:~# im-switch -c

사용자 삽입 이미지

BackTrack4 설치와 한글 설정이 끝났습니다. :D

2009/12/13 11:20 2009/12/13 11:20