π2017λ
μ΄μ ν¬μ€ν
λͺ¨μ π/πLinux OSπ
Gentoo Linux Server Install λ©λ΄μΌ
πBugsBunnyπ
2011. 5. 14. 15:29
μμ±μ : ννμ© <bunny>
λλ μ£Όλ‘ μμ
μ ν λλ λ‘컬μμ νμ§ μλ μ±κ²©μ΄λ€.
μ£Όλ‘ SSH λ‘ μ격μ νΉν΄μ μμ νκΈ° λλ¬Έμ μΌλ¨ λΌμ΄λΈ μ¨λ μμ€ν μμ
SSH μ€μ μ ν΄ μ£Όκ³ μ€μΉ μμ μ ν΄μΌ νλ€.
λΌμ΄λΈ μμ€ν μμ μλ SSH μ€μ νμΌμ΄ μ½κ° 보μμ΄ λ무 κ°νμμΌμ μ μνλλ°
λ¬Έμ κ° μκΈ° λλ¬Έμ μ΄λΆλΆμ λ€μκ³Ό κ°μ΄ μ€ν μ€μ νμΌλ‘ λ³κ²½νκ³ μλ² λ°λͺ¬μ μ¬ μμ νλ€.
< OPENSSH μ€μ >
livecd / # vi /etc/ssh/ssh_config
<λ€νΈμν¬ μ΄κΈ° μ€μ >
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
==================== μ€μΉ μλ£ ==============================================
μ£Όλ‘ 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_configForwardAgent 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 ~
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 restartProtocol 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 / # 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
==================== μ€μΉ μλ£ ==============================================