블로그 이미지
22Hz 22Hz

카테고리

분류 전체보기 (109)
모의해킹 침해대응 전문가 과정 (99)
리눅스 설정 (10)
Total
Today
Yesterday

달력

« » 2025.7
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

공지사항

태그목록

최근에 올라온 글

===========================================메모===========================================

반장 바뀜, 카페 안하기로 함
유연하게 즐기면서 할 것

vimrc 설정 해놨음

정보보안기사 주말에 특강식으로 1-2주정도

===========================================복습===========================================

7. Software Admin
 rpm CMD
  (rpm 패키지 다운로드 사이트)
  http://rpmfind.net
  http://rpm.pbone.net
  ftp://ftp.daum.net
  (rpm 설치)
  # rpm -(ivh|Fvh|Uvh) [--nodeps] pkg.rpm
  (rpm 정보 확인)
  # rpm -qa | grep pkg (# rpm -q pkg)
  # rpm -qi pkg
  # rpm -qf /etc/passwd
  # rpm -ql pkg
  (rpm 삭제)
  # rpm -e [--nodeps] pkg
 yum CMD
  (yum 패키지 설치)
  # yum [-y] (install|update) pkg
  # yum -y update
  (yum 패키지 확인)
  # yum list [installed|available]
  # yum search pkg
  # yum info pkg
  (yum 패키지 삭제)
  # yum (remove|erase) pkg

===========================================강의===========================================

 Source 관리
  소스 다운로드(EX : PKG.tar.gz)
  # tar xvzf PKG.tar.gz
  # cd PKG
  # ./configure --prefix=/usr/local/apache2
  # make
  # make install

8. 부팅과정
 (ㄱ) F/W 단계     
  - POST(Power On Self-Test)
  - 부팅 순서
 (ㄴ) Boot Loader 단계(Grub 단계)
  - /boot/grub/grub.conf(/etc/grub.conf, /boot/grub/menu.lst)
  - Kernel 실행, Initial RAM DISK
 (ㄷ) Kernel 단계
  - /boot/vmlinuz-2.6.18-164.el5
  - /etc/sysctl.conf
  - Kernel Modules(EX: Device Driver)
    (lsmod, instmod, rmmod, modprobe)
 (ㄹ) Init 단계
  - /sbin/init(/etc/inittab)
  - (a) initdefault(5) : 기본 런레벨 결정
  - (b) /etc/rc.d/rc.sysinit 실행
  - (c) /etc/rc5.d/S##script 실행

             (부팅)                      (현재)                     (현재)
             /etc/rc5.d <---심볼릭---> /etc/init.d <---심볼릭---> /etc/rc.d/init.d
             S##script                   script                     script

  (서비스 ON/OFF)
  # chkconfig sshd on
  # service sshd restart
  [참고] ntsysv(setup), system-config-services(serviceconf), chkconfig

===========================================실습===========================================

[EX5] 운영체제 전체 업데이트

[root@linux220 ~]# uname -a
Linux linux220.example.com 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 athlon i386 GNU/Linux
[root@linux220 ~]# cat /etc/redhat-release
CentOS release 5.5 (Final)
[root@linux220 ~]# yum check-update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: ftp.daumkakao.com
 * base: ftp.daumkakao.com
 * extras: ftp.daumkakao.com
 * updates: ftp.daumkakao.com
addons                                                                                                | 1.9 kB     00:00    
base                                                                                                  | 1.1 kB     00:00    
extras                                                                                                | 2.1 kB     00:00    
updates                                                                                               | 1.9 kB     00:00    

Deployment_Guide-ko-KR.noarch                                   5.8-1.el5.centos                                    base    
ImageMagick.i386                                                6.2.8.0-15.el5_8                                    base    
NetworkManager.i386                                             1:0.7.0-13.el5                                      base    
NetworkManager-glib.i386                                        1:0.7.0-13.el5                                      base    
NetworkManager-gnome.i386                                       1:0.7.0-13.el5                                      base    
PyXML.i386                                                      0.8.4-6.el5                                         base    
SDL.i386                                                        1.2.10-9.el5                                        base    
SysVinit.i386                                                   2.86-17.el5                                         base    
acl.i386                                                        2.2.39-8.el5                                        base    
acpid.i386                                                      1.0.4-12.el5                                        base    
alsa-utils.i386                                                 1.0.17-7.el5                                        base    
amtu.i386                                                       1.0.6-2.el5                                         base    
apr.i386                                                        1.2.7-11.el5_6.5                                    base    
apr-util.i386                                                   1.2.7-11.el5_5.2                                    base    
aspell.i386                                                     12:0.60.3-13                                        base    
aspell-en.i386                                                  50:6.0-3                                            base    
at.i386                                                         3.1.8-84.el5_11.1                                   updates 
audit.i386                                                      1.8-2.el5                                           base    
audit-libs.i386                                                 1.8-2.el5                                           base    
audit-libs-python.i386                                          1.8-2.el5                                           base    
authconfig.i386                                                 5.3.21-7.el5                                        base    
authconfig-gtk.i386                                             5.3.21-7.el5                                        base    
autofs.i386                                                     1:5.0.1-0.rc2.184.el5                               base    
avahi.i386                                                      0.6.16-10.el5_6                                     base    
avahi-compat-libdns_sd.i386                                     0.6.16-10.el5_6                                     base    
avahi-glib.i386                                                 0.6.16-10.el5_6                                     base    
bash.i386                                                       3.2-33.el5_11.4                                     updates 
bind.i386                                                       30:9.3.6-25.P1.el5_11.8                             updates 
bind-chroot.i386                                                30:9.3.6-25.P1.el5_11.8                             updates 
bind-libs.i386                                                  30:9.3.6-25.P1.el5_11.8                             updates 
bind-utils.i386                                                 30:9.3.6-25.P1.el5_11.8                             updates 
binutils.i386                                                   2.17.50.0.6-26.el5                                  base    
busybox.i386                                                    1:1.2.0-14.el5.centos                               base    
bzip2.i386                                                      1.0.3-6.el5_5                                       base    
bzip2-libs.i386                                                 1.0.3-6.el5_5                                       base    
ccid.i386                                                       1.3.8-2.el5                                         base    
cdparanoia.i386                                                 alpha9.8-28                                         base    
cdparanoia-libs.i386                                            alpha9.8-28                                         base    
centos-release.i386                                             10:5-11.el5.centos                                  base    
centos-release-notes.i386                                       5.11-0                                              base    
comps-extras.noarch                                             11.4-1.el5.centos                                   base    
coolkey.i386                                                    1.1.0-17.el5                                        base    
coreutils.i386                                                  5.97-34.el5_8.1                                     base    
cpio.i386                                                       2.6-26.el5                                          base    
cpuspeed.i386                                                   1:1.2.1-11.el5_10                                   base    
crash.i386                                                      5.1.8-3.el5.centos                                  updates 
crontabs.noarch                                                 1.10-11.el5                                         base    
cryptsetup-luks.i386                                            1.0.3-8.el5                                         base    
cups.i386                                                       1:1.3.7-32.el5_11                                   updates 
cups-libs.i386                                                  1:1.3.7-32.el5_11                                   updates 
curl.i386                                                       7.15.5-17.el5_9                                     base    
cyrus-sasl.i386                                                 2.1.22-7.el5_8.1                                    base    
cyrus-sasl-lib.i386                                             2.1.22-7.el5_8.1                                    base    
cyrus-sasl-md5.i386                                             2.1.22-7.el5_8.1                                    base    
cyrus-sasl-plain.i386                                           2.1.22-7.el5_8.1                                    base    
db4.i386                                                        4.3.29-10.el5_5.2                                   base    
dbus.i386                                                       1.1.2-21.el5                                        base    
dbus-glib.i386                                                  0.73-11.el5_9                                       base    
dbus-libs.i386                                                  1.1.2-21.el5                                        base    
dbus-x11.i386                                                   1.1.2-21.el5                                        base    
device-mapper.i386                                              1.02.67-2.el5_11.1                                  updates 
device-mapper-event.i386                                        1.02.67-2.el5_11.1                                  updates 
device-mapper-multipath.i386                                    0.4.7-64.el5_11                                     updates 
dhclient.i386                                                   12:3.0.5-33.el5_9                                   base    
dhcpv6-client.i386                                              1.0.10-22.el5_11                                    updates 
diffutils.i386                                                  2.8.1-16.el5                                        base    
dmidecode.i386                                                  1:2.12-1.el5                                        base    
dmraid.i386                                                     1.0.0.rc13-65.el5                                   base    
dmraid-events.i386                                              1.0.0.rc13-65.el5                                   base    
dovecot.i386                                                    1.0.7-9.el5_11.4                                    updates 
dump.i386                                                       0.4b41-6.el5                                        base    
e2fsprogs.i386                                                  1.39-37.el5                                         base    
e2fsprogs-libs.i386                                             1.39-37.el5                                         base    
ecryptfs-utils.i386                                             75-8.el5                                            base    
elinks.i386                                                     0.11.1-8.el5_9                                      base    
esc.i386                                                        1.1.0-14.el5.centos.1                               base    
esound.i386                                                     1:0.2.36-4                                          base    
evince.i386                                                     0.6.0-17.el5                                        base    
expat.i386                                                      1.95.8-11.el5_8                                     base    
fetchmail.i386                                                  6.3.6-4.el5                                         base    
file.i386                                                       4.17-28                                             base    
filesystem.i386                                                 2.4.0-3.el5.centos                                  base    
finger.i386                                                     0.17-33                                             base    
firefox.i386                                                    38.7.0-1.el5.centos                                 updates 
firstboot.i386                                                  1.4.27.9-1.el5.centos                               base    
firstboot-tui.i386                                              1.4.27.9-1.el5.centos                               base    
foomatic.i386                                                   3.0.2-38.3.el5_7.1                                  base    
freetype.i386                                                   2.2.1-32.el5_9.1                                    base    
ftp.i386                                                        0.17-38.el5                                         base    
gamin.i386                                                      0.1.7-10.el5                                        base    
gamin-python.i386                                               0.1.7-10.el5                                        base    
gawk.i386                                                       3.1.5-16.el5                                        base    
gdbm.i386                                                       1.8.0-28.el5                                        base    
gdm.i386                                                        1:2.16.0-59.el5.centos.1                            base    
gettext.i386                                                    0.17-1.el5                                          base    
ghostscript.i386                                                8.70-15.el5_9.3                                     base    
giflib.i386                                                     4.1.3-7.3.3.el5                                     base    
gimp.i386                                                       2:2.2.13-3.el5_10                                   base    
gimp-libs.i386                                                  2:2.2.13-3.el5_10                                   base    
glx-utils.i386                                                  6.5.1-7.11.el5_9                                    base    
gnome-python2-extras.i386                                       2.14.2-7.el5                                        base    
gnome-python2-gtkhtml2.i386                                     2.14.2-7.el5                                        base    
gnome-python2-libegg.i386                                       2.14.2-7.el5                                        base    
gnome-screensaver.i386                                          2.16.1-8.el5_7.5                                    base    
gnome-session.i386                                              2.16.0-10.el5                                       base    
gnome-system-monitor.i386                                       2.16.0-4.el5                                        base    
gnome-terminal.i386                                             2.16.0-5.3.el5_6.1                                  base    
gnome-vfs2.i386                                                 2.16.2-12.el5_9                                     base    
gnome-vfs2-smb.i386                                             2.16.2-12.el5_9                                     base    
gnupg.i386                                                      1.4.5-18.el5_10.1                                   base    
gnutls.i386                                                     1.4.1-16.el5_10                                     base    
groff.i386                                                      1.18.1.1-13.el5                                     base    
grub.i386                                                       0.97-13.11.el5_10.1                                 base    
gtk2.i386                                                       2.10.4-30.el5                                       base    
gzip.i386                                                       1.3.5-13.el5.centos                                 base    
hmaccalc.i386                                                   0.9.6-4.el5                                         base    
hpijs.i386                                                      1:1.6.7-6.el5_6.1                                   base    
hplip.i386                                                      1.6.7-6.el5_6.1                                     base    
hsqldb.i386                                                     1:1.8.0.9-1jpp.3                                    base    
httpd.i386                                                      2.2.3-91.el5.centos                                 base    
httpd-manual.i386                                               2.2.3-91.el5.centos                                 base    
hwdata.noarch                                                   0.213.30-1.el5                                      base    
ifd-egate.i386                                                  0.05-17.el5                                         base    
initscripts.i386                                                8.45.45-1.el5.centos                                base    
iproute.i386                                                    2.6.18-15.el5                                       base    
ipsec-tools.i386                                                0.6.5-14.el5_8.5                                    base    
iptables.i386                                                   1.3.5-9.2.el5_8                                     base    
iptables-ipv6.i386                                              1.3.5-9.2.el5_8                                     base    
irqbalance.i386                                                 2:0.55-16.el5_11                                    updates 
jpackage-utils.noarch                                           1.7.3-1jpp.3.el5                                    base    
jwhois.i386                                                     3.2.3-12.el5                                        base    
kbd.i386                                                        1.12-22.el5                                         base    
kernel.i686                                                     2.6.18-409.el5                                      updates 
kexec-tools.i386                                                1.102pre-165.el5                                    base    
kpartx.i386                                                     0.4.7-64.el5_11                                     updates 
krb5-libs.i386                                                  1.6.1-80.el5_11                                     updates 
krb5-workstation.i386                                           1.6.1-80.el5_11                                     updates 
ksh.i386                                                        20100621-24.el5_11                                  updates 
kudzu.i386                                                      1.2.57.1.26-7.el5.centos                            base    
less.i386                                                       436-9.el5                                           base    
lftp.i386                                                       3.7.11-8.el5                                        base    
libX11.i386                                                     1.0.3-11.el5_7.1                                    base    
libXcursor.i386                                                 1.1.7-1.2                                           base    
libXfont.i386                                                   1.2.2-1.0.6.el5_11                                  updates 
libacl.i386                                                     2.2.39-8.el5                                        base    
libbonobo.i386                                                  2.16.0-1.1.el5_5.1                                  base    
libexif.i386                                                    0.6.21-1.el5_8                                      base    
libgcj.i386                                                     4.1.2-55.el5                                        base    
libgcrypt.i386                                                  1.4.4-7.el5_10                                      base    
libhugetlbfs.i386                                               1.3-8.2.el5                                         base    
libicu.i386                                                     3.6-5.16.1                                          base    
libjpeg.i386                                                    6b-38                                               base    
libpng.i386                                                     2:1.2.10-17.el5_8                                   base    
libpurple.i386                                                  2.6.6-32.el5                                        base    
libsane-hpaio.i386                                              1.6.7-6.el5_6.1                                     base    
libsmbclient.i386                                               3.0.33-3.41.el5_11                                  updates 
libstdc++.i386                                                  4.1.2-55.el5                                        base    
libsysfs.i386                                                   2.1.0-1.el5                                         base    
libtiff.i386                                                    3.8.2-19.el5_10                                     base    
libusb.i386                                                     0.1.12-6.el5                                        base    
libuser.i386                                                    0.54.7-3.el5                                        base    
libvolume_id.i386                                               095-14.33.el5_11                                    updates 
libvorbis.i386                                                  1:1.1.2-3.el5_7.6                                   base    
libwpd.i386                                                     0.8.7-3.1.el5_8                                     base    
libxml2.i386                                                    2.6.26-2.1.25.el5_11                                updates 
libxml2-python.i386                                             2.6.26-2.1.25.el5_11                                updates 
libxslt.i386                                                    1.1.17-4.el5_8.3                                    base    
libxslt-python.i386                                             1.1.17-4.el5_8.3                                    base    
linuxwacom.i386                                                 0.7.8.3-11.2.el5_8                                  base    
logrotate.i386                                                  3.7.4-14                                            base    
logwatch.noarch                                                 7.3-10.el5                                          base    
lsof.i386                                                       4.78-6                                              base    
lvm2.i386                                                       2.02.88-13.el5                                      base    
m2crypto.i386                                                   0.16-9.el5                                          base    
man.i386                                                        1.6d-3.el5                                          base    
man-pages.noarch                                                2.39-20.el5                                         base    
mdadm.i386                                                      2.6.9-5.el5                                         base    
mesa-libGL.i386                                                 6.5.1-7.11.el5_9                                    base    
mesa-libGLU.i386                                                6.5.1-7.11.el5_9                                    base    
metacity.i386                                                   2.16.0-16.el5                                       base    
microcode_ctl.i386                                              2:1.17-7.el5                                        base    
mkinitrd.i386                                                   5.1.19.6-82.el5                                     base    
mktemp.i386                                                     3:1.5-24.el5                                        base    
mod_python.i386                                                 3.2.8-4.el5                                         base    
mod_ssl.i386                                                    1:2.2.3-91.el5.centos                               base    
module-init-tools.i386                                          3.3-0.pre3.1.63.el5                                 base    
mutt.i386                                                       5:1.4.2.2-6.el5                                     base    
mysql.i386                                                      5.0.95-5.el5_9                                      base    
nash.i386                                                       5.1.19.6-82.el5                                     base    
nautilus.i386                                                   2.16.2-10.el5                                       base    
nautilus-extensions.i386                                        2.16.2-10.el5                                       base    
net-snmp-libs.i386                                              1:5.3.2.2-25.el5_11                                 updates 
net-tools.i386                                                  1.60-83.el5_10                                      base    
netpbm.i386                                                     10.35.58-10.el5                                     base    
netpbm-progs.i386                                               10.35.58-10.el5                                     base    
nfs-utils.i386                                                  1:1.0.9-71.el5_11                                   updates 
nfs-utils-lib.i386                                              1.0.8-7.9.el5                                       base    
nspluginwrapper.i386                                            1.3.0-9.el5                                         base    
nspr.i386                                                       4.11.0-1.el5_11                                     updates 
nss.i386                                                        3.21.0-6.el5_11                                     updates 
nss-tools.i386                                                  3.21.0-6.el5_11                                     updates 
nss_db.i386                                                     2.2-38.el5_11                                       updates 
nss_ldap.i386                                                   253-52.el5_11.2                                     updates 
ntp.i386                                                        4.2.2p1-18.el5.centos                               updates 
numactl.i386                                                    0.9.8-12.el5_6                                      base    
oddjob.i386                                                     0.27-12.el5                                         base    
oddjob-libs.i386                                                0.27-12.el5                                         base    
openldap.i386                                                   2.3.43-29.el5_11                                    updates 
openoffice.org-calc.i386                                        1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-core.i386                                        1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-draw.i386                                        1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-graphicfilter.i386                               1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-impress.i386                                     1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-langpack-ko_KR.i386                              1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-math.i386                                        1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-ure.i386                                         1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-writer.i386                                      1:3.1.1-19.10.el5_8.4                               base    
openoffice.org-xsltfilter.i386                                  1:3.1.1-19.10.el5_8.4                               base    
openssh.i386                                                    4.3p2-82.el5                                        base    
openssh-askpass.i386                                            4.3p2-82.el5                                        base    
openssh-clients.i386                                            4.3p2-82.el5                                        base    
openssh-server.i386                                             4.3p2-82.el5                                        base    
openssl.i686                                                    0.9.8e-39.el5_11                                    updates 
pam.i386                                                        0.99.6.2-14.el5_11                                  updates 
pam_krb5.i386                                                   2.2.14-22.el5                                       base    
pam_pkcs11.i386                                                 0.5.3-26.el5                                        base    
pango.i386                                                      1.14.9-8.el5.centos.3                               base    
paps.i386                                                       0.6.6-20.el5                                        base    
parted.i386                                                     1.8.1-30.el5                                        base    
passwd.i386                                                     0.73-2                                              base    
patch.i386                                                      2.5.4-31.el5                                        base    
pciutils.i386                                                   3.1.7-5.el5                                         base    
pcre.i386                                                       6.6-9.el5                                           base    
pcsc-lite.i386                                                  1.4.4-4.el5_5                                       base    
pcsc-lite-libs.i386                                             1.4.4-4.el5_5                                       base    
perl.i386                                                       4:5.8.8-43.el5_11                                   updates 
perl-Archive-Tar.noarch                                         1:1.39.1-1.el5_5.2                                  base    
perl-IO-Socket-SSL.noarch                                       1.01-2.el5                                          base    
pirut.noarch                                                    1.3.28-20.el5.centos                                base    
pm-utils.i386                                                   0.99.3-14.el5                                       base    
policycoreutils.i386                                            1.33.12-14.13.el5                                   base    
poppler.i386                                                    0.5.4-19.el5_9.2                                    base    
poppler-utils.i386                                              0.5.4-19.el5_9.2                                    base    
popt.i386                                                       1.10.2.3-36.el5_11                                  updates 
postgresql-libs.i386                                            8.1.23-10.el5_10                                    base    
procmail.i386                                                   3.22-17.1.2.el5_10                                  updates 
procps.i386                                                     3.2.7-26.el5                                        base    
psmisc.i386                                                     22.2-11                                             base    
python.i386                                                     2.4.3-56.el5                                        base    
python-iniparse.noarch                                          0.2.3-6.el5                                         base    
python-numeric.i386                                             23.7-2.2.2.el5_6.1                                  base    
python-urlgrabber.noarch                                        3.1.0-6.el5                                         base    
pyxf86config.i386                                               0.3.31-3.el5                                        base    
qt.i386                                                         1:3.3.6-26.el5                                      base    
quota.i386                                                      1:3.13-8.el5                                        base    
redhat-lsb.i386                                                 4.0-2.1.4.el5                                       base    
rhpl.i386                                                       0.194.1-2                                           base    
rhpxl.i386                                                      0.41.1-12.el5                                       base    
rmt.i386                                                        0.4b41-6.el5                                        base    
rng-utils.i386                                                  1:2.0-5.el5                                         base    
rp-pppoe.i386                                                   3.5-33.el5                                          base    
rpm.i386                                                        4.4.2.3-36.el5_11                                   updates 
rpm-libs.i386                                                   4.4.2.3-36.el5_11                                   updates 
rpm-python.i386                                                 4.4.2.3-36.el5_11                                   updates 
rsh.i386                                                        0.17-40.el5_7.1                                     base    
rsync.i386                                                      3.0.6-6.el5_11                                      updates 
sabayon.i386                                                    2.12.4-9.el5                                        base    
sabayon-apply.i386                                              2.12.4-9.el5                                        base    
samba.i386                                                      3.0.33-3.41.el5_11                                  updates 
samba-client.i386                                               3.0.33-3.41.el5_11                                  updates 
samba-common.i386                                               3.0.33-3.41.el5_11                                  updates 
scim.i386                                                       1.4.4-44.el5                                        base    
scim-bridge.i386                                                0.4.5-11.el5                                        base    
scim-bridge-gtk.i386                                            0.4.5-11.el5                                        base    
scim-libs.i386                                                  1.4.4-44.el5                                        base    
sed.i386                                                        4.1.5-8.el5                                         base    
selinux-policy.noarch                                           2.4.6-351.el5                                       base    
selinux-policy-targeted.noarch                                  2.4.6-351.el5                                       base    
sendmail.i386                                                   8.13.8-10.el5_11                                    updates 
sendmail-cf.i386                                                8.13.8-10.el5_11                                    updates 
setroubleshoot.noarch                                           2.0.5-7.el5_11                                      updates 
setroubleshoot-server.noarch                                    2.0.5-7.el5_11                                      updates 
setup.noarch                                                    2.5.58-9.el5                                        base    
shadow-utils.i386                                               2:4.0.17-23.el5                                     base    
smartmontools.i386                                              1:5.42-2.el5                                        base    
sos.noarch                                                      1.7-9.73.el5.centos                                 base    
sox.i386                                                        12.18.1-1.el5_5.1                                   base    
spamassassin.i386                                               3.3.1-4.el5                                         base    
specspo.noarch                                                  13-4.el5.centos                                     base    
sqlite.i386                                                     3.3.6-7                                             base    
squid.i386                                                      7:2.6.STABLE21-7.el5_10                             updates 
stunnel.i386                                                    4.15-2.el5.2                                        updates 
sudo.i386                                                       1.7.2p1-29.el5_10                                   base    
symlinks.i386                                                   1.2-26.el5                                          base    
sysfsutils.i386                                                 2.1.0-1.el5                                         base    
syslinux.i386                                                   4.02-7.2.el5                                        base    
system-config-date.noarch                                       1.8.12-5.el5.centos                                 base    
system-config-display.noarch                                    1.0.48-4.el5                                        base    
system-config-kdump.noarch                                      1.0.14-5.el5_9                                      base    
system-config-lvm.noarch                                        1.1.5-14.el5                                        base    
system-config-network.noarch                                    1.3.99.23-1.el5                                     base    
system-config-network-tui.noarch                                1.3.99.23-1.el5                                     base    
system-config-nfs.noarch                                        1.3.23-2.el5                                        base    
system-config-printer.i386                                      0.7.32.10-3.el5                                     base    
system-config-printer-libs.i386                                 0.7.32.10-3.el5                                     base    
system-config-securitylevel.i386                                1.6.29.1-6.el5                                      base    
system-config-securitylevel-tui.i386                            1.6.29.1-6.el5                                      base    
system-config-users.noarch                                      1.2.51-7.el5                                        base    
talk.i386                                                       0.17-31.el5                                         base    
tar.i386                                                        2:1.15.1-32.el5_8                                   base    
tcl.i386                                                        8.4.13-6.el5                                        base    
tcsh.i386                                                       6.14-17.el5_5.2                                     base    
telnet.i386                                                     1:0.17-41.el5                                       base    
tmpwatch.i386                                                   2.9.7-1.1.el5.5                                     base    
totem.i386                                                      2.16.7-7.el5_6.1                                    base    
traceroute.i386                                                 3:2.0.1-6.el5                                       base    
tzdata.i386                                                     2016d-1.el5                                         updates 
udev.i386                                                       095-14.33.el5_11                                    updates 
util-linux.i386                                                 2.13-0.59.el5_8                                     base    
vim-common.i386                                                 2:7.0.109-7.2.el5                                   base    
vim-enhanced.i386                                               2:7.0.109-7.2.el5                                   base    
vim-minimal.i386                                                2:7.0.109-7.2.el5                                   base    
vino.i386                                                       2.13.5-10.el5_10                                    base    
vixie-cron.i386                                                 4:4.1-81.el5                                        base    
vnc-server.i386                                                 4.1.2-14.el5_6.6                                    base    
vsftpd.i386                                                     2.0.5-28.el5                                        base    
wdaemon.i386                                                    0.14-8                                              base    
wget.i386                                                       1.11.4-3.el5_8.2                                    base    
wpa_supplicant.i386                                             1:0.5.10-10.el5                                     base    
xalan-j2.i386                                                   2.7.0-6jpp.2                                        base    
xinetd.i386                                                     2:2.3.14-20.el5_10                                  base    
xkeyboard-config.noarch                                         0.8-10.el5                                          base    
xorg-x11-drv-ati.i386                                           6.6.3-3.35.el5                                      base    
xorg-x11-drv-i810.i386                                          1.6.5-9.40.el5                                      base    
xorg-x11-drv-mga.i386                                           1.4.13-5.el5                                        base    
xorg-x11-drv-nv.i386                                            2.1.15-4.el5                                        base    
xorg-x11-drv-qxl.i386                                           0.0.12-2.el5                                        base    
xorg-x11-drv-sis.i386                                           0.9.1-7.3.el5_7.1                                   base    
xorg-x11-drv-vesa.i386                                          1.3.0-8.3.el5                                       base    
xorg-x11-font-utils.i386                                        1:7.1-3                                             base    
xorg-x11-server-Xnest.i386                                      1.1.1-48.107.el5.centos                             updates 
xorg-x11-server-Xorg.i386                                       1.1.1-48.107.el5.centos                             updates 
xorg-x11-server-utils.i386                                      7.1-5.el5_6.2                                       base    
xorg-x11-xfs.i386                                               1:1.0.2-5.el5_6.1                                   base    
xulrunner.i386                                                  17.0.10-1.el5_10                                    base    
yelp.i386                                                       2.16.0-30.el5_9                                     base    
yp-tools.i386                                                   2.9-2.el5                                           base    
ypbind.i386                                                     3:1.19-12.el5_6.1                                   base    
yum.noarch                                                      3.2.22-40.el5.centos                                base    
yum-fastestmirror.noarch                                        1.1.16-21.el5.centos                                base    
yum-metadata-parser.i386                                        1.1.2-4.el5                                         base    
yum-updatesd.noarch                                             1:0.9-6.el5_10                                      base    
zlib.i386                                                       1.2.3-7.el5                                         base    
Obsoleting Packages
firefox.i386                                                    38.7.0-1.el5.centos                                 updates 
    firefox.i386                                                3.0.18-1.el5.centos                                 installed


[root@linux220 ~]# yum check-update | grep kernel
kernel.i686                              2.6.18-409.el5                updates 

[root@linux220 ~]# yum -y update




[root@linux220 ~]# chkconfig --list | grep update
yum-updatesd    0:해제  1:해제  2:해제  3:해제  4:해제  5:해제  6:해제
[root@linux220 ~]# chkconfig yum-updatesd off
[root@linux220 ~]# chkconfig --list | grep update
yum-updatesd    0:해제  1:해제  2:해제  3:해제  4:해제  5:해제  6:해제






[EX1] Apache 2.X 소스 컴파일(Source Comile)

다음은 Apache 2.X 소스를 다운로드 하여 설치하는 예이다.

■ Apache 소스 프로그램 설치 과정

(ㄱ) 소스 파일 다운로드
(ㄴ) 압축 해제
(ㄷ) configure && make && make install
(ㄹ) 웹서비스 시작 및 확인

httpd-2.2.14.tar.gz ----> /test/httpd-2.2.14.tar.gz ----> /usr/local/src/httpd-2.2.14
                                                                   |
                                                                   |
                                                                   V
                                                     httpd   <---- /usr/local/apache2


l 프로그램 다운로드 디렉토리 : /test
l 프로그램 소스 디렉토리  : /usr/local/src
l 프로그램 설치 디렉토리  : /usr/local/apache2

① Apache 2.X 소스 파일 다운로드
"http://httpd.apache.org/download.cgi#apache22" 사이트에서 최신 버전의 프로그램을 확인하고 URL을 복사한다.

http://mirror.apache-kr.org//httpd/httpd-2.2.31.tar.gz

# cd /test
# wget http://mirror.apache-kr.org//httpd/httpd-2.2.31.tar.gz

-> 만약 버전이 없어서 에러가 생기는 경우에는 apache 사이트에 직접 들어가서 최신 버전의 URL를 다시 복사하여
   사용해야 한다.

② 컴파일러 설치 확인
소스코드를 컴파일 하기 위해서는 gcc컴파일러나 make 컴파일러가 설치되어 있어야 한다. 컴파일러 설치 여부를 확 인하고 설치 되어 있지 않은 경우 yum을 이용하여 설치한다.

# rpm -q gcc make

(설치되어 있지 않으면 설치)
# yum -y install gcc* make*

③ 아파치 소스코드 압축/아카이빙 해제 및 확인
프로그램  소스  코드는  RPM  소스  패키지  형태로  제공되는  경우도  있으나,  대부분  tar  아카이브  파일로 
배포된다. tar 소스 파일을 구한 앞서 배운대로 tar 명령으로 해당 파일의 압축과 아카이빙을 풀때 사용한다. 소스 의 효울적이고 체계적인 관리를 위해서 tar 파일의 압축을 풀 때 -C 옵션으로 소스가 풀어질 경로를 지정해 놓으면
나중에도 소스를 재 컴파일 해야 한다든지 패치를 적용해야 할 때 소스가 어디에 있는지 우왕좌왕하지 않고 쉽게
찾을 수 있다.

# tar xvzf httpd-2.2.26.tar.gz -C /usr/local/src   /* -C : change directory */

# cd /usr/local/src
# ls -l

④ INSTALL 문서 확인
소스 코드에 어떤 옵션을 부여해서 어떻게 컴파일해야 하는지 컴파일 방법에 대한 자세한 정보가 있는 설치 문서인
README 또는 INSTALL 파일이 소스 파일내에 포함되어 있으므로, 컴파일하기 전에 이러한 문서를 잘 읽어 보고 컴파 일하는 것이 좋다. 소스 코드의 컴파일 순서는 대부분 소스의 경우에는 동일하지만, 약간의 차이가 있는 경우도 있 으므로, 항상 설치 문서를 참고하는 습관을 갖는 것이 현명하다.
# cd httpd-2.2.26
# ls

# cat INSTALL

⑤ 컴파일 환경 설정
대부분의 소스에 있어서 소스 코드의 컴파일 순서는 configure, make, make install로 진행된다. 그 첫 번째 과정 인 configure 작업은 컴파일을 하는데 있어서 컴파일러 존재 여부 확인,  컴파일 환경 옵션 지정,  컴파일에 필요 한 라이브러리 검색 등 컴파일 환경을 준비하는 과정으로, configure 명령에 의해서 Makefile 파일이 준비되는 과
정이다. Makefile 파일은 make 명령으로 컴파일될 때 이용되는 파일로 이 파일이 생성되지 않으면 컴파일될 수 없 으며,컴파일 환경 설정 작업에 잘못 되었거나 수정해야 할 경우 configure 명령을 재실행하지 않고서도 이 파일의
설정값을 에디터로 수정하여 할 수 있다.

소스 컴파일 시 configure  명령에 가장 많이 사용되는 옵션중의 하나가 --prefix= 옵션이다.  이 옵션을 이용하면
소스 컴파일 후 컴파일된 프로그램이 설치될 경로를 지정해 줄 수 있고, 컴파일된 프로그램을 제거할 때 --prefix=
옵션으로 명시한 디렉토리를 통째로 삭제해 줌으로써 쉽게 프로그램을 제거할 수 있는 이점이 있다.

# ./configure --help
-> configure 명령어의 사용법을 확인 한다.

# ./configure --prefix=/usr/local/apache2
-> configure 과정이 잘 수행 되었는지 확인하기 위해서 $? 변수를 사용할 수 있다.
   # ./configure --prefix=/usr/local/apache2
   ......
   # echo $?
   0
-> configure 명령어가 수행이 되면 출력되는 내용을 로그 파일로 저장하기 위해서는 tee 명령어를 사용할수도 있    고 리다이렉션 기호를 사용할 수도 있다.
   # ./configure --prefix=/usr/local/apache2 | tee -a file.log
   # cat file.log
   or
   # ./configure --prefix=/usr/local/apache2 > apache.log 2>&1
   # cat apache.log



⑥ 컴파일(make)
configure로 컴파일 환경을 설정한 후 make 명령으로 소스를 컴파일한다. 다음은 아파치 소스를 make로 컴파일하는
일부 과정이다.
# make


⑦ 컴파일된 프로그램 설치(make install)
make  명령으로 컴파일된 소스 프로그램은 make  install  명령에 의해서 --prefix=  옵션으로 명시된 경로로 설치
된다. 보통 make와 make install 명령을 다음과 같이 한 번에 내릴 수 있다.
# make install


⑧ 웹서비스 테스트
# cd /usr/local/apache2
# ls

/usr/local/apache2 --+--- bin (명령어, 데몬)
                     +--- conf (설정파일)
                     +--- htdocs (소스코드)


# cd bin
# ./apachectl start
# pgrep -lf httpd
-> 떠 있는 데몬 확인

# cat /usr/local/apache2/htdocs/index.html

# firefox &
-> http://localhost  (http://127.0.0.1)
-> 자신의 서버에 웹서비스 요청을 하여 메인 페이지가 보이는지 확인 한다.

⑨ 컴파일한 프로그램 제거하기
# cd /usr/local/apache2/bin
# ./apachectl stop
# pgrep -lf httpd
# cd
# rm -rf /usr/local/apache2


# make clean //메이크 오류가 나서 클린 명령어 쓰고 다시 메이크, 인스톨 했더니 정상적으로 실습됨
# make
# make install



(정리) 패키지 관리

rpm CMD(RedHat Packages Manager)

# rpm -ivh [--nodeps] pkg.rpm
# rpm -Uvh [--nodeps] pkg.rpm
# rpm -Fvh [--nodeps] pkg.rpm

# rpm -qa | grep pkg
# rpm -q pkg

# rpm -qf /etc/passwd
# rpm -ql pkg
# rpm –qi pkg
# rpm –qi -p pkg.rpm

# rpm -e [--nodeps] pkg

yum CMD(Yellowdog Update Manager)

# yum install pkg  (# yum -y install pkg)
# yum update pkg
# yum -y update

# yum list (# yum list installed)
# yum search pkg

# yum info pkg

# yum remove pkg   (# yum erase pkg)

[참고] kernel upgrade

# rpm –ivh kernel.rpm
# yum install kernel.rpm

Source Compile(EX: pkg.tar.gz)

# tar xvzf pkg.tar.gz
# cd pkg
# ./configure --prefix=/usr/local/pkg  (# ./configure --help)
# make
# make install

[참고]
APM(Apache + PHP + MySQL) 설치
ATJO(Apache + Tomcat + JAVA(JDK/SDK) + Oracle) 설치




Create an RPM

rpm 패키지 생성 절차
(ㄱ) 소스 프로그램 개발
(ㄴ) 소스.tar.gz 파일 생성
(ㄷ) SPEC 파일 생성
(ㄹ) rpm build
(ㅁ) GPG Key 생성
(ㅂ) 패키지 sign
(ㅅ) Yum Repository 구성
(ㅇ) 테스트


업데이트 버전 확인
[root@linux220 ~]# cat /etc/redhat-release
CentOS release 5.11 (Final)
[root@linux220 ~]# uname -a
Linux linux220.example.com 2.6.18-409.el5 #1 SMP Tue Mar 15 18:22:22 EDT 2016 i686 athlon i386 GNU/Linux


[root@linux220 ~]# cd /test
[root@linux220 /test]# rm -rf /test/*
[root@linux220 /test]# mkdir hello-1.0
[root@linux220 /test]# ls
hello-1.0
[root@linux220 /test]# vi hello-1.0/hello.sh
[root@linux220 /test]# cat hello-1.0/hello.sh
#!/bin/bash

echo 'This is a test.'
echo

echo ' ________________________'
echo '/                        \'
echo '|                        |'
echo '| 야 !! 공부좀 해라!!!   |'
echo '|                        |'
echo '\________________________/'
echo '  \'
echo '   \'
echo '     (__)'
echo '     (oo)______'
echo '     (__)      )\'
echo '        ||---||  *'
echo '        ||   ||'
echo
[root@linux220 /test]# ls /usr/src/redhat
ls: /usr/src/redhat: 그런 파일이나 디렉토리가 없음
[root@linux220 /test]# yum -y install rpm-build
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * extras: ftp.daumkakao.com
 * updates: ftp.daumkakao.com
base                                                                                                  | 1.1 kB     00:00    
extras                                                                                                | 2.1 kB     00:00    
updates                                                                                               | 1.9 kB     00:00    
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rpm-build.i386 0:4.4.2.3-36.el5_11 set to be updated
--> Processing Dependency: xz for package: rpm-build
--> Processing Dependency: elfutils for package: rpm-build
--> Running transaction check
---> Package elfutils.i386 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libs-i386 = 0.137-3.el5 for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.127) for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.122) for package: elfutils
--> Processing Dependency: libasm.so.1 for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.130) for package: elfutils
--> Processing Dependency: libdw.so.1 for package: elfutils
--> Processing Dependency: libasm.so.1(ELFUTILS_1.0) for package: elfutils
--> Processing Dependency: libdw.so.1(ELFUTILS_0.126) for package: elfutils
---> Package xz.i386 0:4.999.9-0.3.beta.20091007git.el5 set to be updated
--> Running transaction check
---> Package elfutils-libs.i386 0:0.137-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                     Arch               Version                                          Repository             Size
=============================================================================================================================
Installing:
 rpm-build                   i386               4.4.2.3-36.el5_11                                updates               304 k
Installing for dependencies:
 elfutils                    i386               0.137-3.el5                                      base                  228 k
 elfutils-libs               i386               0.137-3.el5                                      base                  193 k
 xz                          i386               4.999.9-0.3.beta.20091007git.el5                 base                  146 k

Transaction Summary
=============================================================================================================================
Install       4 Package(s)
Upgrade       0 Package(s)

Total download size: 872 k
Downloading Packages:
(1/4): xz-4.999.9-0.3.beta.20091007git.el5.i386.rpm                                                   | 146 kB     00:00    
(2/4): elfutils-libs-0.137-3.el5.i386.rpm                                                             | 193 kB     00:00    
(3/4): elfutils-0.137-3.el5.i386.rpm                                                                  | 228 kB     00:00    
(4/4): rpm-build-4.4.2.3-36.el5_11.i386.rpm                                                           | 304 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        3.0 MB/s | 872 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : elfutils-libs                                                                                         1/4
  Installing     : elfutils                                                                                              2/4
  Installing     : xz                                                                                                    3/4
  Installing     : rpm-build                                                                                             4/4

Installed:
  rpm-build.i386 0:4.4.2.3-36.el5_11                                                                                        

Dependency Installed:
  elfutils.i386 0:0.137-3.el5       elfutils-libs.i386 0:0.137-3.el5       xz.i386 0:4.999.9-0.3.beta.20091007git.el5     

Complete!
[root@linux220 /test]# ls /usr/src/redhat
BUILD  RPMS  SOURCES  SPECS  SRPMS
[root@linux220 /test]# tar cvzf /usr/src/redhat/SOURCES/hello-1.0-1.tar.gz hello-1.0
hello-1.0/
hello-1.0/hello.sh
[root@linux220 /test]# tar tvzf /usr/src/redhat/SOURCES/hello-1.0-1.tar.gz
drwxr-xr-x root/root         0 2016-04-27 17:54:06 hello-1.0/
-rw-r--r-- root/root       393 2016-04-27 17:54:06 hello-1.0/hello.sh



[root@linux220 /test]# vi /usr/src/redhat/SPECS/hello.spec
[root@linux220 /test]# cat /usr/src/redhat/SPECS/hello.spec
%define name hello
%define version 1.0
%define release 1

Name:           hello
Version:        1.0
Release:        1
Summary:        Hello
Group:          CentOS
License:        GPL
URL:            http://www.example.com
Source0:        %{name}-%{version}-%{release}.tar.gz
BuildRoot:      /var/tmp/%{name}-buildroot

%description
Installs        /root/bin/hello.sh

%prep
%setup -q -n %{name}-%{version}

%build

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/root/bin
install -m 755 hello.sh $RPM_BUILD_ROOT/root/bin/hello.sh

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
/root/bin/hello.sh

%changelog
[root@linux220 /test]# rpmbuild -ba /usr/src/redhat/SPECS/hello.spec
실행 중(%prep): /bin/sh -e /var/tmp/rpm-tmp.79179
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf hello-1.0
+ /bin/gzip -dc /usr/src/redhat/SOURCES/hello-1.0-1.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd hello-1.0
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
실행 중(%build): /bin/sh -e /var/tmp/rpm-tmp.79179
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd hello-1.0
+ exit 0
실행 중(%install): /bin/sh -e /var/tmp/rpm-tmp.79179
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd hello-1.0
+ rm -rf /var/tmp/hello-buildroot
+ mkdir -p /var/tmp/hello-buildroot/root/bin
+ install -m 755 hello.sh /var/tmp/hello-buildroot/root/bin/hello.sh
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
파일 처리 중: hello-1.0-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/bash
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/hello-buildroot
작성: /usr/src/redhat/SRPMS/hello-1.0-1.src.rpm
작성: /usr/src/redhat/RPMS/i386/hello-1.0-1.i386.rpm
실행 중(%clean): /bin/sh -e /var/tmp/rpm-tmp.79179
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd hello-1.0
+ rm -rf /var/tmp/hello-buildroot
+ exit 0




[root@linux220 /test]# find /usr/src/redhat
/usr/src/redhat
/usr/src/redhat/RPMS
/usr/src/redhat/RPMS/athlon
/usr/src/redhat/RPMS/i586
/usr/src/redhat/RPMS/geode
/usr/src/redhat/RPMS/i386
/usr/src/redhat/RPMS/i386/hello-1.0-1.i386.rpm
/usr/src/redhat/RPMS/i686
/usr/src/redhat/RPMS/noarch
/usr/src/redhat/RPMS/i486
/usr/src/redhat/SRPMS
/usr/src/redhat/SRPMS/hello-1.0-1.src.rpm
/usr/src/redhat/SPECS
/usr/src/redhat/SPECS/hello.spec
/usr/src/redhat/BUILD
/usr/src/redhat/BUILD/hello-1.0
/usr/src/redhat/BUILD/hello-1.0/hello.sh
/usr/src/redhat/SOURCES
/usr/src/redhat/SOURCES/hello-1.0-1.tar.gz
[root@linux220 /test]# cd /usr/src/redhat/RPMS/i386
[root@linux220 /usr/src/redhat/RPMS/i386]# rpm -Uvh hello-1.0-1.i386.rpm
준비 중...               ########################################### [100%]
   1:hello                  ########################################### [100%]
[root@linux220 /usr/src/redhat/RPMS/i386]# ls -l /root/bin/hello.sh
-rwxr-xr-x 1 root root 393  4월 27 18:00 /root/bin/hello.sh
[root@linux220 /usr/src/redhat/RPMS/i386]# /root/bin/hello.sh
This is a test.

 ________________________
/                        \
|                        |
| 야 !! 공부좀 해라!!!   |
|                        |
\________________________/
  \
   \
     (__)
     (oo)______
     (__)      )\
        ||---||  *
        ||   ||

[root@linux220 /usr/src/redhat/RPMS/i386]# rpm -qa | grep hello
hello-1.0-1
[root@linux220 /usr/src/redhat/RPMS/i386]# rpm -qi hello-1.0-1
Name        : hello                        Relocations: (not relocatable)
Version     : 1.0                               Vendor: (none)
Release     : 1                             Build Date:
Install Date:                                  Build Host: linux220.example.com
Group       : CentOS                        Source RPM: hello-1.0-1.src.rpm
Size        : 393                              License: GPL
Signature   : (none)
URL         : http://www.example.com
Summary     : Hello
Description :
Installs        /root/bin/hello.sh
[root@linux220 /usr/src/redhat/RPMS/i386]# cd
[root@linux220 ~]# rpm -e hello
[root@linux220 ~]# rpm -qa | grep hello



⑥ GPG Key 생성과 패키지 sign


참조 http://idoit.egloos.com/374672
참조 https://librewiki.net/wiki/%EC%8B%9C%EB%A6%AC%EC%A6%88:%EC%95%94%ED%98%B8%EC%9D%98_%EC%95%94%EB%8F%84_%EB%AA%B0%EB%9D%BC%EB%8F%84_%EC%89%BD%EA%B2%8C_%ED%95%98%EB%8A%94_GPG




[root@linux220 ~]# cd
[root@linux220 ~]# gpg --gen-key
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
Please select what kind of key you want:
   (1) DSA and Elgamal (default)
   (2) DSA (sign only)
   (5) RSA (sign only)
Your selection?
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"

Real name: Yun, Jinsik
Email address: dodogau@naver.com
Comment: null
You selected this USER-ID:
    "Yun, Jinsik (null) <dodogau@naver.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
++++++++++.+++++++++++++++.+++++++++++++++++++++++++.++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++..++++++++++..++++++++++..................+++++

Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 281 more bytes)
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
.+++++++++++++++....+++++++++++++++..+++++.++++++++++.++++++++++.+++++.+++++++++++++++++++++++++++++++++++..+++++++++++++++++++++++++...++++++++++.+++++++++++++++>.+++++..+++++......+++++^^^
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 9D56C394 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   1024D/9D56C394 2016-04-27
      Key fingerprint = CB77 CEC2 3DD4 3A9D B43E  7E4E 80E9 2ACF 9D56 C394
uid                  Yun, Jinsik (null) <dodogau@naver.com>
sub   2048g/FF45FA28 2016-04-27



Key ID : 9D56C394
Pass Phrase : testing123



[root@linux220 ~]# gpg -a -o ~/RPM-GPG-KEY-test --export 9D56C394
[root@linux220 ~]# ls RPM*
RPM-GPG-KEY-test
[root@linux220 ~]# cat RPM-GPG-KEY-test
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)

mQGiBFcggzwRBADIeh4oqAfWD2dWRDZCvN7/ZGRHlZ+I00mGuKvIOG0rcGXAPzBW
t6SRavHjuaZyzlL0ql6+8zwYCnjSOJCtn5/W6qGJEov87C54aGZAp3zIIfLpxc1k
eMXSkdasLSENyi2I73sG9zDGzpGbtBmXeizQ4KRRwnAqVlbKEoV0QcWoBwCg6L0V
oMIYp9LGei2YGHWSugdj5LsD/iq5GL6dNS27/nUGd2BT6TGdSZGkSJCm9aWqAFO8
dpioBuJMyo41kXq9z3Y80LKk5PjSKoWU65CciW/1DrgApAQ58pLObQh33bbvvWZc
r6zAdr6EweY5WVXPGr1yAkcua6WzLFkmHbDcTGK07zk+NGuN9AiTaFElXFP1yVcU
fhYvA/9OnXZ7nRLSblni9ZLxsnNxYw8wUkZfULx+rGrMFUheDIFqz4GehxtVRnaS
XUBDrstorh6LZ+crHH8FjFdUrHwmdCw9tS3K/iE5NqYpJ5zo0bpgmqmXrMn/E71F
Nn9vjL+mBjBhk0Ww2K1lanuzqRwPoR0a88nTvVeSQxV2TT1E0LQmWXVuLCBKaW5z
aWsgKG51bGwpIDxkb2RvZ2F1QG5hdmVyLmNvbT6IYAQTEQIAIAUCVyCDPAIbAwYL
CQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEIDpKs+dVsOU6aIAnRU4SvRJH6E+P2VM
3e/i/AOX5+3BAJ9MQVFnWlsCn4WqpYHfPbsB1u0M+bkCDQRXIIM+EAgAsENREL3B
xBTWKy7Q4QslbOK9KsL8dxKoEhkcAyBMzOdmjiE2qQwL3oSh4gSJZ9z457axbj7/
KjrRdahPCS3803G0+a0Gj9KgcgsDpIcXYq5bh3kmxyzTz3HjceLboiA7y1l2x0Zb
Uq5aomKrtmacOcyQeIn1ahIOakXOjt+l9/gmUT7m+C1DeNaLaHXmpgPa2pc46/1I
kZiinoUCoQgc+EuL0agGDybiAxLR+H0CPdRNuMKTQkNXV8QGa/scEt1OzBkT7zox
LKG7F0cBWhEYCrn9YxsTCOPnrkE1HI3H/VPnPQBnwiYZB0dEpi08EA+PlLlQR/Ra
rGIwLdf9oddauwADBQf/We2szoRJfpNWrGrppWWgp4hzqKlwlYS9TsQlhSE32kR2
gjl0lQyPes4LlOMTSco8366siIFPMnScIvm+o8hvxV2AV0wllOkT62v5vrqbKxix
AP1ifZ8Rjpw7dGA9VsKBBhUirgrybTiDLJDfSJGSjQ2CQgP1ryb9AfObjbOm+f9F
G9tPYY/HfQqtIsoZicW56ORjCLUWMwwX3owheIEkgW56tObC4MUkiKR/eo/ij0Ol
CoMqtxQCCHVKhW8CGa3A4I8QwN3vjC1tsXp6XscVAV+wtvlAev0VuYOSPBRUSIpW
dwejeMNddlCxCETKlJWnObWPhVKEuC01oycxlFphpohJBBgRAgAJBQJXIIM+AhsM
AAoJEIDpKs+dVsOUyAAAoKJypKsiVz5RgfiH4EN77qm6VNFnAJ40uGO/w3rKwve9
j94VAlYr9oUKKw==
=3rm0
-----END PGP PUBLIC KEY BLOCK-----






[root@linux220 ~]# vi ~/.rpmmacros
[root@linux220 ~]# cat ~/.rpmmacros
%_gpg_name 9D56C394
[root@linux220 ~]# rpm --resign /usr/src/redhat/RPMS/i386/hello-1.0-1.i386.rpm
패스 구문(pass phrase) 입력:
패스 구문(pass phrase)이 일치합니다.
/usr/src/redhat/RPMS/i386/hello-1.0-1.i386.rpm:
gpg: WARNING: standard input reopened
gpg: WARNING: standard input reopened
[root@linux220 ~]# mkdir /var/www/html/packages
[root@linux220 ~]# cp /usr/src/redhat/RPMS/i386/hello*.rpm /var/www/html/packages/
[root@linux220 ~]# cp RPM-GPG-KEY-test /var/www/html/packages/
[root@linux220 ~]# yum -y install createrepo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * extras: ftp.daumkakao.com
 * updates: ftp.daumkakao.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.4.11-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                        Arch                       Version                            Repository                Size
=============================================================================================================================
Installing:
 createrepo                     noarch                     0.4.11-3.el5                       base                      59 k

Transaction Summary
=============================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 59 k
Downloading Packages:
createrepo-0.4.11-3.el5.noarch.rpm                                                                    |  59 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : createrepo                                                                                            1/1

Installed:
  createrepo.noarch 0:0.4.11-3.el5                                                                                          

Complete!
[root@linux220 ~]# createrepo -v /var/www/html/packages/ (createrepo /var/www/html/packages/)
1/1 - hello-1.0-1.i386.rpm

Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@linux220 ~]# service httpd start
httpd (을)를 시작 중:                                      [  OK  ]









[root@linux220 ~]# cd /etc/yum.repos.d/
[root@linux220 /etc/yum.repos.d]# ls
CentOS-Base.repo       CentOS-Media.repo    CentOS-Vault.repo      iso.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo  CentOS-fasttrack.repo
[root@linux220 /etc/yum.repos.d]# vi hello.repo
[root@linux220 /etc/yum.repos.d]# cat hello.repo
[hello]
name=hello
description=Test Yum Repository
baseurl=http://172.16.6.220/packages
enabled=1
gpgcheck=1
gpgkey=http://172.16.6.220/packages/RPM-GPG-KEY-test
[root@linux220 /etc/yum.repos.d]# yum -y install hello
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * extras: ftp.daumkakao.com
 * updates: ftp.daumkakao.com
hello                                                                                                 |  951 B     00:00    
hello/primary                                                                                         |  668 B     00:00    
hello                                                                                                                    1/1
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package hello.i386 0:1.0-1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                      Arch                        Version                         Repository                    Size
=============================================================================================================================
Installing:
 hello                        i386                        1.0-1                           hello                        2.2 k

Transaction Summary
=============================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 2.2 k
Downloading Packages:
hello-1.0-1.i386.rpm                                                                                  | 2.2 kB     00:00    
경고: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 9d56c394
hello/gpgkey                                                                                          | 1.7 kB     00:00    
Importing GPG key 0x9D56C394 "Yun, Jinsik (null) <dodogau@naver.com>" from http://172.16.6.220/packages/RPM-GPG-KEY-test
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : hello                                                                                                 1/1

Installed:
  hello.i386 0:1.0-1                                                                                                        

Complete!
[root@linux220 /etc/yum.repos.d]# hello.sh
This is a test.

 ________________________
/                        \
|                        |
| 야 !! 공부좀 해라!!!   |
|                        |
\________________________/
  \
   \
     (__)
     (oo)______
     (__)      )\
        ||---||  *
        ||   ||





(복원)

[root@linux220 /etc/yum.repos.d]# vi hello.repo
[root@linux220 /etc/yum.repos.d]# cat hello.repo
[hello]
name=hello
description=Test Yum Repository
baseurl=http://172.16.6.220/packages
enabled=0
gpgcheck=1
gpgkey=http://172.16.6.220/packages/RPM-GPG-KEY-test






Boot Sequence

리눅스 부팅 과정

Phase 0 : 전원 스위티 ON 단계
Ÿ 시스템 전원공급 Ÿ 메인보드의 ROM-BIOS에 있는 BIOS프로그램 자동실행 한다.
Ÿ BIOS 프로그램은 전원공급과 함께 메모리의 특정번지(예:FFFF0H)에 자동 로드된다.
Ÿ CPU는 전원공급과 함께 특정번지(예:FFFF0H)의 BIOS프로그램(명령들)을 자동실행 한다

Phase 1 : BIOS(Basic Input/Output System) 단계 / 펌웨어단계
Ÿ 자체진단기능(POST(Power On Self Test))
Ÿ CMOS검사, CPU,  MEMORY, 그래픽카드, 키보드, 마우스등 각종 장치들의 이상 유무를 검사하고 이들 장치(하드웨어들)을 초기화시킨다.
Ÿ 부팅매체검색과 부트로더 실행 Ÿ POST과정이  이상  없이  진행  완료되면  검색된  부팅매체(하드디스크,  CD-ROM,  플로피  디스크등)에서  부 트로더(예:GRUB, LILO)를 불러들인다.
Ÿ 즉, 예를들어 하드디스크가 부팅매체로 선택되었다면 하드디스크의 부팅파티션에 있는 0번섹터 (대부분 MBR이라고도 함)에 있는 부트로더(Boot Loader, 즉, GRUB)을 읽어 들이게 된다.
Ÿ 부트로더(GRUB)가 메모리에 적재되면 BIOS는 종료되고, 시스템 제어권은 부트로더(GRUB)이 갖게 된다.

Phase 2 : 부트로드(Boot Loader, GRUB) 단계
Ÿ 리눅스에서 사용하는 부트로더는 LILO(Linux Loader)나 GRUB가 있다.
Ÿ 만약 부팅로더로 GRUB를 사용하고 있다면, GRUB은 실행과 함께 /boot/grub/grub.conf파일을 읽어서 어떤 부팅메 뉴(커널)로 부팅을 할 것인가를 결정하게 된다.  (자동결정 또는 사용자선택)  이 화면이 GRUB이 화면(파란화 면)에 나타나는 첫 번째 화면이다.
Ÿ GRUB은 커널(kernel)이미지를 불러들이고 시스템 제어권을 커널에게 넘겨준다.

MBR(Master Boot Record)
그림1
참조 http://forensic-proof.com/archives/435

(2). GRUB(GRand Unified Bootloader)
Ÿ 환경 설정 파일 : /boot/grub/grub.conf(/etc/grub.conf)
Ÿ 실행 파일      : /sbin/grub
Ÿ 설정 옵션      :

/boot/grub/grub.conf
-----------------------------------------------------------------------------
timeout=5                                    /* 부팅시 타임아웃 설정 */
default=0 /* 기본 부팅 레이블(예: 0)
hiddenmenu /* GRUB 메뉴 숨김 */
splashimage=(hd0,0)/bot/grub/splash.xpm.gz /* splashimage 위치 */
title CentOS (2.6.18-164.11.1.el5) /* 타이틀 */
root (hd0,0) /* root 파티션 위치 */
kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-164.11.1.el5.img
-----------------------------------------------------------------------------

Ÿ GRUB 설치 : # /sbin/grub-install /dev/sda
Ÿ GRUB 삭제 :
(Linux 상에서 삭제)   : # dd if=/dev/zero of=/dev/sda bs=446 count=1
(Windows 상에서 삭제) : # fdisk /mbr

Phase 3 : 커널(Ketnel) 단계
Ÿ /etc/grub/grub.conf 파일에 의해서 커널(vmlinuz)이 메모리상에서 실행되면, 하드웨어를 점검하고 /var/log/dmesg 파일에 기록을 한다.
Ÿ 루트 파일시스템(/)을 읽기 전용(Read Only)으로 마운트 한다. 만약 마운트 실패시 “커널 패닉” 메세지를 출력한다.
Ÿ 커널은 swapper프로세스(PID 0번)를 호출한다.
Ÿ swapper(PID 0번)는 커널이 사용할 각 장치드라이브들을 초기화하고 init프로세스(PID 1번)가 실행하게 된다.
Ÿ /sbin/init프로세스가 실행되면서 /etc/inittab파일을 읽어들여서 그 내용들을 차례대로 실행한다.

Phase 4 : init 단계





[root@linux220 ~]# cd /boot
[root@linux220 /boot]# ls
System.map-2.6.18-194.el5  config-2.6.18-409.el5      initrd-2.6.18-409.el5.img  symvers-2.6.18-409.el5.gz
System.map-2.6.18-409.el5  grub                       message                    vmlinuz-2.6.18-194.el5
config-2.6.18-194.el5      initrd-2.6.18-194.el5.img  symvers-2.6.18-194.el5.gz  vmlinuz-2.6.18-409.el5
[root@linux220 /boot]# cd grub
[root@linux220 /boot/grub]# ls
device.map     ffs_stage1_5      jfs_stage1_5    reiserfs_stage1_5  stage2           xfs_stage1_5
e2fs_stage1_5  grub.conf         menu.lst        splash.xpm.gz      ufs2_stage1_5
fat_stage1_5   iso9660_stage1_5  minix_stage1_5  stage1             vstafs_stage1_5
[root@linux220 /boot/grub]# ls -l grub.conf menu.lst
-rw------- 1 root root 748  4월 27 17:04 grub.conf
lrwxrwxrwx 1 root root  11  4월 12 03:41 menu.lst -> ./grub.conf
[root@linux220 /boot/grub]# vi grub.conf
[root@linux220 /boot/grub]# cat grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-409.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-409.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-409.el5.img
title CentOS (2.6.18-194.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-194.el5.img






[EX] /sbin/init 데몬 확인



[root@linux220 /boot/grub]# pstree | more
init-+-VGAuthService
     |-acpid
     |-atd
     |-auditd-+-audispd---{audispd}
     |        `-{auditd}
     |-automount---4*[{automount}]
     |-avahi-daemon---avahi-daemon
     |-bonobo-activati---{bonobo-activati}
     |-bt-applet
     |-clock-applet
     |-crond
     |-cupsd
     |-2*[dbus-daemon]
     |-dbus-launch
     |-eggcups
     |-escd---{escd}
     |-events/0
     |-events/1
     |-events/2
     |-events/3
     |-gam_server
     |-gconfd-2
     |-gdm-binary---gdm-binary-+-Xorg
     |                         `-gnome-session-+-Xsession
     |                                         `-ssh-agent
     |-gdm-rh-security
     |-gnome-keyring-d
     |-gnome-panel
     |-gnome-power-man
     |-gnome-screensav
     |-gnome-settings----{gnome-settings-}
     |-gnome-terminal-+-bash-+-more
     |                |      `-pstree
     |                |-gnome-pty-helpe
     |                `-{gnome-terminal}
     |-gnome-vfs-daemo
     |-gnome-volume-ma
     |-gpm
     |-hald---hald-runner-+-hald-addon-acpi
     |                    |-hald-addon-keyb
[root@linux220 /boot/grub]# ps -ef | head -20
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 17:46 ?        00:00:00 init [5]                            
root         2     1  0 17:46 ?        00:00:00 [migration/0]
root         3     1  0 17:46 ?        00:00:00 [ksoftirqd/0]
root         4     1  0 17:46 ?        00:00:00 [migration/1]
root         5     1  0 17:46 ?        00:00:00 [ksoftirqd/1]
root         6     1  0 17:46 ?        00:00:00 [migration/2]
root         7     1  0 17:46 ?        00:00:00 [ksoftirqd/2]
root         8     1  0 17:46 ?        00:00:00 [migration/3]
root         9     1  0 17:46 ?        00:00:00 [ksoftirqd/3]
root        10     1  0 17:46 ?        00:00:00 [events/0]
root        11     1  0 17:46 ?        00:00:00 [events/1]
root        12     1  0 17:46 ?        00:00:00 [events/2]
root        13     1  0 17:46 ?        00:00:00 [events/3]
root        14     1  0 17:46 ?        00:00:00 [khelper]
root        15     1  0 17:46 ?        00:00:00 [kthread]
root        21    15  0 17:46 ?        00:00:00 [kblockd/0]
root        22    15  0 17:46 ?        00:00:00 [kblockd/1]
root        23    15  0 17:46 ?        00:00:00 [kblockd/2]
root        24    15  0 17:46 ?        00:00:00 [kblockd/3]




-> /sbin/init 프로세스가 모든 프로세스의 부모 프로세스라는 것을 알수 있다.
-> /sbin/init 프로세스는 PID 1번을 할당 받는다.






(2) /etc/inittab 파일
Ÿ /etc/inittab 파일은 /sbin/init 데몬이 읽어 들이는 설정 파일이다.
Ÿ 이 파일안에는 부팅시에 시스템을 초기화 하는 과정에 대한 전반적인 정보를 담는다.


[root@linux220 /boot/grub]# cat /etc/inittab
#
# inittab       This file describes how the INIT process should set up
#               the system in a certain run-level.
#
# Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#               Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by RHS are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# When our UPS tells us power has failed, assume we have a few minutes
# of power left.  Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly. 
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"


# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6

# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon



UPS : Uninterruptible Power Supply system(무정전 전원장치)

기본적으로 전력반도체를 사용한 UPS 에는 다음 4가지가 무조건 존재한다.
Utility Power 를 공급받아 정류하여 내부 회로에 공급하는 정류기
비상시를 대비해 전력을 저장해두는 배터리
Utility Power 가 Black-out 되거나 Sag 를 일으키며 stabilizing 되지 않을 때 Critical Circuit 으로 전원을 만들어 넘겨 줄 인버터
Normal(offline,line-interactive 한정), failure bypass 용 Auto-transfer switch


[root@linux220 /boot/grub]# cd /etc/rc5.d
[root@linux220 /etc/rc5.d]# ls
K01dnsmasq         K20rwhod         K74nscd             S07iscsid       S18rpcidmapd       S56cups
K02NetworkManager  K20tomcat5       K74ntpd             S08ip6tables    S19rpcgssd         S56rawdevices
K02avahi-dnsconfd  K24irda          K80kdump            S08iptables     S22messagebus      S56xinetd
K02oddjobd         K25squid         K85mdmpd            S08mcstrans     S23setroubleshoot  S57vmware-tools-thinprint
K03yum-updatesd    K30spamassassin  K87multipathd       S09isdn         S25bluetooth       S80sendmail
K05conman          K35dovecot       K87named            S10network      S25netfs           S85gpm
K05innd            K35smb           K88wpa_supplicant   S11auditd       S25pcscd           S90crond
K05saslauthd       K35vncserver     K89dund             S12restorecond  S26acpid           S90xfs
K05wdaemon         K35winbind       K89netplugd         S12syslog       S26apmd            S95anacron
K10dc_server       K50ibmasm        K89pand             S13cpuspeed     S26haldaemon       S95atd
K10psacct          K50netconsole    K89rdisc            S13irqbalance   S26hidd            S96readahead_later
K10tcsd            K50tux           K91capi             S13iscsi        S26lvm2-monitor    S98avahi-daemon
K12dc_client       K50vsftpd        S03vmware-tools     S13portmap      S28autofs          S99firstboot
K15httpd           K69rpcsvcgssd    S04readahead_early  S14nfslock      S50hplip           S99local
K20nfs             K73ypbind        S05kudzu            S15mdmonitor    S55sshd            S99smartd
[root@linux220 /etc/rc5.d]# ls -l /etc/rc5.d/S55sshd
lrwxrwxrwx 1 root root 14  4월 21 17:50 /etc/rc5.d/S55sshd -> ../init.d/sshd
[root@linux220 /etc/rc5.d]# /etc/init.d/sshd restart
sshd 를 정지 중:                                           [  OK  ]
sshd (을)를 시작 중:                                       [  OK  ]
[root@linux220 /etc/rc5.d]# /etc/rc5.d/S55sshd restart
sshd 를 정지 중:                                           [  OK  ]
sshd (을)를 시작 중:                                       [  OK  ]
[root@linux220 /etc/rc5.d]# service sshd restart
sshd 를 정지 중:                                           [  OK  ]
sshd (을)를 시작 중:                                       [  OK  ]
[root@linux220 /etc/rc5.d]# cat /sbin/service | more
#!/bin/sh

. /etc/init.d/functions

VERSION="`basename $0` ver. 0.91"
USAGE="Usage: `basename $0` < option > | --status-all | \
[ service_name [ command | --full-restart ] ]"
SERVICE=
SERVICEDIR="/etc/init.d"
OPTIONS=

if [ $# -eq 0 ]; then
   echo "${USAGE}" >&2
   exit 1
fi

cd /
while [ $# -gt 0 ]; do
  case "${1}" in
    --help | -h | --h* )
       echo "${USAGE}" >&2
       exit 0
       ;;
    --version | -V )
       echo "${VERSION}" >&2
       exit 0
       ;;
    *)
       if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
          cd ${SERVICEDIR}
          for SERVICE in * ; do
            case "${SERVICE}" in
              functions | halt | killall | single| linuxconf| kudzu)
                  ;;
              *)
                if ! is_ignored_file "${SERVICE}" \
                    && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
                  env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" status
                fi
                ;;
[root@linux220 /etc/rc5.d]# ls -l /etc/init.d
lrwxrwxrwx 1 root root 11  4월 12 03:34 /etc/init.d -> rc.d/init.d
[root@linux220 /etc/rc5.d]# cd /etc/init.d
[root@linux220 /etc/init.d]# ls
NetworkManager  cups                hsqldb      kudzu          nfslock          rpcidmapd       tomcat5
acpid           cups-config-daemon  httpd       lvm2-monitor   nscd             rpcsvcgssd      tux
anacron         dc_client           ibmasm      mcstrans       ntpd             rwhod           vmware-tools
apmd            dc_server           innd        mdmonitor      oddjobd          saslauthd       vmware-tools-thinprint
atd             dnsmasq             ip6tables   mdmpd          pand             sendmail        vncserver
auditd          dovecot             iptables    messagebus     pcscd            setroubleshoot  vsftpd
autofs          dund                irda        microcode_ctl  portmap          single          wdaemon
avahi-daemon    firstboot           irqbalance  multipathd     psacct           smartd          winbind
avahi-dnsconfd  functions           iscsi       named          rawdevices       smb             wpa_supplicant
bluetooth       gpm                 iscsid      netconsole     rdisc            spamassassin    xfs
capi            haldaemon           isdn        netfs          readahead_early  squid           xinetd
conman          halt                kdump       netplugd       readahead_later  sshd            ypbind
cpuspeed        hidd                killall     network        restorecond      syslog          yum-updatesd
crond           hplip               krb524      nfs            rpcgssd          tcsd
[root@linux220 /etc/init.d]# cd /etc/rc.d/init.d
[root@linux220 /etc/rc.d/init.d]# ls
NetworkManager  cups                hsqldb      kudzu          nfslock          rpcidmapd       tomcat5
acpid           cups-config-daemon  httpd       lvm2-monitor   nscd             rpcsvcgssd      tux
anacron         dc_client           ibmasm      mcstrans       ntpd             rwhod           vmware-tools
apmd            dc_server           innd        mdmonitor      oddjobd          saslauthd       vmware-tools-thinprint
atd             dnsmasq             ip6tables   mdmpd          pand             sendmail        vncserver
auditd          dovecot             iptables    messagebus     pcscd            setroubleshoot  vsftpd
autofs          dund                irda        microcode_ctl  portmap          single          wdaemon
avahi-daemon    firstboot           irqbalance  multipathd     psacct           smartd          winbind
avahi-dnsconfd  functions           iscsi       named          rawdevices       smb             wpa_supplicant
bluetooth       gpm                 iscsid      netconsole     rdisc            spamassassin    xfs
capi            haldaemon           isdn        netfs          readahead_early  squid           xinetd
conman          halt                kdump       netplugd       readahead_later  sshd            ypbind
cpuspeed        hidd                killall     network        restorecond      syslog          yum-updatesd
crond           hplip               krb524      nfs            rpcgssd          tcsd
[root@linux220 /etc/rc.d/init.d]# ls -li /etc/init.d/sshd
1309812 -rwxr-xr-x 1 root root 3.4K  2월 23  2012 /etc/init.d/sshd
[root@linux220 /etc/rc.d/init.d]# ls -li /etc/rc.d/init.d/sshd
1309812 -rwxr-xr-x 1 root root 3.4K  2월 23  2012 /etc/rc.d/init.d/sshd





(2-4-3) 현재 실행되는 스크립트와 부팅시 실행되는 스크립트
Ÿ (부팅시 실행할 스크립트) /etc/rc#.d/script
Ÿ (현재 실행할 스크립트)   /etc/init.d/script or /etc/rc.d/init.d/script


부팅시에 특정한 서비스를 설정하기 위해서는 다음과 같은 툴을 사용할 수 있다.
Ÿ (TUI) /usr/sbin/ntsysv (/usr/sbin/setup)
Ÿ (TUI) /sbin/chkconfig
Ÿ (GUI) /usr/sbin/system-config-services (/usr/sbin/serviceconf)



[EX1] ntsysv 명령어의 동작 원리
Ÿ ntsysv  명령어는  단순하게  /etc/rc#.d  디렉토리  안의  스크립트를  관리  해  주는  것이다. 
/etc/rc#.d  디렉토리안의 S##로 시작하는 스크립트나 K##로 시작하는 스크립트들의 이름을 변환하는 역할을 가진다.
Ÿ 따라서,  /etc/rc#.d  디렉토리 안의 스크립트이름을 S##에서 K##으로 변경되었다고 해서 현재 적용되는 것은 아니고 부팅시에 적용이 되는 것이다. 현재 서비스를 start/stop 하기 위해서는 /etc/init.d/script를 사용한 다.


[root@linux220 /etc/rc.d/init.d]# ntsysv
[root@linux220 /etc/rc.d/init.d]# cd /etc/rc5.d
[root@linux220 /etc/rc5.d]# ls *sshd*
K25sshd
[root@linux220 /etc/rc5.d]# ntsysv
[root@linux220 /etc/rc5.d]# ls *sshd*
S55sshd




(실무 예) sshd 서버스 Open
(현재) # service sshd start
(부팅) # chkconfig sshd on

[root@linux220 /etc/rc5.d]# chkconfig --list | grep sshd
sshd            0:해제  1:해제  2:활성  3:활성  4:활성  5:활성  6:해제
[root@linux220 /etc/rc5.d]# chkconfig sshd off
[root@linux220 /etc/rc5.d]# ls *sshd*
K25sshd
[root@linux220 /etc/rc5.d]# chkconfig sshd on
[root@linux220 /etc/rc5.d]# ls *sshd*
S55sshd



    init(/etc/inittab)
    -> /etc/rc.d/rc 5
             |
             V
/etc/rc5.d/S55sshd  <----------> /etc/init.d/sshd, /etc/rc.d/init.d/sshd
             A                                     A
             |                                     |
     # chkconfig sshd on/off             # service sshd start/stop/restart
                                         # /etc/init.d/sshd start/stop/restart
                                         # /etc/rc.d/init.d/sshd start/stop/restart




[root@linux220 /etc/rc5.d]# chkconfig sshd off
[root@linux220 /etc/rc5.d]# service sshd stop
sshd 를 정지 중:                                           [  OK  ]
[root@linux220 /etc/rc5.d]# service sshd start
sshd (을)를 시작 중:                                       [  OK  ]






[EX2] 부팅시에 사용자 스크립트/명령어를 실행하는 방법

Ÿ 리눅스에서 부팅시에 사용자 스크립트/명령어를 실행하기 위해서는 /etc/rc#.d/S##local  스크립트를 사용한다.
(예: /etc/rc5.d/S99local)
Ÿ /etc/rc5.d/S99local  스크립트는  /etc/init.d,  /etc/rc.d/init.d  디렉토리안의  스크립트에  연결되어  있지  않다.
따라서 /etc/rc5.d/S99local 스크립트에 들어 있는 내용은 부팅시에만 실행할 내용을 담는다.


# cat /etc/rc5.d/S99local   (/etc/rc.local, /etc/rc.d/init.d/rc.local)


[root@linux220 ~]# cat /etc/rc5.d/S99local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
[root@linux220 ~]# ls /etc/init.d/*local*
ls: /etc/init.d/*local*: 그런 파일이나 디렉토리가 없음
[root@linux220 ~]# ls /etc/rc.d/init.d/*local*
ls: /etc/rc.d/init.d/*local*: 그런 파일이나 디렉토리가 없음










부팅 과정(Booting Sequence) 실습



Ÿ GRUB 암호 설정 및 속성 정보 변경
[EX1] GRUB 암호 설정 및 속성 정보 실습

부팅시 GRUB프로그램이 실행되면 5초가 사라지기 전에 아무키나 누르면 GRUB편집 상태로 되는 것을 확인해 볼 수가 있다.
이때 부팅시 일반 사용자들도 GRUB상태만 편집하여 싱글유저 모드로 설정하여 재부팅을 하면 시스템을 관리 자 권한으로 변경  할 수가 있게 된다. 
이를 방지하기 위해 GRUB를 편집 할  때 Password를 걸어 일반  사용자들 은 GRUB모드를 편집 할 수 없도록 설정 하도록 한다.

① GRUB 암호 생성

[root@linux220 ~]# grub
Probing devices to guess BIOS drives. This may take a long time.



    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]

grub> help
blocklist FILE                         boot
cat FILE                               chainloader [--force] FILE
clear                                  color NORMAL [HIGHLIGHT]
configfile FILE                        device DRIVE DEVICE
displayapm                             displaymem
find FILENAME                          geometry DRIVE [CYLINDER HEAD SECTOR [
halt [--no-apm]                        help [--all] [PATTERN ...]
hide PARTITION                         initrd FILE [ARG ...]
kernel [--no-mem-option] [--type=TYPE] makeactive
map TO_DRIVE FROM_DRIVE                md5crypt
module FILE [ARG ...]                  modulenounzip FILE [ARG ...]
pager [FLAG]                           partnew PART TYPE START LEN
parttype PART TYPE                     quit
reboot                                 root [DEVICE [HDBIAS]]
rootnoverify [DEVICE [HDBIAS]]         serial [--unit=UNIT] [--port=PORT] [--
setkey [TO_KEY FROM_KEY]               setup [--prefix=DIR] [--stage2=STAGE2_
terminal [--dumb] [--no-echo] [--no-ed terminfo [--name=NAME --cursor-address
testvbe MODE                           unhide PARTITION
uppermem KBYTES                        vbeprobe [MODE]

grub> help md5crypt
md5crypt: md5crypt
    Generate a password in MD5 format.

grub> md5crypt

Password: ******
Encrypted: $1$dKCil$lBLc7gyEiBZm60WnSYNqd.

grub> quit


$1$MvASb1$ybxMVaG6G9vx3vqwPvRR/0



[root@linux220 ~]# vi /etc/grub.conf
[root@linux220 ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
#hiddenmenu
password --md5 $1$MvASb1$ybxMVaG6G9vx3vqwPvRR/0
title CentOS (2.6.18-409.el5) - JS, Yun
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-409.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-409.el5.img
title CentOS (2.6.18-194.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-194.el5.img
[root@linux220 ~]# reboot


그림2

-> 부팅화면에서 GRUB 라인 편집을 위해서 'e' 를 입력해도 편집할 수 없다.
-> 이것은 GRUB 암호를 입력했기 때문이다.
-> 따라서 GRUB 화면을 편집하기 위해서는 'p' 를 입력하고 GRUB 암호를 입력해야 한다.

p 눌렀을 때

그림3

④ GRUB 화면에서 'p' 입력 -> GRUB 암호 입력 -> [ENTER] 입력

그림4

-> GRUB 암호입력이 된후에는 원래 화면으로 다시 돌아오게 되고,
-> 이제 부터는 GRUB 화면을 편집하여 사용할 수 있게 되었다.
-> GRUB 화면을 편집하여 사용하기 위해서는 'e'라고 입력하고 편집하여 사용하면 된다.

그림5



(원복) /etc/grub.conf 파일 복원
# vi /etc/grub.conf
......
#password --md5 $1$Dl27c1$sFG0nLlyzeUza47hSAgOL1
......











[EX2] 리눅스에 서비스 등록

■ standalone 방식의 추가
■ xinetd 방식의 추가

(요청) oracle 관리자/was 관리자
       -> 운영체제가 부팅이 될때 was/oracle 소프트웨어를 같이 기동 시켜 달라.

(요청) 소스 컴파일(EX: /usr/local/apache2)
       -> (X) # /usr/local/apache2/bin/apachectl restart
       -> (0) # service apache2 restart
              # chkconfig apache2 on




(1) standalone 방식으로 새로운 서비스 추가

① /etc/init.d/new 스크립트 생성


#!/bin/bash
#
# chkconfig: 2345 55 25     /* # chkconfig new on -> 2/3/4/5 runlevel : on */
# description: Test Script  /* /etc/rc5.d/S55new, /etc/rc5.d/K25new */
#



[root@linux220 ~]# cd /etc/init.d
[root@linux220 /etc/init.d]# ls
NetworkManager  cups                hsqldb      kudzu          nfslock          rpcidmapd       tomcat5
acpid           cups-config-daemon  httpd       lvm2-monitor   nscd             rpcsvcgssd      tux
anacron         dc_client           ibmasm      mcstrans       ntpd             rwhod           vmware-tools
apmd            dc_server           innd        mdmonitor      oddjobd          saslauthd       vmware-tools-thinprint
atd             dnsmasq             ip6tables   mdmpd          pand             sendmail        vncserver
auditd          dovecot             iptables    messagebus     pcscd            setroubleshoot  vsftpd
autofs          dund                irda        microcode_ctl  portmap          single          wdaemon
avahi-daemon    firstboot           irqbalance  multipathd     psacct           smartd          winbind
avahi-dnsconfd  functions           iscsi       named          rawdevices       smb             wpa_supplicant
bluetooth       gpm                 iscsid      netconsole     rdisc            spamassassin    xfs
capi            haldaemon           isdn        netfs          readahead_early  squid           xinetd
conman          halt                kdump       netplugd       readahead_later  sshd            ypbind
cpuspeed        hidd                killall     network        restorecond      syslog          yum-updatesd
crond           hplip               krb524      nfs            rpcgssd          tcsd
[root@linux220 /etc/init.d]# cp sshd new
[root@linux220 /etc/init.d]# vi new
[root@linux220 /etc/init.d]# cat new
#!/bin/bash
#
# chkconfig: 2345 55 25
# description: Test Script
#

case "$1" in
        start)
                echo 1111 > /test/echo.start
                echo "[  OK  ] start"
                ;;
        stop)
                echo 2222 > /test/echo.stop
                echo "[  OK  ] stop"
                ;;
        restart)
                echo 2222 > /test/echo.stop
                echo "[  OK  ] stop"
                echo 1111 > /test/echo.start
                echo "[  OK  ] start"
                ;;
        *)
                echo $"Usage: $0 {start|stop|restart}"
                RETVAL=1
esac
exit $RETVAL
[root@linux220 /etc/init.d]# chkconfig --add new
[root@linux220 /etc/init.d]# ls -l /etc/rc?.d/*new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc0.d/K25new -> ../init.d/new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc1.d/K25new -> ../init.d/new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc2.d/S55new -> ../init.d/new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc3.d/S55new -> ../init.d/new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc4.d/S55new -> ../init.d/new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc5.d/S55new -> ../init.d/new
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc6.d/K25new -> ../init.d/new
[root@linux220 /etc/init.d]# chkconfig --list new
new             0:해제  1:해제  2:활성  3:활성  4:활성  5:활성  6:해제
[root@linux220 /etc/init.d]# service new restart
[  OK  ] stop
[  OK  ] start
[root@linux220 /etc/init.d]# ls -l /test/echo*
-rw-r--r-- 1 root root 5  4월 27 21:27 /test/echo.start
-rw-r--r-- 1 root root 5  4월 27 21:27 /test/echo.stop





# chkconfig --list new
# rm -rf /test/*
# reboot


[root@linux220 ~]# ls -l /test/*
-rw-r--r-- 1 root root 5  4월 27 21:30 /test/echo.start


[root@linux220 ~]# ls -l /test/*
-rw-r--r-- 1 root root 5  4월 27 21:30 /test/echo.start
[root@linux220 ~]# ls -l /etc/rc5.d/S*new*
lrwxrwxrwx 1 root root 13  4월 27 21:24 /etc/rc5.d/S55new -> ../init.d/new





[EX3] GRUB 복구에 대해서("grub-install" 명령어 실습)

① VMWare 환경의 경우 - 스냅샷 생성 VMWare > VM > Snapshot > Take Snapshot

② GRUB 삭제
# dd if=/dev/zero of=/dev/sda bs=446 count=1
# reboot


[root@linux220 ~]# dd if=/dev/zero of=/dev/sda bs=446 count=1
1+0 records in
1+0 records out
446 bytes (446 B) copied, 2.3175e-05 seconds, 19.2 MB/s
[root@linux220 ~]# reboot


그림6 (CD 부팅이 된 상태)

-> (원래는) 정상적으로 부팅이 되지 않는다......


Power Off

Power On To Firmware (F2)

부팅 우선순위 CD 를 디스크보다 위로 뒀음

CD 부팅이 됨 F5 복구모드

그림7


boot: linux rescue
..... 부팅 화면 .....

"choose a language"    : OK
"Keyboad Type"         : OK
"Setup Networking"     : No
"Rescue"               : Continue
                                : OK



그림8

그림9

그림10

그림11


④ grub-install 명령어 수행 작업

# df –h
-> /mnt/sysimage 마운트 확인

# fdisk –l /dev/sda
-> 이상이 없는 것을 확인(GRUB 메뉴만의 이상)

# cd /mnt/sysimage
# chroot /mnt/sysimage
# pwd
/
# ls
-> 변경된 root 파티션 확인

# cat /boot/grub/grub.conf
-> 내용에는 이상이 없음(grub.conf 파일은 정상적으로 보임)

# grub-install /dev/sda
# exit
# exit
..... 정상적으로 부팅이 된다.....



Power Off

Power On To Firmware (F2)

부팅 우선순위 CD 를 디스크보다 아래로 뒀음


[root@linux220 ~]# vi /etc/grub.conf
[root@linux220 ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
#hiddenmenu
#password --md5 $1$MvASb1$ybxMVaG6G9vx3vqwPvRR/0
title CentOS (2.6.18-409.el5) - JS, Yun
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-409.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-409.el5.img
title CentOS (2.6.18-194.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-194.el5.img



password 앞에 주석처리

끝.













'모의해킹 침해대응 전문가 과정' 카테고리의 다른 글

20160429 리눅스 관리자  (0) 2016.05.01
20160428 리눅스 관리자  (0) 2016.05.01
20160426 리눅스 관리자  (0) 2016.04.27
20160425 리눅스 관리자  (0) 2016.04.27
20160422 리눅스 관리자  (0) 2016.04.23
Posted by 22Hz
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함