UNIX/Redhat

Linux 관리자 단기집중과정 -중급 4일차

99iberty 2018. 7. 17. 09:36


12장 Archive and copy files between systems


1. 아카이브



tar

cpio

아카이브 생성

-cvf

-ocv

아카이브 확인

-tvf

-ict

 아카이브 해제
 -xvf -icdmu


1) tar : 묶어주기만 하고 압축하는 건 아님.

압축하려면 아래 옵션 추가

    • -z : gzip 압축 (확장자 .gz)
    • -j : bzip2 압축 (확장자 .bz2)
    • -J : xz 압축 (확장자 .xz)

[root@station13 ~]# tar -cvzf    /tmp/home.tar.gzip    /home        <--- /home 아래 디렉토리를 /tmp/home.tar.gzip으로 만들겠다.
[root@station13 ~]# tar -tvf /tmp/home.tar                                       <--- 상대경로로 압축이 되어 있다. 현재 디렉토리 밑으로 만들어짐.
drwxr-xr-x root/root         0 2018-07-16 15:53 home/
drwx------ guru/guru         0 2018-07-12 02:49 home/guru/
drwxr-xr-x guru/guru         0 2018-07-12 02:48 home/guru/.mozilla/
drwxr-xr-x guru/guru         0 2014-06-10 04:37 home/guru/.mozilla/extensions/
drwxr-xr-x guru/guru         0 2014-06-10 04:37 home/guru/.mozilla/plugins/
-rw-r--r-- guru/guru        18 2016-12-07 08:19 home/guru/.bash_logout
-rw-r--r-- guru/guru       193 2016-12-07 08:19 home/guru/.bash_profile
-rw-r--r-- guru/guru       231 2016-12-07 08:19 home/guru/.bashrc
drwx------ visitor/visitor   0 2018-07-12 03:03 home/visitor/
drwxr-xr-x visitor/visitor   0 2018-07-12 02:48 home/visitor/.mozilla/
drwxr-xr-x visitor/visitor   0 2014-06-10 04:37 home/visitor/.mozilla/extensions/
drwxr-xr-x visitor/visitor   0 2014-06-10 04:37 home/visitor/.mozilla/plugins/
-rw-r--r-- visitor/visitor  18 2016-12-07 08:19 home/visitor/.bash_logout
-rw-r--r-- visitor/visitor 193 2016-12-07 08:19 home/visitor/.bash_profile
-rw-r--r-- visitor/visitor 231 2016-12-07 08:19 home/visitor/.bashrc
drwx------ hpuser/hpuser     0 2018-07-16 15:53 home/hpuser/
drwxr-xr-x hpuser/hpuser     0 2018-07-12 02:48 home/hpuser/.mozilla/
drwxr-xr-x hpuser/hpuser     0 2014-06-10 04:37 home/hpuser/.mozilla/extensions/
drwxr-xr-x hpuser/hpuser     0 2014-06-10 04:37 home/hpuser/.mozilla/plugins/
-rw-r--r-- hpuser/hpuser    18 2016-12-07 08:19 home/hpuser/.bash_logout
-rw-r--r-- hpuser/hpuser   193 2016-12-07 08:19 home/hpuser/.bash_profile
-rw-r--r-- hpuser/hpuser   231 2016-12-07 08:19 home/hpuser/.bashrc


[root@station13 ~]# tar -xvf /tmmp/home.tar -C /   <------- 대문자 C옵션을 줘서 압축해제할 경로를 지정할 수도 있다. 즉 이건 / 밑에 압축해제 하겠다는 것.



2) cpio

- cpio 명령어는 아규먼트를 가질 수 없어서 입력/출력 리다이렉션을 사용해야 한다.

- cpio는 절대경로로 묶어진다.

[root@station13 ~]# find /home | cpio -ocv > /tmp/home.cpio
/home
/home/guru
/home/guru/.mozilla
/home/guru/.mozilla/extensions
/home/guru/.mozilla/plugins
/home/guru/.bash_logout
/home/guru/.bash_profile
/home/guru/.bashrc
/home/visitor
/home/visitor/.mozilla
/home/visitor/.mozilla/extensions
/home/visitor/.mozilla/plugins
/home/visitor/.bash_logout
/home/visitor/.bash_profile
/home/visitor/.bashrc
/home/hpuser
/home/hpuser/.mozilla
/home/hpuser/.mozilla/extensions
/home/hpuser/.mozilla/plugins
/home/hpuser/.bash_logout
/home/hpuser/.bash_profile
/home/hpuser/.bashrc
9 blocks


[root@station13 ~]# cpio -ict < /tmp/home.cpio          <----- 이건 절대경로로 묶음이 된다.
/home
/home/guru
/home/guru/.mozilla
/home/guru/.mozilla/extensions
/home/guru/.mozilla/plugins
/home/guru/.bash_logout
/home/guru/.bash_profile
/home/guru/.bashrc
/home/visitor
/home/visitor/.mozilla
/home/visitor/.mozilla/extensions
/home/visitor/.mozilla/plugins
/home/visitor/.bash_logout
/home/visitor/.bash_profile
/home/visitor/.bashrc
/home/hpuser
/home/hpuser/.mozilla
/home/hpuser/.mozilla/extensions
/home/hpuser/.mozilla/plugins
/home/hpuser/.bash_logout
/home/hpuser/.bash_profile
/home/hpuser/.bashrc
9 blocks




2. gzip / bzip2

1) gip   : 자동적으로 확장자가 .gz가 붙는다. 

     - gunzip : gzip을 언집할때.

2) bzip2 : 속도/압축률이 gzip이 더 높다. 자동적으로 .bz2 확장자 붙는다.

[root@station13 tmp]# gzip home.cpio
[root@station13 tmp]# ls
firefox_root      systemd-private-3f4d6de6701647cc8fbb6316c904390e-colord.service-sf3ci9
home.cpio.gz      systemd-private-3f4d6de6701647cc8fbb6316c904390e-cups.service-SKqcdG
home.tar          systemd-private-3f4d6de6701647cc8fbb6316c904390e-rtkit-daemon.service-XzowTt
home.tar.gzip     systemd-private-3f4d6de6701647cc8fbb6316c904390e-systemd-machined.service-ajNq49
hsperfdata_root   tracker-extract-files.0
ks-script-9AOQ0v  yum.log
ks-script-hpNmpD  yum_save_tx.2018-07-16.13-47.4KOAfW.yumtx
ssh-JuCCYwObYdgh  yum_save_tx.2018-07-16.13-47.a_sAKQ.yumtx
[root@station13 tmp]#
[root@station13 tmp]# gunzip home.cpio.gz
[root@station13 tmp]# ls
firefox_root      systemd-private-3f4d6de6701647cc8fbb6316c904390e-colord.service-sf3ci9
home.cpio         systemd-private-3f4d6de6701647cc8fbb6316c904390e-cups.service-SKqcdG
home.tar          systemd-private-3f4d6de6701647cc8fbb6316c904390e-rtkit-daemon.service-XzowTt
home.tar.gzip     systemd-private-3f4d6de6701647cc8fbb6316c904390e-systemd-machined.service-ajNq49
hsperfdata_root   tracker-extract-files.0
ks-script-9AOQ0v  yum.log
ks-script-hpNmpD  yum_save_tx.2018-07-16.13-47.4KOAfW.yumtx
ssh-JuCCYwObYdgh  yum_save_tx.2018-07-16.13-47.a_sAKQ.yumtx



13장 Install and update software packages


1. RPM 패키지파일

1) noarch  : 아키텍처랑은 상관없다.

2) SPARC  : SPARC CPU

3) x86_64 : AMD64/Intel64 CPU

4) http://rpmfind.net/  : rpm 검색 가능. 보통은 검색 불가능.

http://rpmfind.net/linux/rpm2html/search.php?query=sendmail&submit=Search+...&system=centos&arch=

이런식으로 검색....

Download 항목에서 우클릭 > copy link location

# wget http://rpmfind.net/linux/centos/7.5.1804/os/x86_64/Packages/sendmail-8.14.7-5.el7.x86_64.rpm


2. RPM 파일 사용


1) -Uvh  패키지명    : 설치가 안되어 있으면 해주고 되어있는데 더 높은버전이면 얘로 업그레이드하라.

2) -ql  패키지명         : 어디에, 어떤 구성으로 설치되어 있는지 확인.

3) -V 패키지명           : 패키지 위조변조 여부 확인.

4) -e  패키지명          : 패키지 삭제

5) -qf  파일절대경로  : 어떤 파일이 무슨 rpm에 포함되어 있는지 확인.

6) --force 패키지명   : 강제적으로 설치/업데이트할때

7) --nodeps 패키지명 : 노디펜던시. 디펜던시 무시하고 설치/제거


[root@station13 ~]# rpm -qa       // 이 시스템에 설치된 모든 패키지 보여달라.
[root@station13 ~]# rmp -Uvh sendmail-8.14.7-5.el7.x86_64.rpm  // U는 업그레이드 : 설치가 안되어 있으면 해주고,

      설치가 되어있는데 버전이 더 높으면 얘로 업그레이드하라.

  // v는 verbose , h는 해쉬로 우물정자로 진행률 표시해줘라.

[root@station13 ~]# rpm -Uvh sendmail-8.14.7-5.el7.x86_64.rpm
warning: sendmail-8.14.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
    procmail is needed by sendmail-8.14.7-5.el7.x86_64
[root@station13 ~]#
[root@station13 ~]# wget http://rpmfind.net/linux/centos/7.5.1804/os/x86_64/Packages/procmail-3.22-36.el7_4.1.x86_64.rpm
--2018-07-17 11:26:02--  http://rpmfind.net/linux/centos/7.5.1804/os/x86_64/Packages/procmail-3.22-36.el7_4.1.x86_64.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 175608 (171K) [application/x-rpm]
Saving to: ‘procmail-3.22-36.el7_4.1.x86_64.rpm’

100%[===============================================================>] 175,608      180KB/s   in 1.0s  

2018-07-17 11:26:03 (180 KB/s) - ‘procmail-3.22-36.el7_4.1.x86_64.rpm’ saved [175608/175608]

[root@station13 ~]# rpm -Uvh procmail-3.22-36.el7_4.1.x86_64.rpm
warning: procmail-3.22-36.el7_4.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:procmail-3.22-36.el7_4.1         ################################# [100%]
[root@station13 ~]# rpm -Uvh sendmail-8.14.7-5.el7.x86_64.rpm
warning: sendmail-8.14.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:sendmail-8.14.7-5.el7            ################################# [100%]
[root@station13 ~]#
[root@station13 ~]#
[root@station13 ~]# rpm -qa | grep sendmail
sendmail-8.14.7-5.el7.x86_64
[root@station13 ~]# rpm -ql sendmail
/etc/NetworkManager/dispatcher.d/10-sendmail
/etc/mail
/etc/mail/Makefile
/etc/mail/access
/etc/mail/access.db
/etc/mail/aliasesdb-stamp
/etc/mail/domaintable
/etc/mail/domaintable.db
/etc/mail/helpfile
/etc/mail/local-host-names
/etc/mail/mailertable
/etc/mail/mailertable.db
/etc/mail/make
/etc/mail/sendmail.cf
/etc/mail/sendmail.mc
/etc/mail/submit.cf
/etc/mail/submit.mc
/etc/mail/trusted-users
/etc/mail/virtusertable
/etc/mail/virtusertable.db
/etc/pam.d/smtp
/etc/pam.d/smtp.sendmail
/etc/sasl2/Sendmail.conf
/etc/smrsh
/etc/sysconfig/sendmail
/usr/bin/hoststat
/usr/bin/mailq
/usr/bin/mailq.sendmail
/usr/bin/makemap
/usr/bin/newaliases
/usr/bin/newaliases.sendmail
/usr/bin/purgestat
/usr/bin/rmail
/usr/bin/rmail.sendmail
/usr/lib/sendmail
/usr/lib/sendmail.sendmail
/usr/lib/systemd/system/sendmail.service
/usr/lib/systemd/system/sm-client.service
/usr/sbin/editmap
/usr/sbin/editmap.sendmail
/usr/sbin/mailstats
/usr/sbin/makemap
/usr/sbin/makemap.sendmail
/usr/sbin/praliases
/usr/sbin/sendmail
/usr/sbin/sendmail.sendmail
/usr/sbin/smrsh
/usr/share/doc/sendmail-8.14.7
/usr/share/doc/sendmail-8.14.7/FAQ
/usr/share/doc/sendmail-8.14.7/KNOWNBUGS
/usr/share/doc/sendmail-8.14.7/LICENSE
/usr/share/doc/sendmail-8.14.7/README
/usr/share/doc/sendmail-8.14.7/RELEASE_NOTES.gz
/usr/share/man/man1/mailq.1.gz
/usr/share/man/man1/mailq.sendmail.1.gz
/usr/share/man/man1/newaliases.1.gz
/usr/share/man/man1/newaliases.sendmail.1.gz
/usr/share/man/man5/aliases.5.gz
/usr/share/man/man5/aliases.sendmail.5.gz
/usr/share/man/man8/editmap.8.gz
/usr/share/man/man8/editmap.sendmail.8.gz
/usr/share/man/man8/hoststat.8.gz
/usr/share/man/man8/mailstats.8.gz
/usr/share/man/man8/makemap.8.gz
/usr/share/man/man8/makemap.sendmail.8.gz
/usr/share/man/man8/praliases.8.gz
/usr/share/man/man8/purgestat.8.gz
/usr/share/man/man8/rmail.8.gz
/usr/share/man/man8/rmail.sendmail.8.gz
/usr/share/man/man8/sendmail.8.gz
/usr/share/man/man8/sendmail.sendmail.8.gz
/usr/share/man/man8/smrsh.8.gz
/var/log/mail
/var/log/mail/statistics
/var/spool/clientmqueue
/var/spool/clientmqueue/sm-client.st
/var/spool/mqueue
[root@station13 ~]# rpm -V sendmail
[root@station13 ~]# rm -f /usr/sbin/makemap   // 변조
[root@station13 ~]# echo hi >> /usr/bin/rmail    //변조
[root@station13 ~]# rpm -V sendmail
S.5....T.    /usr/bin/rmail.sendmail                       // 삭제했으면 missing이라고 나와야 하는데.. 안 나온다 ㅋㅋ 멍청하당 헤헷. 링크파일 지우면 못알아차린다.

                                                                                      // S : size 가 바뀌었다, 5 : 해쉬값이 바뀌었다. man rpm 하면 확인할 수 있다.
[root@station13 ~]#



[root@station13 ~]# which ls
alias ls='ls --color=auto'
    /usr/bin/ls
[root@station13 ~]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[root@station13 ~]# rpm -qf /usr/bin/ls
coreutils-8.22-18.el7.x86_64


[root@station13 ~]# rpm -Uvh sendmail-8.14.7-5.el7.x86_64.rpm
warning: sendmail-8.14.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
    package sendmail-8.14.7-5.el7.x86_64 is already installed
[root@station13 ~]# rpm -Uvh sendmail-8.14.7-5.el7.x86_64.rpm --force
warning: sendmail-8.14.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:sendmail-8.14.7-5.el7            ################################# [100%]
[root@station13 ~]#
[root@station13 ~]# ls /usr/sbin/sendmail
/usr/sbin/sendmail
[root@station13 ~]# ls /usr/sbin/makemap
/usr/sbin/makemap
[root@station13 ~]# rpm -e procmail
error: Failed dependencies:
    procmail is needed by (installed) sendmail-8.14.7-5.el7.x86_64                 // 의존성 있어서 삭제가 안 된다.



[root@station13 ~]# rpm -Uvh sendmail-8.14.7-5.el7.x86_64.rpm
warning: sendmail-8.14.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
    procmail is needed by sendmail-8.14.7-5.el7.x86_64
[root@station13 ~]# rpm -Uvh sendmail-8.14.7-5.el7.x86_64.rpm --nodeps               // 설치할때도 nodeps 사용 가능.. 근데 보통 사용 안함.
warning: sendmail-8.14.7-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:sendmail-8.14.7-5.el7            ################################# [100%]
[root@station13 ~]#




3. YUM

1) grouplist   : 묶음그룹 리스트.

2) search 패키지명 : 레포지토리에 있는 패키지 검색

3) groupinstall "그룹명" : 그룹 설치

4) repolist    : 레포지토리 리스트 나열


[root@station13 ~]# yum search ssl          // 현재 서버에 설치되어 있든 아니든 레포지토리에 있는 패키지들 보여줌.
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
=========================================== N/S matched: ssl ============================================
mod_ssl.x86_64 : SSL/TLS module for the Apache HTTP Server
nss_compat_ossl.x86_64 : Source-level compatibility library for OpenSSL to NSS porting
openssl-devel.x86_64 : Files for development of applications which will use OpenSSL
perl-Crypt-OpenSSL-Bignum.x86_64 : Perl interface to OpenSSL for Bignum
perl-Crypt-OpenSSL-RSA.x86_64 : Perl interface to OpenSSL for RSA
perl-Crypt-OpenSSL-Random.x86_64 : Perl interface to OpenSSL for Random
perl-Crypt-SSLeay.x86_64 : Crypt::SSLeay - OpenSSL glue that provides LWP https support
perl-IO-Socket-SSL.noarch : Perl library for transparent SSL
perl-Net-SMTP-SSL.noarch : SSL support for Net::SMTP
perl-Net-SSLeay.x86_64 : Perl extension for using OpenSSL
pyOpenSSL.x86_64 : Python wrapper module around the OpenSSL library
python-backports-ssl_match_hostname.noarch : The ssl.match_hostname() function from Python 3
qca-ossl.x86_64 : OpenSSL plugin for the Qt Cryptographic Architecture v2
crypto-utils.x86_64 : SSL certificate and key management utilities
docbook-style-dsssl.noarch : Norman Walsh's modular stylesheets for DocBook
flac-libs.x86_64 : Libraries for the Free Lossless Audio Codec
jbigkit-libs.x86_64 : JBIG1 lossless image compression library
m2crypto.x86_64 : Support for using OpenSSL in python scripts
mod_nss.x86_64 : SSL/TLS module for the Apache HTTP server
openjade.x86_64 : A DSSSL implementation
openssl.x86_64 : Utilities from the general purpose cryptography library with TLS implementation
openssl-libs.x86_64 : A general purpose cryptography library with TLS implementation
openssl098e.x86_64 : A compatibility version of a general cryptography and TLS library
openvpn.x86_64 : A full-featured SSL VPN solution
stunnel.x86_64 : An SSL-encrypting socket wrapper
texlive-jadetex.noarch : Macros supporting Jade DSSSL output

  Name and summary matches only, use "search all" for everything.
[root@station13 ~]#


[root@station13 ~]# yum install mod_ssl
Loaded plugins: fastestmirror, langpacks
base                                                                              | 3.6 kB  00:00:00    
classRPMs                                                                         | 2.5 kB  00:00:00    
errataRPMs                                                                        | 2.5 kB  00:00:00    
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.x86_64 1:2.4.6-45.el7.centos.4 will be installed
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64
--> Processing Dependency: httpd = 2.4.6-45.el7.centos.4 for package: 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64
--> Processing Dependency: httpd for package: 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7.centos.4 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-45.el7.centos.4 for package: httpd-2.4.6-45.el7.centos.4.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.centos.4.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.centos.4.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-45.el7.centos.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package                 Arch               Version                               Repository        Size
=========================================================================================================
Installing:
 mod_ssl                 x86_64             1:2.4.6-45.el7.centos.4               base             105 k
Installing for dependencies:
 apr                     x86_64             1.4.8-3.el7                           base             103 k
 apr-util                x86_64             1.5.2-6.el7                           base              92 k
 httpd                   x86_64             2.4.6-45.el7.centos.4                 base             2.7 M
 httpd-tools             x86_64             2.4.6-45.el7.centos.4                 base              84 k

Transaction Summary
=========================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 3.1 M
Installed size: 10 M
Is this ok [y/d/N]:   y   // d=download : 설치는 하지 않고 다운로드만 하겠다.

Downloading packages:
---------------------------------------------------------------------------------------------------------
Total                                                                     10 MB/s | 3.1 MB  00:00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : apr-1.4.8-3.el7.x86_64                                                                1/5
  Installing : apr-util-1.5.2-6.el7.x86_64                                                           2/5
  Installing : httpd-tools-2.4.6-45.el7.centos.4.x86_64                                              3/5
  Installing : httpd-2.4.6-45.el7.centos.4.x86_64                                                    4/5
  Installing : 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64                                                5/5
  Verifying  : httpd-tools-2.4.6-45.el7.centos.4.x86_64                                              1/5
  Verifying  : apr-1.4.8-3.el7.x86_64                                                                2/5
  Verifying  : 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64                                                3/5
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                           4/5
  Verifying  : httpd-2.4.6-45.el7.centos.4.x86_64                                                    5/5

Installed:
  mod_ssl.x86_64 1:2.4.6-45.el7.centos.4                                                                

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7                         apr-util.x86_64 0:1.5.2-6.el7                        
  httpd.x86_64 0:2.4.6-45.el7.centos.4             httpd-tools.x86_64 0:2.4.6-45.el7.centos.4           

Complete!


[root@station13 ~]# yum grouplist
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
Done


[root@station13 ~]# yum -y groupinstall File and Print Server    // 공백 걍 냅두면 안된다. 하나의 argument로 인식시켜줘야 한다.
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Warning: group File does not exist.
Warning: group and does not exist.
Warning: group Print does not exist.
Warning: group Server does not exist.
Maybe run: yum groups mark install (see man yum)
Error: No packages in any requested group available to install or update
[root@station13 ~]#

[root@station13 ~]# yum -y groupinstall "File and Print Server"
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Warning: Group base does not have any packages to install.
Group base does have 1 conditional packages, which may get installed.
Resolving Dependencies
--> Running transaction check
---> Package foomatic.x86_64 0:4.0.9-8.el7 will be installed
--> Processing Dependency: foomatic-db for package: foomatic-4.0.9-8.el7.x86_64
---> Package foomatic-filters.x86_64 0:4.0.9-8.el7 will be installed
---> Package iprutils.x86_64 0:2.4.13.1-1.el7 will be installed
--> Processing Dependency: lsscsi for package: iprutils-2.4.13.1-1.el7.x86_64
---> Package samba.x86_64 0:4.4.4-14.el7_3 will be installed
--> Processing Dependency: samba-libs = 4.4.4-14.el7_3 for package: samba-4.4.4-14.el7_3.x86_64
--> Processing Dependency: samba-common-tools = 4.4.4-14.el7_3 for package: samba-4.4.4-14.el7_3.x86_64
--> Processing Dependency: libxattr-tdb-samba4.so(SAMBA_4.4.4)(64bit) for package: samba-4.4.4-14.el7_3.x86_64
--> Processing Dependency: libxattr-tdb-samba4.so()(64bit) for package: samba-4.4.4-14.el7_3.x86_64
---> Package targetd.noarch 0:0.7.1-1.el7 will be installed
--> Processing Dependency: lvm2-python-libs >= 2.02.99 for package: targetd-0.7.1-1.el7.noarch
--> Processing Dependency: python-setproctitle for package: targetd-0.7.1-1.el7.noarch
--> Processing Dependency: PyYAML for package: targetd-0.7.1-1.el7.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package foomatic-db.noarch 0:4.0-40.20130911.el7 will be installed
--> Processing Dependency: foomatic-db-ppds = 4.0-40.20130911.el7 for package: foomatic-db-4.0-40.20130911.el7.noarch
--> Processing Dependency: foomatic-db-filesystem = 4.0-40.20130911.el7 for package: foomatic-db-4.0-40.20130911.el7.noarch
---> Package lsscsi.x86_64 0:0.27-4.el7 will be installed
---> Package lvm2-python-libs.x86_64 7:2.02.166-1.el7_3.5 will be installed
---> Package python-setproctitle.x86_64 0:1.1.6-5.el7 will be installed
---> Package samba-common-tools.x86_64 0:4.4.4-14.el7_3 will be installed
---> Package samba-libs.x86_64 0:4.4.4-14.el7_3 will be installed
--> Processing Dependency: libpytalloc-util.so.2(PYTALLOC_UTIL_2.1.6)(64bit) for package: samba-libs-4.4.4-14.el7_3.x86_64
--> Processing Dependency: libpytalloc-util.so.2(PYTALLOC_UTIL_2.0.6)(64bit) for package: samba-libs-4.4.4-14.el7_3.x86_64
--> Processing Dependency: libpytalloc-util.so.2()(64bit) for package: samba-libs-4.4.4-14.el7_3.x86_64
--> Running transaction check
---> Package foomatic-db-filesystem.noarch 0:4.0-40.20130911.el7 will be installed
---> Package foomatic-db-ppds.noarch 0:4.0-40.20130911.el7 will be installed
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package pytalloc.x86_64 0:2.1.6-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package                          Arch             Version                          Repository      Size
=========================================================================================================
Installing for group install "Core":
 iprutils                         x86_64           2.4.13.1-1.el7                   base           243 k
Installing for group install "File and Storage Server":
 samba                            x86_64           4.4.4-14.el7_3                   base           610 k
 targetd                          noarch           0.7.1-1.el7                      base            49 k
Installing for group install "Print Server":
 foomatic                         x86_64           4.0.9-8.el7                      base           253 k
 foomatic-filters                 x86_64           4.0.9-8.el7                      base            98 k
Installing for dependencies:
 PyYAML                           x86_64           3.10-11.el7                      base           153 k
 foomatic-db                      noarch           4.0-40.20130911.el7              base           1.0 M
 foomatic-db-filesystem           noarch           4.0-40.20130911.el7              base           9.1 k
 foomatic-db-ppds                 noarch           4.0-40.20130911.el7              base            29 M
 libyaml                          x86_64           0.1.4-11.el7_0                   base            55 k
 lsscsi                           x86_64           0.27-4.el7                       base            47 k
 lvm2-python-libs                 x86_64           7:2.02.166-1.el7_3.5             base           174 k
 pytalloc                         x86_64           2.1.6-1.el7                      base            15 k
 python-setproctitle              x86_64           1.1.6-5.el7                      base            15 k
 samba-common-tools               x86_64           4.4.4-14.el7_3                   base           451 k
 samba-libs                       x86_64           4.4.4-14.el7_3                   base           260 k

Transaction Summary
=========================================================================================================
Install  5 Packages (+11 Dependent packages)

Total download size: 32 M
Installed size: 48 M
Downloading packages:
---------------------------------------------------------------------------------------------------------
Total                                                                     11 MB/s |  32 MB  00:00:02    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : foomatic-db-filesystem-4.0-40.20130911.el7.noarch                                    1/16
  Installing : foomatic-db-ppds-4.0-40.20130911.el7.noarch                                          2/16
  Installing : foomatic-db-4.0-40.20130911.el7.noarch                                               3/16
  Installing : foomatic-filters-4.0.9-8.el7.x86_64                                                  4/16
  Installing : pytalloc-2.1.6-1.el7.x86_64                                                          5/16
  Installing : samba-libs-4.4.4-14.el7_3.x86_64                                                     6/16
  Installing : samba-common-tools-4.4.4-14.el7_3.x86_64                                             7/16
  Installing : 7:lvm2-python-libs-2.02.166-1.el7_3.5.x86_64                                         8/16
  Installing : python-setproctitle-1.1.6-5.el7.x86_64                                               9/16
  Installing : libyaml-0.1.4-11.el7_0.x86_64                                                       10/16
  Installing : PyYAML-3.10-11.el7.x86_64                                                           11/16
  Installing : lsscsi-0.27-4.el7.x86_64                                                            12/16
  Installing : iprutils-2.4.13.1-1.el7.x86_64                                                      13/16
  Installing : targetd-0.7.1-1.el7.noarch                                                          14/16
  Installing : samba-4.4.4-14.el7_3.x86_64                                                         15/16
  Installing : foomatic-4.0.9-8.el7.x86_64                                                         16/16
  Verifying  : lsscsi-0.27-4.el7.x86_64                                                             1/16
  Verifying  : libyaml-0.1.4-11.el7_0.x86_64                                                        2/16
  Verifying  : python-setproctitle-1.1.6-5.el7.x86_64                                               3/16
  Verifying  : foomatic-4.0.9-8.el7.x86_64                                                          4/16
  Verifying  : samba-4.4.4-14.el7_3.x86_64                                                          5/16
  Verifying  : foomatic-db-ppds-4.0-40.20130911.el7.noarch                                          6/16
  Verifying  : 7:lvm2-python-libs-2.02.166-1.el7_3.5.x86_64                                         7/16
  Verifying  : iprutils-2.4.13.1-1.el7.x86_64                                                       8/16
  Verifying  : pytalloc-2.1.6-1.el7.x86_64                                                          9/16
  Verifying  : foomatic-db-4.0-40.20130911.el7.noarch                                              10/16
  Verifying  : foomatic-db-filesystem-4.0-40.20130911.el7.noarch                                   11/16
  Verifying  : samba-libs-4.4.4-14.el7_3.x86_64                                                    12/16
  Verifying  : samba-common-tools-4.4.4-14.el7_3.x86_64                                            13/16
  Verifying  : targetd-0.7.1-1.el7.noarch                                                          14/16
  Verifying  : PyYAML-3.10-11.el7.x86_64                                                           15/16
  Verifying  : foomatic-filters-4.0.9-8.el7.x86_64                                                 16/16

Installed:
  foomatic.x86_64 0:4.0.9-8.el7  foomatic-filters.x86_64 0:4.0.9-8.el7  iprutils.x86_64 0:2.4.13.1-1.el7
  samba.x86_64 0:4.4.4-14.el7_3  targetd.noarch 0:0.7.1-1.el7         

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7                            foomatic-db.noarch 0:4.0-40.20130911.el7       
  foomatic-db-filesystem.noarch 0:4.0-40.20130911.el7    foomatic-db-ppds.noarch 0:4.0-40.20130911.el7  
  libyaml.x86_64 0:0.1.4-11.el7_0                        lsscsi.x86_64 0:0.27-4.el7                     
  lvm2-python-libs.x86_64 7:2.02.166-1.el7_3.5           pytalloc.x86_64 0:2.1.6-1.el7                  
  python-setproctitle.x86_64 0:1.1.6-5.el7               samba-common-tools.x86_64 0:4.4.4-14.el7_3     
  samba-libs.x86_64 0:4.4.4-14.el7_3                   

Complete!
[root@station13 ~]#

[root@station13 ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                              repo name                                                     status
base                                 CentOS 7 - x86_64 - base                                      3,831
classRPMs                            Custom Guru Labs Classroom RPMs                                 183
errataRPMs                           CentOS 7 - Server - x86_64 - Errata                             286
repolist: 4,300
[root@station13 ~]#
[root@station13 ~]# ll /etc/yum.repos.d
total 32
-rw-r--r--. 1 root root 1664 Jul 12 03:03 CentOS-Base.repo.reallydisabled
-rw-r--r--. 1 root root 1309 Jul 12 03:03 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Jul 12 03:03 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 Jul 12 03:03 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Jul 12 03:03 CentOS-Media.repo.reallydisabled
-rw-r--r--. 1 root root 1331 Jul 12 03:03 CentOS-Sources.repo
-rw-r--r--. 1 root root 2893 Jul 12 03:03 CentOS-Vault.repo
-rw-r--r--. 1 root root  392 Jan  6  2017 classroom.repo



[root@station13 testrepo]# ls /var/cache/yum/x86_64/7/epel
4e309143a2bee08d652fd9c321bc3b5911e8028554876fa270a60e00d178b807-updateinfo.xml.bz2
c05b9b116fbeb56969f8572766a459cf23c8887335f16611b097073726a45f77-comps-Everything.x86_64.xml.gz
cachecookie
fc53acddb91f9b7896dbcb406b77f89ee5ad6bef2e45e3fa487aa71cb8b0de78-primary.xml.gz
gen
metalink.xml
packages
repomd.xml
[root@station13 testrepo]#
[root@station13 testrepo]#
[root@station13 testrepo]#
[root@station13 testrepo]# yum install dbench
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.premi.st
Resolving Dependencies
--> Running transaction check
---> Package dbench.x86_64 0:4.0-10.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package                 Arch                    Version                     Repository             Size
=========================================================================================================
Installing:
 dbench                  x86_64                  4.0-10.el7                  epel                  1.0 M

Transaction Summary
=========================================================================================================
Install  1 Package

Total download size: 1.0 M
Installed size: 25 M
Is this ok [y/d/N]: d
Background downloading packages, then exiting:
warning: /var/cache/yum/x86_64/7/epel/packages/dbench-4.0-10.el7.x86_64.rpm.6393.tmp: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for dbench-4.0-10.el7.x86_64.rpm.6393.tmp is not installed
dbench-4.0-10.el7.x86_64.rpm                                                      | 1.0 MB  00:00:02    
exiting because "Download only" specified
[root@station13 testrepo]#
[root@station13 testrepo]# ls /var/cache/yum/x86_64/7/epel/packages/
dbench-4.0-10.el7.x86_64.rpm                                 // 다운로드됨.
[root@station13 testrepo]#
[root@station13 testrepo]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base classRPMs epel errataRPMs
Cleaning up everything
Cleaning up list of fastest mirrors
[root@station13 testrepo]#
[root@station13 testrepo]#
[root@station13 testrepo]# ls /var/cache/yum/x86_64/7/epel/packages/      //다운받은 거 클리어 됐다.
[root@station13 testrepo]#
[root@station13 testrepo]# yum remove mod_ssl
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.x86_64 1:2.4.6-45.el7.centos.4 will be erased
--> Finished Dependency Resolution
base                                                                              | 3.6 kB  00:00:00    
base/group_gz                                                                     | 155 kB  00:00:00    
base/primary_db                                                                   | 3.0 MB  00:00:00    
classRPMs                                                                         | 2.5 kB  00:00:00    
classRPMs/primary_db                                                              | 137 kB  00:00:00    
epel/x86_64/metalink                                                              | 4.8 kB  00:00:00    
epel/x86_64                                                                       | 3.2 kB  00:00:00    
epel/x86_64/group_gz                                                              |  88 kB  00:00:00    
epel/x86_64/updateinfo                                                            | 927 kB  00:00:00    
epel/x86_64/primary                                                               | 3.5 MB  00:00:00    
errataRPMs                                                                        | 2.5 kB  00:00:00    
errataRPMs/primary_db                                                             | 685 kB  00:00:00    

Dependencies Resolved

=========================================================================================================
 Package              Arch                Version                               Repository          Size
=========================================================================================================
Removing:
 mod_ssl              x86_64              1:2.4.6-45.el7.centos.4               @base              224 k

Transaction Summary
=========================================================================================================
Remove  1 Package

Installed size: 224 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64                                                1/1
  Verifying  : 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64                                                1/1

Removed:
  mod_ssl.x86_64 1:2.4.6-45.el7.centos.4                                                                

Complete!
[root@station13 testrepo]# rpm -qa | grep ssl
python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
openssl-libs-1.0.1e-60.el7_3.1.x86_64
openssl-1.0.1e-60.el7_3.1.x86_64



[root@station13 testrepo]# yum history
Loaded plugins: fastestmirror, langpacks
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     7 | root <root>              | 2018-07-17 14:47 | Erase          |    1  
     6 | root <root>              | 2018-07-17 14:19 | Install        |    3  <
     5 | root <root>              | 2018-07-17 12:19 | Install        |   16 >
     4 | root <root>              | 2018-07-17 12:13 | Install        |    5  <
     3 | System <unset>           | 2018-07-16 13:47 | Install        |    1 >
     2 | root <root>              | 2018-07-16 13:45 | Install        |   43  <
     1 | System <unset>           | 2018-07-12 02:48 | Install        | 1362 >
history list
[root@station13 testrepo]#
[root@station13 testrepo]#
[root@station13 testrepo]# yum history info 7
Loaded plugins: fastestmirror, langpacks
Transaction ID : 7
Begin time     : Tue Jul 17 14:47:42 2018
Begin rpmdb    : 1437:645f0ab72b5c7e8441f0d8ea985805885f1d73ac
End time       :            14:47:43 2018 (1 seconds)
End rpmdb      : 1436:e1ac362119f1cc6b93264b2aba6994676c395a33
User           : root <root>
Return-Code    : Success
Command Line   : remove mod_ssl
Transaction performed with:
    Installed     rpm-4.11.3-21.el7.x86_64                      @anaconda
    Installed     yum-3.4.3-150.el7.centos.noarch               @anaconda
    Installed     yum-plugin-fastestmirror-1.1.31-40.el7.noarch @anaconda
Packages Altered:
    Erase mod_ssl-1:2.4.6-45.el7.centos.4.x86_64 @base
history info

[root@station13 testrepo]# yum history undo 7          // 7번 항목 (erase mod_ssl) 한거 undo
Loaded plugins: fastestmirror, langpacks
Undoing transaction 7, from Tue Jul 17 14:47:42 2018
    Erase mod_ssl-1:2.4.6-45.el7.centos.4.x86_64 @base
Determining fastest mirrors
 * epel: mirror.premi.st
epel                                                                                         12611/12611
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.x86_64 1:2.4.6-45.el7.centos.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package              Arch                Version                                Repository         Size
=========================================================================================================
Installing:
 mod_ssl              x86_64              1:2.4.6-45.el7.centos.4                base              105 k

Transaction Summary
=========================================================================================================
Install  1 Package

Total download size: 105 k
Installed size: 224 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64                                                1/1
  Verifying  : 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64                                                1/1

Installed:
  mod_ssl.x86_64 1:2.4.6-45.el7.centos.4                                                                

Complete!
[root@station13 testrepo]#


# /etc/yum.conf  : yum 동작 정의. 별로 건드릴 일이 없다.

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release


#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something

[root@station13 ~]# cat /etc/yum.repos.d/classroom.repo
[base]
name=CentOS $releasever - $basearch - base
baseurl=file:///net/server1/export/netinstall/CENTOS7
enabled=1
gpgcheck=0

[classRPMs]
name=Custom Guru Labs Classroom RPMs
baseurl=file:///net/server1/export/courserepos/R7
enabled=1
gpgcheck=0

[errataRPMs]
name=CentOS $releasever - Server - $basearch - Errata
baseurl=file:///net/server1/export/courserepos/errata/R7
enabled=1
gpgcheck=0



4. EPEL

https://fedoraproject.org/wiki/EPEL

https://zetawiki.com/wiki/YUM_epel_%EC%A0%80%EC%9E%A5%EC%86%8C_%EC%B6%94%EA%B0%80

epel = Extra Packages for Enterprise Linux→ 엔터프라이즈 리눅스를 위한 추가 패키지

If you are running an EL7 version, please visit here to get the newest 'epel-release' package for EL7: The newest version of 'epel-release' for EL7

[root@localhost yum.repos.d]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.WqtRaM: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-11                ################################# [100%]
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ls
epel-testing.repo  epel.repo  local.repo
[root@localhost yum.repos.d]# ll
total 12
-rw-r--r--. 1 root root 1050 Oct  3  2017 epel-testing.repo
-rw-r--r--. 1 root root  951 Oct  3  2017 epel.repo
-rw-r--r--. 1 root root   94 Jul 17 13:54 local.repo
[root@localhost yum.repos.d]#
[root@station13 ~]# yum search dbench
Loaded plugins: fastestmirror, langpacks
epel/x86_64/metalink                                                              | 4.8 kB  00:00:00    
epel                                                                              | 3.2 kB  00:00:00    
(1/3): epel/x86_64/group_gz                                                       |  88 kB  00:00:00    
(2/3): epel/x86_64/updateinfo                                                     | 927 kB  00:00:01    
(3/3): epel/x86_64/primary                                                        | 3.5 MB  00:00:03    
Loading mirror speeds from cached hostfile
 * epel: mirror.premi.st
epel                                                                                         12611/12611
========================================== N/S matched: dbench ==========================================
dbench.x86_64 : Filesystem load benchmarking tool

  Name and summary matches only, use "search all" for everything.



5. HTTP 레포지토리 만들기

//아까 mod_ssl 설치하면서 아파치 웹서버 패키지도 설치됨.


[root@station13 ~]# cp *.rpm /var/www/html/testrepo/
[root@station13 ~]#
[root@station13 ~]# cd /var/www/html/testrepo/
[root@station13 testrepo]# ls
procmail-3.22-36.el7_4.1.x86_64.rpm  sendmail-8.14.7-5.el7.x86_64.rpm
[root@station13 testrepo]#
[root@station13 testrepo]# yum -y install createrepo
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.premi.st
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.9.9-26.el7 will be installed
--> Processing Dependency: python-deltarpm for package: createrepo-0.9.9-26.el7.noarch
--> Processing Dependency: deltarpm for package: createrepo-0.9.9-26.el7.noarch
--> Running transaction check
---> Package deltarpm.x86_64 0:3.6-3.el7 will be installed
---> Package python-deltarpm.x86_64 0:3.6-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================
 Package                       Arch                 Version                     Repository          Size
=========================================================================================================
Installing:
 createrepo                    noarch               0.9.9-26.el7                base                92 k
Installing for dependencies:
 deltarpm                      x86_64               3.6-3.el7                   base                82 k
 python-deltarpm               x86_64               3.6-3.el7                   base                31 k

Transaction Summary
=========================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 206 k
Installed size: 555 k
Downloading packages:
---------------------------------------------------------------------------------------------------------
Total                                                                    1.1 MB/s | 206 kB  00:00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : deltarpm-3.6-3.el7.x86_64                                                             1/3
  Installing : python-deltarpm-3.6-3.el7.x86_64                                                      2/3
  Installing : createrepo-0.9.9-26.el7.noarch                                                        3/3
  Verifying  : deltarpm-3.6-3.el7.x86_64                                                             1/3
  Verifying  : python-deltarpm-3.6-3.el7.x86_64                                                      2/3
  Verifying  : createrepo-0.9.9-26.el7.noarch                                                        3/3

Installed:
  createrepo.noarch 0:0.9.9-26.el7                                                                      

Dependency Installed:
  deltarpm.x86_64 0:3.6-3.el7                     python-deltarpm.x86_64 0:3.6-3.el7                   

Complete!
[root@station13 testrepo]#
[root@station13 testrepo]# createrepo .              // 여기있는 RPM 으로 createrepo. 의존성 같은거 검사해서 레포지토리 생성.
Spawning worker 0 with 1 pkgs
Spawning worker 1 with 1 pkgs
Spawning worker 2 with 0 pkgs
Spawning worker 3 with 0 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@station13 testrepo]# ll
total 916
-rw-r--r--. 1 root root 175608 Jul 17 14:19 procmail-3.22-36.el7_4.1.x86_64.rpm
drwxr-xr-x. 2 root root   4096 Jul 17 14:20 repodata
-rw-r--r--. 1 root root 754092 Jul 17 14:19 sendmail-8.14.7-5.el7.x86_64.rpm
[root@station13 testrepo]# ls repodata
13d7fa1923467ea57769f3e96c56892200f04dd8f2f8b7d1d24b25e6b310e96e-filelists.sqlite.bz2
383307f979b1f5dd22bfc2e601092f4f96285fb077a8fc23b7634bbb18f20626-primary.sqlite.bz2
a22538ea7862faa9ea1cfd9197b1c5f3461fd096fffdfcc6d11a85f378e63d18-other.sqlite.bz2
ba438b1136ea08ffa20682cae4f067cd43645b45bdf69877baf5fd6c9ac4a300-primary.xml.gz
f148dcbc332da9a650d32df57b4138bb182324d06a268d272dcd8c81bd35be7b-other.xml.gz
f64b81bb246249f1398e57cf39e7d61da35d23493e11fc0c616212ecce84a771-filelists.xml.gz
repomd.xml

[root@station13 testrepo]# systemctl start httpd
[root@station13 testrepo]#
[root@station13 testrepo]#
[root@station13 testrepo]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-07-17 14:35:49 KST; 5s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 6149 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─6149 /usr/sbin/httpd -DFOREGROUND
           ├─6150 /usr/sbin/httpd -DFOREGROUND
           ├─6151 /usr/sbin/httpd -DFOREGROUND
           ├─6152 /usr/sbin/httpd -DFOREGROUND
           ├─6153 /usr/sbin/httpd -DFOREGROUND
           └─6154 /usr/sbin/httpd -DFOREGROUND

Jul 17 14:35:48 station13.example.com systemd[1]: Starting The Apache HTTP Server...
Jul 17 14:35:49 station13.example.com systemd[1]: Started The Apache HTTP Server.


## VM (repo 클라이언트)

## /etc/yum.repos.d/local.repo

[physical]
name=physical
baseurl=http://192.168.122.1/testrepo
enabled=1
gpgcheck=0





14장 Access Linux file systems


1. 파일시스템이란?

- 데이터를 저장 할 수 있는 구조


2. 파일시스템 종류

1) 7버전부터... xfs 생김. ext 버림..


3. 파티션 구조


[root@station13 testrepo]# lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 465.8G  0 disk
├─sda1         8:1    0   500M  0 part /boot                     ----> 아나콘다가 lvm을 몰라서 커널/부트로더 이런 것들이 lvm에 설치에 못한다... 차후엔 다 lvm으로 나올거다.
├─sda2         8:2    0  34.2G  0 part
│ ├─vg0-root 253:0    0     8G  0 lvm  /
│ ├─vg0-swap 253:1    0   512M  0 lvm  [SWAP]
│ ├─vg0-tmp  253:2    0     1G  0 lvm  /tmp
│ └─vg0-var  253:3    0     2G  0 lvm  /var
└─sda3         8:3    0   100G  0 part /var/lib/libvirt/images
sr0           11:0    1  1024M  0 rom 


4. 파티셔닝

1) fdisk  : 2TB 미만 MBR 까지만 파티셔닝 가능

2) gdisk  : 2TB 이상 GPT도 파티션테이블 가능

3) extended 파티션 : 데이터 못 씀 걍 디스크 그릇일 뿐. 그 안에 로지컬 파티션을 만들어야 함.

4) fdisk,gdisk : w 해야 쓰여짐. 바로 파티셔닝 안 함.

5) parted : 걍 바로 파티션 만들어버림.



######### fdisk 사용

[root@localhost yum.repos.d]# lsblk
NAME        MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda           8:0    0   3G  0 disk
sdb           8:16   0   3G  0 disk
vda         252:0    0  30G  0 disk
|-vda1      252:1    0   1G  0 part /boot
`-vda2      252:2    0  29G  0 part
  |-cl-root 253:0    0  27G  0 lvm  /
  `-cl-swap 253:1    0   2G  0 lvm  [SWAP]

[root@localhost yum.repos.d]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xc7600161.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-6291455, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-6291455, default 6291455): +500M
Partition 1 of type Linux and of size 500 MiB is set

Command (m for help): p

Disk /dev/sda: 3221 MB, 3221225472 bytes, 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc7600161

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux


Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (1026048-6291455, default 1026048):
Using default value 1026048
Last sector, +sectors or +size{K,M,G} (1026048-6291455, default 6291455): +400M
Partition 2 of type Linux and of size 400 MiB is set

Command (m for help): p

Disk /dev/sda: 3221 MB, 3221225472 bytes, 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc7600161

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux
/dev/sda2         1026048     1845247      409600   83  Linux


Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 is deleted

Command (m for help): p

Disk /dev/sda: 3221 MB, 3221225472 bytes, 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc7600161

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux


Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (2-4, default 2): 2
First sector (1026048-6291455, default 1026048):
Using default value 1026048
Last sector, +sectors or +size{K,M,G} (1026048-6291455, default 6291455):
Using default value 6291455
Partition 2 of type Extended and of size 2.5 GiB is set

Command (m for help): p

Disk /dev/sda: 3221 MB, 3221225472 bytes, 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc7600161

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux
/dev/sda2         1026048     6291455     2632704    5  Extended

Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)             // 4까지는 프라이머리를 위해 예약됨
Select (default p): l
Adding logical partition 5
First sector (1028096-6291455, default 1028096): 
Using default value 1028096
Last sector, +sectors or +size{K,M,G} (1028096-6291455, default 6291455): +300M
Partition 5 of type Linux and of size 300 MiB is set

Command (m for help): p

Disk /dev/sda: 3221 MB, 3221225472 bytes, 6291456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xc7600161

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     1026047      512000   83  Linux
/dev/sda2         1026048     6291455     2632704    5  Extended
/dev/sda5         1028096     1642495      307200   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost yum.repos.d]#


### parted 사용

[root@localhost yum.repos.d]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help                                                            
  align-check TYPE N                        check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space,
        all found partitions, or a particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright information of GNU
        Parted

(parted) mklabel msdos                                                   
(parted) p                                                               
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  Flags

(parted) mklabel gpt                                                     
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost.
Do you want to continue?
Yes/No? yes                                                              
(parted) p                                                               
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

(parted)          
(parted) mkpart primary 0M 600M
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                    
(parted) p                                                               
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name     Flags
 1      17.4kB  600MB  600MB               primary              // ignore 해도 0부터 시작하지는 않는다.

(parted) mkpart primary 600M 1100M                                       
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                    
(parted) p                                                               
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size   File system  Name     Flags
 1      17.4kB  600MB   600MB               primary
 2      600MB   1100MB  500MB               primary
(parted) rm 2                                                            
(parted) p                                                               
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name     Flags
 1      17.4kB  600MB  600MB               primary
(parted) mkpart primary 600M 100%                                        
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore                                                    
(parted) p                                                               
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sdb: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  600MB   600MB                primary
 2      600MB   3221MB  2621MB               primary



[root@localhost yum.repos.d]# lsblk                                      
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0     3G  0 disk
|-sda1        8:1    0   500M  0 part
|-sda2        8:2    0     1K  0 part
`-sda5        8:5    0   300M  0 part
sdb           8:16   0     3G  0 disk
|-sdb1        8:17   0 572.2M  0 part
`-sdb2        8:18   0   2.5G  0 part
vda         252:0    0    30G  0 disk
|-vda1      252:1    0     1G  0 part /boot
`-vda2      252:2    0    29G  0 part
  |-cl-root 253:0    0    27G  0 lvm  /
  `-cl-swap 253:1    0     2G  0 lvm  [SWAP]


5. 디스크 종류

HDD-------SCSI, SAS, SATA : SDXX

             |---IDE                          : HDXX

                     |--- Virtual Disk           : VDXX


6. 디스크 포맷

[root@localhost yum.repos.d]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                 
|-sda1                                                              
|-sda2                                                              
`-sda5                                                              
sdb                                                                 
|-sdb1                                                              
`-sdb2                                                              
vda                                                                 
|-vda1      xfs               6ad7f1e0-44ee-447e-9722-e025d75aa66b   /boot
`-vda2      LVM2_member       S9z7ps-wqio-Aj4S-u2M7-mrqh-Nn0D-YKqJwp
  |-cl-root xfs               bcce7fe1-2bbe-4d56-a827-938192523236   /
  `-cl-swap swap              879c7cab-d3c7-478f-b9fc-93b5fceb9fe4   [SWAP]
[root@localhost yum.repos.d]# mkfs.ext4 /dev/sda1
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                           
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
128016 inodes, 512000 blocks
25600 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=34078720
63 block groups
8192 blocks per group, 8192 fragments per group
2032 inodes per group
Superblock backups stored on blocks:
    8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

[root@localhost yum.repos.d]# mkfs -t xfs /dev/sda5
meta-data=/dev/sda5              isize=512    agcount=4, agsize=19200 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=76800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0



[root@localhost yum.repos.d]# lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                 
|-sda1      ext4              5c30e23a-78a9-40ff-87d4-ecb52b08e35d  
|-sda2                                                              
`-sda5      xfs               1fc3dcce-8809-43a2-a200-15d4d1d2eda1  
sdb                                                                 
|-sdb1                                                              
`-sdb2                                                              
vda                                                                 
|-vda1      xfs               6ad7f1e0-44ee-447e-9722-e025d75aa66b   /boot
`-vda2      LVM2_member       S9z7ps-wqio-Aj4S-u2M7-mrqh-Nn0D-YKqJwp
  |-cl-root xfs               bcce7fe1-2bbe-4d56-a827-938192523236   /
  `-cl-swap swap              879c7cab-d3c7-478f-b9fc-93b5fceb9fe4   [SWAP]



7. 디스크 언마운트

[root@localhost ~]# umount /red
umount: /red: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
[root@localhost ~]#
[root@localhost ~]# fuser -cu /red
/red:                 1585c(guru)   ---> pid 1585로 guru라는 유저가 사용중

[root@localhost ~]# ps -ef | grep 1585
guru      1585  1582  0 16:56 pts/0    00:00:00 -bash
root      2406  2340  0 16:58 pts/1    00:00:00 grep --color=auto 1585


[root@localhost ~]# fuser -kcu /red
/red:                 1585c(guru)           ---> 해당 유저 강제 로그아웃




8. 이건 뭔지 모르겠다 걍 의식의 흐름대로 따라간다...ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

[root@localhost ~]# lsof /red
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# xfs_info /dev/sda5
meta-data=/dev/sda5              isize=512    agcount=4, agsize=19200 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=76800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=855, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


[root@localhost ~]# dumpe2fs /dev/sda1 | more
dumpe2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          5c30e23a-78a9-40ff-87d4-ecb52b08e35d
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype n
eeds_recovery extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink ex
tra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              128016
Block count:              512000
Reserved block count:     25600
Free blocks:              485316
Free inodes:              128005
First block:              1
Block size:               1024
Fragment size:            1024
Group descriptor size:    64
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2032
Inode blocks per group:   254
Flex block group size:    16
Filesystem created:       Tue Jul 17 16:18:22 2018
Last mount time:          Tue Jul 17 16:55:21 2018
Last write time:          Tue Jul 17 16:55:21 2018
Mount count:              3
Maximum mount count:      -1
Last checked:             Tue Jul 17 16:18:22 2018
Check interval:           0 (<none>)
Lifetime writes:          24 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:              128
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      0caf13c0-9174-4ae4-ae90-784d8294e5eb
Journal backup:           inode blocks
Journal features:         journal_64bit
Journal size:             8M
Journal length:           8192
Journal sequence:         0x00000007
Journal start:            0


Group 0: (Blocks 1-8192) [ITABLE_ZEROED]
  Checksum 0x9b15, unused inodes 2021
  Primary superblock at 1, Group descriptors at 2-5
  Reserved GDT blocks at 6-261
  Block bitmap at 262 (+261), Inode bitmap at 278 (+277)
  Inode table at 294-547 (+293)
  3821 free blocks, 2021 free inodes, 2 directories, 2021 unused inodes
  Free blocks: 4372-8192
  Free inodes: 12-2032

...............


[root@localhost ~]# xfs_admin -L xfslabel /dev/sda5
writing all SBs
new label = "xfslabel"

[root@localhost ~]# e2label /dev/sda1 ext4label
[root@localhost ~]# lsblk -f                       // UUID 까지 보기
NAME        FSTYPE   LABEL     UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      ext4     ext4label 5c30e23a-78a9-40ff-87d4-ecb52b08e35d  
├─sda2                                                               
└─sda5      xfs      xfslabel  1fc3dcce-8809-43a2-a200-15d4d1d2eda1  
sdb                                                                  
├─sdb1                                                               
└─sdb2                                                               
vda                                                                  
├─vda1      xfs                6ad7f1e0-44ee-447e-9722-e025d75aa66b   /boot
└─vda2      LVM2_mem           S9z7ps-wqio-Aj4S-u2M7-mrqh-Nn0D-YKqJwp
  ├─cl-root xfs                bcce7fe1-2bbe-4d56-a827-938192523236   /
  └─cl-swap swap               879c7cab-d3c7-478f-b9fc-93b5fceb9fe4   [SWAP]



9. XFS (7버전에서 새롭게 채택된 파일시스템)

※ XFS는 사이즈 줄이는건 불가능.... 헐.. ext는 늘일수도 줄일수도 있다.

1) xfs_admin : XFS 파일시스템의 파라미터 보고 변경하는 데 사용. (view and change parameters of an XFS filesystem.)

2) xfs_repair  : FS에 문제 생겼으면 수동으로 이 명령어로 문제가 있는지 없는지 체크하고 해결

3) xfs_growfs : LVM 할때 사용

4) xfsdump : 백업


#### 새로운 UUID로 변경

[root@localhost ~]# umount /blue
[root@localhost ~]# xfs_admin -u /dev/sda5
UUID = 1fc3dcce-8809-43a2-a200-15d4d1d2eda1
[root@localhost ~]# xfs_admin -U generate /dev/sda5           //UUID 변경
Clearing log and setting UUID
writing all SBs
new UUID = 8ef63baf-3427-4ac0-9200-56cc7b6bd1f8


//바뀐 UUID fstab에 반영시키고 다시 마운트

[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   27G  4.1G   23G  15% /
devtmpfs             984M     0  984M   0% /dev
tmpfs               1001M  144K 1001M   1% /dev/shm
tmpfs               1001M  8.9M  992M   1% /run
tmpfs               1001M     0 1001M   0% /sys/fs/cgroup
/dev/vda1           1014M  157M  858M  16% /boot
tmpfs                201M  4.0K  201M   1% /run/user/42
tmpfs                201M   12K  201M   1% /run/user/0
/dev/sda1            477M  2.3M  445M   1% /red
/dev/sda5            297M   16M  282M   6% /blue


[root@localhost ~]# cp /etc/{a,b,c,d}* /blue
cp: omitting directory `/etc/abrt'
cp: omitting directory `/etc/alsa'
cp: omitting directory `/etc/alternatives'
cp: omitting directory `/etc/at-spi2'
cp: omitting directory `/etc/audisp'
cp: omitting directory `/etc/audit'
cp: omitting directory `/etc/avahi'
cp: omitting directory `/etc/bash_completion.d'
cp: omitting directory `/etc/binfmt.d'
cp: omitting directory `/etc/bluetooth'
cp: omitting directory `/etc/brltty'
cp: omitting directory `/etc/chkconfig.d'
cp: omitting directory `/etc/cifs-utils'
cp: omitting directory `/etc/cron.d'
cp: omitting directory `/etc/cron.daily'
cp: omitting directory `/etc/cron.hourly'
cp: omitting directory `/etc/cron.monthly'
cp: omitting directory `/etc/cron.weekly'
cp: omitting directory `/etc/cups'
cp: omitting directory `/etc/cupshelpers'
cp: omitting directory `/etc/dbus-1'
cp: omitting directory `/etc/dconf'
cp: omitting directory `/etc/default'
cp: omitting directory `/etc/depmod.d'
cp: omitting directory `/etc/dhcp'
cp: omitting directory `/etc/dnsmasq.d'
cp: omitting directory `/etc/dracut.conf.d'
[root@localhost ~]#

[root@localhost ~]# xfs_freeze -f /blue


// 다른 터미널창 열어서...

[root@localhost ~]# xfsdump -f /tmp/dumptest /blue
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.4 (dump format 3.0) - type ^C for status and control

 ============================= dump label dialog ==============================

please enter label for this dump session (timeout in 300 sec)
 -> bluebackup
session label entered: "bluebackup"

 --------------------------------- end dialog ---------------------------------

xfsdump: level 0 dump of localhost.localdomain:/blue
xfsdump: dump date: Wed Jul 18 10:16:24 2018
xfsdump: session id: 3a16a0e4-7735-4044-95e5-f8502975eeb8
xfsdump: session label: "bluebackup"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 162688 bytes
xfsdump: /var/lib/xfsdump/inventory created

 ============================= media label dialog =============================

please enter label for media in drive 0 (timeout in 300 sec)
 ->
media label entered: ""

 --------------------------------- end dialog ---------------------------------

xfsdump: WARNING: no media label specified
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 116840 bytes
xfsdump: dump size (non-dir files) : 82016 bytes
xfsdump: dump complete: 42 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /tmp/dumptest OK (success)
xfsdump: Dump Status: SUCCESS

// 다른 터미널창 열어서...

[root@localhost ~]# rm -f /blue/*


----> 안 넘어감


// 다른 터미널창 열어서...

[root@localhost ~]# xfs_freeze -u /blue   //해동
[root@localhost ~]# xfsrestore -f /tmp/dumptest /blue   // 복구




10. 파일시스템 구조


[root@localhost ~]# ls -il      // inode까지 보여주라
합계 8
33582160 -rw-------. 1 root root 1658  7월 16 15:25 anaconda-ks.cfg
33582164 -rw-r--r--. 1 root root 1706  7월 16 15:30 initial-setup-ks.cfg
 1927028 drwxr-xr-x. 2 root root    6  7월 16 15:30 공개
33582195 drwxr-xr-x. 2 root root    6  7월 16 15:30 다운로드
18288195 drwxr-xr-x. 2 root root    6  7월 16 15:30 문서
18288192 drwxr-xr-x. 2 root root    6  7월 16 15:30 바탕화면
 1927029 drwxr-xr-x. 2 root root    6  7월 16 15:30 비디오
52291900 drwxr-xr-x. 2 root root    6  7월 16 15:30 사진
52291899 drwxr-xr-x. 2 root root    6  7월 16 15:30 서식
33582196 drwxr-xr-x. 2 root root    6  7월 16 15:30 음악



11. SWAP


[root@localhost ~]# mkswap /dev/sdb1
Setting up swapspace version 1, size = 585916 KiB
no label, UUID=83e8fed9-8328-4a84-a924-c00758d37113
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# swapon -s                                      // swap 만들었다고 바로 swap 활성화되지 않는다.
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
[root@localhost ~]# lsblk -f
NAME        FSTYPE   LABEL     UUID                                   MOUNTPOINT
sda                                                                  
├─sda1      ext4     ext4label 5c30e23a-78a9-40ff-87d4-ecb52b08e35d   /red
├─sda2                                                               
└─sda5      xfs      xfslabel  8ef63baf-3427-4ac0-9200-56cc7b6bd1f8   /blue
sdb                                                                  
─sdb1      swap               83e8fed9-8328-4a84-a924-c00758d37113  
└─sdb2                                                               
vda                                                                  
├─vda1      xfs                6ad7f1e0-44ee-447e-9722-e025d75aa66b   /boot
└─vda2      LVM2_mem           S9z7ps-wqio-Aj4S-u2M7-mrqh-Nn0D-YKqJwp
  ├─cl-root xfs                bcce7fe1-2bbe-4d56-a827-938192523236   /
  └─cl-swap swap               879c7cab-d3c7-478f-b9fc-93b5fceb9fe4   [SWAP]
[root@localhost ~]# swapon /dev/sdb1                  // swap on 시켜야 한다.
[root@localhost ~]# swapon -s

Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
/dev/sdb1                                  partition    585916    0    -2
[root@localhost ~]#


// 재부팅하면 swap 없어진다. 그래서 fstab에 올려줘야 한다.

// 스왑 일단 비활성화

[root@localhost ~]# swapoff /dev/sdb1
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
[root@localhost ~]#
[root@localhost ~]# vim /etc/fstab


#
# /etc/fstab
# Created by anaconda on Mon Jul 16 15:03:03 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=6ad7f1e0-44ee-447e-9722-e025d75aa66b /boot                   xfs     defaults        0 0
/dev/mapper/cl-swap     swap                    swap    defaults        0 0
LABEL=ext4label         /red                    ext4    defaults        0 2
UUID=8ef63baf-3427-4ac0-9200-56cc7b6bd1f8       /blue                   xfs     defaults        0 2
UUID=83e8fed9-8328-4a84-a924-c00758d37113       swap    swap    pri=10  0 0                      // priority가 높을수록 더 빨리 사용됨.


[root@localhost ~]# swapon -a                                                              // 스왑 모두 활성화
[root@localhost ~]# swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-1                                  partition    2097148    0    -1
/dev/sdb1                                  partition    585916    0    10
[root@localhost ~]#