🌟BugsBunny🌟 2011. 5. 14. 15:29

μž‘μ„±μž : ν•˜νƒœμš© <bunny> 
 
λ‚˜λŠ” 주둜 μž‘μ—…μ„ ν• λ•ŒλŠ” λ‘œμ»¬μ—μ„œ ν•˜μ§€ μ•ŠλŠ” 성격이닀.
주둜 SSH 둜 μ›κ²©μ ‘ν˜Ήν•΄μ„œ μž‘μ—…ν•˜κΈ° λ•Œλ¬Έμ— 일단 라이브 씨디 μ‹œμŠ€ν…œμ—μ„œ
SSH 섀정을 ν•΄ μ£Όκ³  μ„€μΉ˜ μž‘μ—…μ„ ν•΄μ•Ό ν•œλ‹€.
라이브 μ‹œμŠ€ν…œ μ•ˆμ— μžˆλŠ” SSH μ„€μ • 파일이 μ•½κ°„ λ³΄μ•ˆμ΄ λ„ˆλ¬΄ κ°•ν™”μ‹œμΌœμ„œ μ ‘μ†ν•˜λŠ”λ°
λ¬Έμ œκ°€ 있기 λ•Œλ¬Έμ— 이뢀뢄은 λ‹€μŒκ³Ό 같이 μ˜€ν”ˆ μ„€μ • 파일둜 λ³€κ²½ν•˜κ³  μ„œλ²„ 데λͺ¬μ„ 재 μ‹œμž‘ ν•œλ‹€.
< OPENSSH μ„€μ • >
livecd / # vi /etc/ssh/ssh_config
Host localhost
    ForwardAgent yes
    ForwardX11 yes
Host *
#   ForwardAgent no
   ForwardX11 yes
   RhostsAuthentication no
   RhostsRSAAuthentication yes
   RSAAuthentication yes
   PasswordAuthentication yes
   FallBackToRsh no
   UseRsh no
#   BatchMode no
   CheckHostIP yes
#   StrictHostKeyChecking yes
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_rsa1
#   IdentityFile ~/.ssh/id_rsa2
   Port 22
   Protocol 2,1
   Cipher blowfish
#   EscapeChar ~
livecd / # vi /etc/ssh/sshd_config
Port 22
Protocol 2,1
#ListenAddress 0.0.0.0
#ListenAddress ::
HostKey /etc/ssh/ssh_host_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
ServerKeyBits 768
LoginGraceTime 600
KeyRegenerationInterval 3600
PermitRootLogin yes
IgnoreRhosts yes
#IgnoreUserKnownHosts yes
StrictModes yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog no
KeepAlive yes
SyslogFacility AUTH
LogLevel INFO
#RhostsAuthentication no
RhostsRSAAuthentication no
HostbasedAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
PermitEmptyPasswords no
#ChallengeResponseAuthentication no
#PAMAuthenticationViaKbdInt yes
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#AFSTokenPassing no
#KerberosTicketCleanup no
#KerberosTgtPassing yes
#CheckMail yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
#ReverseMappingCheck yes
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
livecd / # /etc/init.d/sshd restart
<λ„€νŠΈμ›Œν¬ 초기 μ„€μ •>
livecd / # net-setup eth0
2  My network is wired  ==> 선택
1  Use DHCP to auto-detect my network settings  ==> 선택
livecd / # /etc/init.d/net.eth0 restart
livecd / # ifconfig eth0
eth0      Link encap:Ethernet  HWaddr xxxxxxxxxxxxxx
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: xxxxxxxxxxxxxxx/64 Scope:Link
<μˆ˜λ™ 작기 >
=======================================================
livecd ~ # ifconfig eth0 192.168.0.3/24
livecd ~ # route add default gw 192.168.1.1
========================================================
<νŒŒν‹°μ…˜ μƒˆλ‘œ 생성 >
livecd ~ # cfdisk /dev/hda
       Name                    Flags                 Part Type            FS Type                         [Label]                      Size (MB)
---------------------------------------------------------------------------------------------------------------------------------------------------------
       hda1                                           Primary             Linux ext3                                                      106.93
       hda2                                           Primary             Linux swap / Solaris                                      921.24
       hda3                                           Primary             Linux ext3                                                    13259.16
       hda4                                           Primary             Linux ext3                                                    15726.74
livecd ~ # mkfs.ext3 /dev/hda1 ; mkswap /dev/hda2 ; mkfs.ext3 /dev/hda3 ; mkfs.ext3 /dev/hda4 ; swapon /dev/hda2
<μž‘μ—… λ§ˆμš΄ν‹΄ μ„€μ •>
livecd ~ # mkdir -m755 /mnt/gentoo/
livecd ~ # mount /dev/hda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot/
livecd ~ # mkdir /mnt/gentoo/chroot
livecd ~ # mkdir /mnt/gentoo/proc/
livecd ~ # mount /dev/hda1 /mnt/gentoo/boot/
livecd ~ # mount /dev/hda4 /mnt/gentoo/chroot/
livecd ~ # mount -t proc proc /mnt/gentoo/proc
livecd ~ # cd /mnt/gentoo
<μ†ŒμŠ€ λ‹€μš΄λ‘œλ“œ>
livecd gentoo # wget
ftp://gentoo.osuosl.org/pub/gentoo/releases/x86/2008.0/stages/stage3-i686-2008.0.tar.bz2
livecd gentoo # tar xvfj stage3-i686-2008.0.tar.bz2
livecd gentoo # mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
livecd gentoo # cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
<가상 루트 μ‹œμŠ€ν…œ μ‹€ν–‰>
livecd gentoo # chroot /mnt/gentoo /bin/bash
livecd / # env-update
livecd / # source /etc/profile
livecd / # emerge sync
livecd / # cat /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="-O2 -march=i686 -pipe"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult
http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="i686-pc-linux-gnu"
=====================================================================================
livecd / # cd /usr/portage
<본격적인 μ‹œμŠ€ν…œ μ„€μΉ˜μ™€ μ„€μ •>
livecd portage # scripts/bootstrap.sh ; source /etc/profile ; emerge system
livecd portage # ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
livecd portage # emerge vim  ;  emerge mc
livecd portage # vi /etc/fstab
====================================================================================
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>
/dev/hda1       /boot           ext3            noatime         1 1
/dev/hda2       none            swap            sw              0 0
/dev/hda3       /               ext3            noatime         0 0
/dev/hda4       /chroot         ext3            noatime         0 0
/dev/cdrom      /mnt/cdrom      auto    noauto,ro       0 0
/dev/cdrom2     /mnt/cdrom2     auto    noauto,ro       0 0
none            /proc           proc            defaults                0 0
none            /dev/shm        tmpfs           defaults                0 0
=====================================================================================
<컀널 μ„€μΉ˜μ™€ λ””λ°”μ΄μŠ€ μ˜΅μ…˜ μ„€μ •>
livecd portage # emerge -k sys-kernel/gentoo-sources
livecd portage # emerge -k module-init-tools
livecd portage # emerge -k genkernel
livecd portage # cd /usr/src/linux
livecd src # make menuconfig
livecd linux # genkernel all
livecd boot # cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-2.6.27
livecd boot # emerge -k sysklogd
livecd boot # rc-update add sysklogd  default
livecd boot # emerge -k vixie-cron
livecd boot # rc-update add vixie-cron  default
<루트 νŒ¨μŠ€μ›Œλ“œ 섀정및 호슀트 μ„€μ •>
livecd boot # passwd
New UNIX password: xxxxxxxxxxxxxxxxx
Retype new UNIX password: xxxxxxxxxxxxxxxxx
passwd: password updated successfully
livecd boot # adduser sunny -d /home/sunny -G users -s /bin/bash
livecd boot # passwd sunny
livecd boot # echo linuxsunny > /etc/hostname
livecd boot # echo linuxsunny.pe.kr > /etc/dnsdomainname
<λΆ€νŠΈ λ‘œλ” μ„€μΉ˜μ™€ μ„€μ •>
livecd / # emerge grub
livecd boot # vi grub/grub.conf
====================================================================
default 0
timeout 20
title Gentoo
root (hd0,0)/boot/grub/splash.xpm.gz
kernel /boot/kernel-genkernel-x86-2.6.27-gentoo-r7 root=/dev/hda3
initrd /boot/initramfs-genkernel-x86-2.6.27-gentoo-r7
=====================================================================
livecd / # grub
grub> root (hd0,0)
grub> setup (hd0)
<μ΅œμ’… 마무리 ν•˜κ³  λ¦¬λ¬΄νŒ…>
livecd / # etc-update
livecd / # exit
livecd gentoo # cd ..
livecd mnt # umount /mnt/gentoo/boot
livecd mnt # umount /mnt/gentoo/proc
livecd mnt # umount /mnt/gentoo/chroot/
livecd mnt # umount /mnt/gentoo
livecd mnt # reboot
====================  μ„€μΉ˜ μ™„λ£Œ ==============================================