제로 기초 학습 클 라 우 드 컴 퓨 팅 및 빅 데이터 DBA 클 러 스 터 [Linux 시스템 설정 및 네트워크 설정 2015 년 12 월 30 일 수요일]

24574 단어
2015.12.30/Mon

*************  **************
     
     1)       
            :atd
            :at
                :/etc/init.d/atd
                :/etc/at.deny 
                :/var/spool/at
     2)       
            :cron/crond
            :crontab
                :/etc/init.d/crond
                :/etc/cron.deny /etc/crontab
                :/var/spool/cron/* /var/log/cron

     *  rhel6
    1)  ——>BIOS——>boot loader(MBR)——>Kernel & initrd——>init
    2)BIOS
       1>  CMOS,         
       2>  
       3>       ,  MBR
    2)boot loader
       1>   MBR(512bytes),  446bytes
       2>rhel6 grub:
                     a.     /boot/grub/menu.lst 
                     b.grub       P722
                     c.  root      
       3>  Kernel initrd
    2)kernel&Initial
      1>       :/boot/vmlinuz-2.6.32-431.el6.x86_64
      2>       :/boot/initrd-2.6.32-431.el6.x86_64kdump.img<==       RAM Disk
      3>       :/lib/modules/2.6.32-431.el6.x86_64/kernel
      4>       : /proc/version
      5>       : /proc/sys/kernel
    3)init
      1>       :/sbin/init
      2>       :/etc/init/rcS.conf   /etc/rc.d/sysinit       
      3>       :/etc/inittab                              runlevl    
      4>       :/etc/rc.d/rcx.d                        (  runlevel  x,      )   
      5>       :/etc/init.d/* 
      6>       :/etc/init/*.conf
      3>     :chkconfig
*******************************************************************************************************
           

==============================================
           atd          
==============================================
     at           ,
               at     
     /etc/at.allow <==       at      
     /etc/at.deny  <==        at      
               ,       root    at
                /var/spool/at/*

#       :
  /etc/init.d/atd restart <==  
  rhel6
      service atd start    
      service atd restart  
      service atd status   
  rhel7
      systermctl start atd
      systermctl restart atd
      systermctl status atd


================================================
                   at     
================================================
at [-mldv] TIME
at -c     
     :
-m :  at      ,        ,   email         
   。
-l :at -l =atq,               at   ;
-d :at -d  =atrm ,        at       ;
-v :               at         ;
-c :                   。




===========================================================
                  cron/crond         
============================================================
               cron     
     /etc/cron.allow <==       crontab      
     /etc/cron.deny  <==        crontab      
                ,       root    crontab
     /etc/crontab <==        
     crontab         ,          /var/spool/cron/* <==           
               /var/log/cron 


==========================================
        /etc/crontab      
==========================================

[root@rhel6 ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
  :                     
/5 * * * * root run-parts /root/runcron



==========================================
          crontab     
==========================================

crontab [-u username] [-l|-e|-r]
     :
-u :   root   ,          /   crontab   
  ;
-e :   crontab     
-l :   crontab     
-r :     crontab      ,       ,   -e    

~~~~~~~~~~~~~~~~
crontab -e        :
~~~~~~~~~~~~~~~~
                          
     0-59 0-23 1-31 1-12 0-7    

                  
*(  )              
,(  )              
-(  )                
/n(  )       n     ,『   n     』,          

  ====student    12:00      
crontab -e
#  vi              。
0  12 *  *  * mail student -s "at 12:00" < /home/student/.bashrc
          |<==============  ===========================|
===========================================



--------------------------------------------------------------------------------------------------------------------
                     rhel6
********************************************************************
**********    **********
1.  ,  
           
2.bios(Basic Input Output System)-->    :                     
       (Master Boot Record, MBR):      512  
bootloader:  MBR,446  ,   ,   rhel6 grub/rhel7 grub2
grub      
stage1     stage2
stage2      
stage1.5   

grub      /boot/grub/grub.conf

root(hd0,0)              
/boot                  ,               ,
hd            
hd0        
0        



quiet        ,        
initrd       ,            
initrd                  

        
==========================================

===========================================================
                         /boot/*
===========================================================
          
  : /boot/vmlinuz /boot/vmlinuz-version
          RAM Disk: /boot/initrd (/boot/initrd-version)
    : /lib/modules/version/kernel  /lib/modules/$(uname -r)/kernel 
     : /usr/src/linux (      !       )
                 :
    : /proc/version
      : /proc/sys/kernel
           : /etc/modprobe.conf
================================================================================
                   /boot
==================================================================================
config-2.6.32-431.el6.x86_64 <==                              
lost+found
efi 
grub  <==      grub                                        
symvers-2.6.32-431.el6.x86_64.gz                                 
System.map-2.6.32-431.el6.x86_64<==               
initramfs-2.6.32-431.el6.x86_64.img    
initrd-2.6.32-431.el6.x86_64kdump.img<==        
vmlinuz-2.6.32-431.el6.x86_64<==    

=================
/boot/grub/*
=================
rw-r--r-- device.map <==grub        
-rw-r--r-- e2fs_stage1_5 <==       
-rw-r--r-- fat_stage1_5 <==FAT        
-rw-r--r-- ffs_stage1_5 <==FFS        
-rw------- grub.conf <==grub   Red Hat      
-rw-r--r-- iso9660_stage1_5<==          
-rw-r--r-- jfs_stage1_5<==jfs        
lrwxrwxrwx menu.lst -> ./grub.conf <==    
-rw-r--r-- minix_stage1_5 <==minix        
-rw-r--r-- reiserfs_stage1_5 <==reiserfs        
-rw-r--r-- splash.xpm.gz <==     grub        
-rw-r--r-- stage1 <==stage 1      
-rw-r--r-- stage2 <==stage 2      
-rw-r--r-- ufs2_stage1_5 <==UFS         
-rw-r--r-- vstafs_stage1_5 <==vstafs        
-rw-r--r-- xfs_stage1_5<==xfs        

====================
/boot/grub/menu.list
====================p722
default=0<==      ,    1       (title)
timeout=5<==  5       ,        
splashimage=(hd0,0)/grub/splash.xpm.gz<==         
hiddenmenu<==                (    )
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64)<==        
        root (hd0,0)<==           partition   
        kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_rhel6-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_rhel6/LogVol01 rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-431.el6.x86_64.img

==================================================
        /lib/modules/2.6.32-431.el6.x86_64/kernel
==================================================
         ,   

arch              cpu 
drivers                 、   、PCI      
kernel  
mm   
sound             
crypto              
fs              filesystems
lib           
net                 ,       
rch
------------------------------

lib/modules/$(uname -r)/modules.dep               
epmod [-Ane]
     :
-A :       , depmod               ,    /lib/modules/$(uname -r)/modules.dep   。    -A    , depmod      modules.dep        ,  。
-n :    modules.dep ,           (standard out);
-e :                  
   :            ,    a.ko,          ?
[root@www ~]# cp a.ko /lib/modules/$(uname -r)/kernel/drivers/net
[root@www ~]# depmod
         :
lsmod
modinfo 
insmod
rmmod
modprobe [-lcfr] module_name
     :
-c :           !(         )
-l :      /lib/modules/`uname -r`/kernel             ;
-f :       ;
-r :   rmmod   

/etc/modprobe.d/*             

***********************************************************************************************88
rhel6
1.         /etc/init/rcS.conf
2.     /etc/inittab
 Default runlevel. The runlevels used 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)
/etc/rc.d/rcx.d 

chkconfig --list
chkconfig xxxx on     2345        
chkconfig xxxx off     2345           
chkconfig --level 3 netconsole on        ,            

   root  ?
rhel6  kenel   s          root  


rhel7
stage1     MBR       /boot/grub2/i386-pc/boot.img
stage2 /boot/grub2/i386-pc/core.img
grup           /etc/default/grub   
grub     /boot/grub2/grub.cfg
    /etc/default/grub              grub    
   :grub2-mkconfig -o /boot/grub2/grub.cfg

       

    :1.     systemd
        2.           ,   xxxx.wants   ,             /etc/systemd/system/....target.wants   
3.systemctl enable xxxx         
4.          ,         ,            ,         。

centos7/rhel7                     ,GRUB b     ctrl+x  。

       rd.break init    。


rd.break  :

1、     ,     ,     ,      “e”;

2、   ,  linux16     , “end”    ,  rd.break, ctrl+x  ;

3、       mount,    /sysroot/,     ,  ro=readonly  ;

4、mount -o remount,rw /sysroot/,    ,  mount,    r,w  ;

5、chroot /sysroot/    ;

(1)echo redhat|passwd –stdin root   root   redhat,    passwd,    ;

(2)     cp  ,    /etc/shadow  

6、touch /.autorelabel      selinux  

7、ctrl+d   

8、  reboot

  ,      



init  :


1.     ,  GRUB2     ,  e       。

2.  linux16/linux/linuxefi            :init=/bin/sh

3.  Ctrl+x   shell。

4.            :mount –o remount,rw /

5.   passwd,      root  。
6.          selinux,        ,           :touch /.autorelabel

7.     exec /sbin/init     ,     exec /sbin/reboot  

=============================================================================
                     /etc/init/rcS.conf  /etc/rc.d/rc.sysinit 
=============================================================================
                 ,       

===============================================================================================
                           /etc/inittab 
===============================================================================================
     runlevel(      )
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used 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:



=============================================================================
                   /etc/rc.d/rcx.d 
=============================================================================
  runlevel  x,         ,             
K                
S                
        ,                     
/etc/rc.d/rc3.d/* 
K01smartd          K74ntpd            S10network           S26acpid
K02oddjobd         K75ntpdate         S11auditd            S26haldaemon
K05wdaemon         K75quota_nld       S11portreserve       S26udev-post
K10psacct          K76ypbind          S12rsyslog           S28autofs
K10saslauthd       K80kdump           S13cpuspeed          S50bluetooth
K15htcacheclean    K84wpa_supplicant  S13irqbalance        S55sshd
K15httpd           K87restorecond     S13rpcbind           S80postfix
K30spice-vdagentd  K88sssd            S15mdmonitor         S82abrt-ccpp
K50dnsmasq         K89rdisc           S22messagebus        S82abrtd
K50netconsole      K95firstboot       S23NetworkManager    S90crond
K50snmpd           K99rngd            S24nfslock           S95atd
K50snmptrapd       S01sysstat         S24rpcgssd           S97rhnsd
K60nfs             S02lvm2-monitor    S25blk-availability  S97rhsmcertd
K69rpcsvcgssd      S08ip6tables       S25cups              S99certmonger
K73winbind         S08iptables        S25netfs             S99local
=============================================================================
                   /etc/rc.d/rc.local 
=============================================================================
           
       shell script        /etc/rc.d/rc.local 


=============================================================================
                            /etc/init.d/* 
=============================================================================
         ,        、    、     、           
abrt-ccpp         firstboot     messagebus      rdisc        snmpd
abrtd             functions     netconsole      restorecond  snmptrapd
abrt-oops         haldaemon     netfs           rhnsd        spice-vdagentd
acpid             halt          network         rhsmcertd    sshd
atd               htcacheclean  NetworkManager  rngd         sssd
auditd            httpd         nfs             rpcbind      sysstat
autofs            ip6tables     nfslock         rpcgssd      udev-post
blk-availability  iptables      ntpd            rpcidmapd    wdaemon
bluetooth         irqbalance    ntpdate         rpcsvcgssd   winbind
certmonger        kdump         oddjobd         rsyslog      wpa_supplicant
cpuspeed          killall       portreserve     sandbox      ypbind
crond             lvm2-lvmetad  postfix         saslauthd
cups              lvm2-monitor  psacct          single
dnsmasq           mdmonitor     quota_nld       smartd


==============================================
               /etc/init/* 
==============================================
      
control-alt-delete.conf  rcS-sulogin.conf
init-system-dbus.conf    readahead-collector.conf
kexec-disable.conf       readahead.conf
plymouth-shutdown.conf   readahead-disable-services.conf
prefdm.conf              serial.conf
quit-plymouth.conf       splash-manager.conf
rc.conf                  start-ttys.conf
rcS.conf                 tty.conf
rcS-emergency.conf

==================================================
             /etc/sysconfig/*
==================================================
           



   rhel7
===========================================================
                         /boot/*
===========================================================
config-3.10.0-229.el7.x86_64 <==                     
extlinux
grub2  <==      grub2      
initramfs-0-rescue-aeba48e026da48748623100ffa1ab649.img
initramfs-3.10.0-229.el7.x86_64.img
initrd-plymouth.img  <==        
symvers-3.10.0-229.el7.x86_64.gz
System.map-3.10.0-229.el7.x86_64  <==               
vmlinuz-0-rescue-aeba48e026da48748623100ffa1ab649
vmlinuz-3.10.0-229.el7.x86_64  <==    


===============================================================================================
                      /etc/inittab    /etc/init.d/*
===============================================================================================
/etc/inittab
==============
# inittab is no longer used when using systemd. <==rhel7                
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.<==                
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target<==ctrlaltdel     /usr/lib/systemd/system/ctrl-alt-del     
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:<==         runlevel    ,     ,     
# multi-user.target: analogous to runlevel 3<==multi-user.target  runlevel3,    
# graphical.target: analogous to runlevel 5<==graphical.targe  runlevel5,    
# To view current default target, run:<==            ,     systemctl get-default
# systemctl get-default
# To set a default target, run:<==       ,    systemctl set-default TARGET.target
# systemctl set-default TARGET.target
===============
/etc/init.d/*
===============
rhel7              /etc/rc.d/init.d/*
      systemctl
=============================================================================
                        /etc/rc.d/*
============================================================================
init.d  rc0.d  rc1.d  rc2.d  rc3.d  rc4.d  rc5.d  rc6.d  rc.local
----------------------------------------------------------------------------
rhel7                /usr/lib/systemd/system/   
      systemctl



=============================================================================
                        /usr/lib/systemd/system/*
============================================================================
rhel7           ,        、    、     、           

ctrl-alt-del.target                      rpcbind.target
dbus-org.freedesktop.hostname1.service   rpc-gssd.service
dbus-org.freedesktop.locale1.service     rpc-statd-notify.service
dbus-org.freedesktop.login1.service      rpc-statd.service
dbus-org.freedesktop.machine1.service    rpc-svcgssd.service
dbus-org.freedesktop.timedate1.service   rsyncd.service
dbus.service                             rsyncd.socket
dbus.socket                              rsyslog.service
dbus.target.wants                        rtkit-daemon.service
debug-shell.service                      runlevel0.target
default.target                           runlevel1.target
default.target.wants                     runlevel1.target.wants
dev-hugepages.mount                      runlevel2.target
dev-mqueue.mount                         runlevel2.target.wants
dm-event.service                         runlevel3.target
dm-event.socket                          runlevel3.target.wants
dmraid-activation.service                runlevel4.target
dnsmasq.service                          runlevel4.target.wants
dracut-cmdline.service                   runlevel5.target
dracut-initqueue.service                 runlevel5.target.wants
dracut-mount.service                     runlevel6.target
dracut-pre-mount.service                 saslauthd.service
dracut-pre-pivot.service                 [email protected]
dracut-pre-trigger.service               shutdown.target
dracut-pre-udev.service                  shutdown.target.wants
dracut-shutdown.service                  sigpwr.target
ebtables.service                         sleep.target

=============================================================================
                        /etc/sys*
============================================================================

/etc/sysctl.conf                 
/usr/lib/sysctl.d/00-system.conf
-------------------------------------------------
/etc/system-release       
Red Hat Enterprise Linux Server release 7.1 (Maipo)
---------------------------------------------------
/etc/system-release-cpe
cpe:/o:redhat:enterprise_linux:7.1:ga:server
---------------------------------------------------
/etc/sysconfig:           
atd              init              network          rsyslog
                                         ,        
authconfig       ip6tables-config  network-scripts  run-parts
                                   
autofs           iptables-config   nfs              samba
cbq              irqbalance        ntpdate          saslauthd
cgred            kdump             pluto            selinux
console          kernel            radvd            smartmontools
cpupower         ksm               raid-check       sshd
crond            libvirtd          rdisc            sysstat
ebtables-config  libvirt-guests    readonly-root    sysstat.ioconf
fcoe             man-db            rhn              virtlockd
firewalld        modules           rpcbind          virt-who
grub             netconsole        rsyncd           wpa_supplicant
----------------------------------------------
/etc/sysctl.d:
99-sysctl.conf
-----------------------------------------------
/etc/systemd:
bootchart.conf  logind.conf  system.conf  user.conf
journald.conf   system       user

좋은 웹페이지 즐겨찾기