Linux/RHEL6

Top / Linux / RHEL6

RHEL6

  • ܥйWebȤDBȤFTPȤ줿

NW


  1. ⤽ǥХƤΡ
    cat /etc/udev/rules.d/70-persistent-net.rules
    
    • MACɥ쥹ϽƤΤǤɤˤʤꤽ̾eth0ˤʤäƤ
  2. ե뤫
    • /etc/sysconfig/network
       NETWORKING=yes
       HOSTNAME=mx130s1
       GATEWAY=192.168.1.1
      
    • /etc/sysconfig/network-scripts/ifcfg-eth0
       DEVICE=eth0
       #NM_CONTROLLED=no
       ONBOOT=yes
       BOOTPROTO=dhcp 
       #BOOTPROTO=static
       #IPADDR=192.168.1.100
       #NETMASK=255.255.255.0
      
      • ΤΤȤ⥳ȥȤǽ񤤤Ƥ
  3. Ƶư
     service network restart
    
  4. äĤʤäΤǥȥȹԤ򥳥ȤʤBOOTPROTOstaticˤƤ⤦ɺƵưƴλ

̵ưФ

  • 桼ɲ
  • sudoers
  • sshrootԲĤ
    • /etc/ssh/sshd_config
       PermitRootLogin no
      
  • iptablesԽ
    • 80443
  • DNSʤưǤʤʤä ̾褬ڤǤʤäΤĴ٤餳줬ä
    • /etc/resolv.conf
       nameserver 192.168.1.1
      
  • ntp饤
    • ޤ碌
       ntpdate ntp.nict.jp
      
    • /etc/ntp.conf
       server ntp.nict.jp
       server ntp.jst.mfeed.ad.jp
       server ntp-tk01.ocn.ad.jp
      
    • ư
       chkconfig ntpd on
       service ntpd start
      
  • httpd
    • /var/www/htdocs /var/www/ssldocs ˤ
  • squid줿
  • podcatchercronǤ֤ޤ魯
  • DiCEˤʥߥåDNSμư
  • hosts˼ʬɲäȤ
     192.168.1.100   mx130s1
    

yumݥȥDVDȤȤ

  1. ŬʤȤ/dev/dvdޥ
  2. Ȥ򥳥ԡɤrepodataǥľPackage˥󥯤ŽƤΤ褦ʤΤPackageԡrpmϤ롣֤
  3. ϿDVDPackageˤ⾯ΤǤĤä⤦
  4. createreporepodata餻ơեĤФ

yumݥȥCentOSΤĤ꤯

  • ޤȤˤ󥹥ȡ뤷褦ȤȤʤȤۤΤ󤼤ĥäƤʤΤǤޤ礦
  • եϤʤ
    • /etc/yum.repo.d/CentOS-Base.repo
       [base]
       name=CentOS-6 - Base
       mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
       #baseurl=http://mirror.centos.org/centos/6/os/$basearch/
       gpgcheck=1
       gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
       
       #released updates
       [updates]
       name=CentOS-6 - Updates
       mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
       #baseurl=http://mirror.centos.org/centos/6/updates/$basearch/
       gpgcheck=1
       gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
       
       #packages used/produced in the build but not released
       #[addons]
       #name=CentOS-6 - Addons
       #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=addons
       ##baseurl=http://mirror.centos.org/centos/6/addons/$basearch/
       #gpgcheck=1
       #gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
       
       #additional packages that may be useful
       [extras]
       name=CentOS-6 - Extras
       mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
       #baseurl=http://mirror.centos.org/centos/6/extras/$basearch/
       gpgcheck=1
       gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
      
      • ŪˤCentOSΤ򤽤Τޤޡ $releasever ϤΤޤޤȡ6Server٤äɾƥߥ顼ꥹȤĤʤʤΤǡǤRHEL5줿5ˤʤȤ

yumݥȥ¾ΥӥȤ

  • rpmfusionepelrpmforge餤
  • ɤΥݥȥ⡢ݥȥɲѤrpmۤƤΤwgetƤʤ겿ʤꤹФǤ
  • ɲäȥ줫⡣Τؤޤ褯狼ʤ
  • epelRedHat󤬤äƤ뤫礦֤ʡrpmfusionrpmforgeϤɤäƤΤĴ٤Ƥʤ
  • ޥ˥åʤȤʤФCentOSΥݥȥȤǻ­Τǡenabled=0ˤΤ󤸤ʤ顣ɬפʤȤ yum --enablerepo=hoge 뤫󤸤

yumϤΤȤꤢȤŪ

  • ߥ顼ꥹȤʣΥߥ顼ȤˤФᤤȤȤäƤƤ褦ˤ
     yum install yum-fastestmirror
    
    • ʤȤޤ٤ߥ顼ˤäȤԹˤʤ

repoä

  • äƤƼ
     yum clean all
     yum list hoge
    

podcatcher

  • rhelΥݥȥˤȤϻפʤ
     yum install podcatcher
    
    • rubyäƤ

termtterʤȤޤgem

  • ɤ֤Ǥ줿魯줿ɤʤ󤸡CentOSΥݥȥɲúѤߤʤĥäƤ줽rhelݥȥΤߤǤФȤgemsetup.rb餻ȤäɥݥȥɲäפǤ
     yum install ruby-devel #ʤ
     yum install irb #ʤ
     yum install rubygems
     gem install rdoc-data #ʤ 
     rdoc-data --install
     gem install termtter
    

samba

  • 󥹥ȡ뤹
     yum install samba
    
  • ե򤤤
  • iptables롣rejectɲäʤỌ̇̄ʤ445ɬפ
     -A INPUT -p udp -m udp --dport 137 -j ACCEPT
     -A INPUT -p udp -m udp --dport 138 -j ACCEPT
     -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT
     -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT
    
  • ӥư
     service smb start
    
  • windows饢
     \\192.168.1.100
    
  • ɽ񤭤ʤǥ쥯ȥˤäƤϳʤġ
  • setenforce 0 ƤߤʤưSELinux Τ
    • ǤdisabledˤƻȤΤ϶ʤΤ򤬤Ф
    • ܤį
       getsebool -a | grep samba
      
    • äݤΤonˤ롣-PĤʤȺƵưȤǥեȤ
       setsebool -P samba_enable_home_dirs 1
      
    • ~/samba ؤ˥ǤǤ /home/sambapublicΤġˤޤ
    • ٥ߤ롣 home_root_t äơȥޥ˥奢Ȥߤ
       ls -Z /home
       man selinux
      
    • samba_selinuxäƤܤߤʤΤǤߤƤߤ
       man samba_selinux
      
    • If you want to share files other than home directories, those files must be labeled samba_share_t. äƤƤ롣( ϡ)
       chcon -t samba_share_t /home/samba
      
    • ޤǤư褦ˤϤʤämanˤϤȤߤʤȽ񤤤Ƥ뤱ɤȤꤢǤ䡣֤󤹤Ǥ˥ե֤Ƥ硢ΥեƱݥꥷˤˤrestoreconɬפʤ֤󡣤ǡrestoreconǸƤФݥꥷꤷƤʤȤʤäƤȤʡ
    • ⤷Ȥ
       yum install policycoreutils-python
       #semanageޥɤϤʤȻȤʤäư /etc/selinux/targeted/contexts/files/file_contexts.homedirs 򤤤äƤ褵ɳڤʤΤsemanage롣
       semanage fcontext -a -t samba_share_t "/home/samba(/.*)?"
       # file_contexts.local  /home/samba(/.*)? system_u:object_r:samba_share_t:s0 ɲä
       restorecon -R -v /home/samba/
      
  • samba-swat äƤΤ餷֥饦sambaꤤ뤽ʡyum롣
     yum install samba-swat
    
    • ݡȤ901֤Ȥ褦ʤΤǤ롣

VNCĶ

  • ⡼ȤGNOMEΥǥȥå״ĶȤ褦ˤ
  • ̣ϤΤ档ǤKVMΥޥ͡ȤGUIΤڤġ
  • ݡȥեɤʤVNC³ϰŹ沽ʤΤޤޤǻȤʤ⡼ȥȤϤĤʤʤۤ褤
  • ҤȤޤ󤹤
     yum install vnc-server
    
  • 롼ȥ桼VNCĶĤʤ֤ʤ
     su -
     vncserver
    
    • VNC³ѤΥѥ
  • ݡȤ롣5900+ǥץ쥤ֹ椬ѥݡȡ:1ʤ5901
  • SELinuxϤΤޤޤʿä
  • windowsĤʤ
  • GNOMEΥǥȥå״ĶȤ褦ˤ
     yum groupinstall "X Window System" "Desktop" "Japanese Support"
    
    • ɤΥݥȥ򻲾Ȥ뤫ˤ뤱ɡcentosmirrorͭʾϤäȤäƤ㤦äݤɻ饢餬centosͤˤʤ
  • ˥󥹥ȡ뤵NetworkManager򻦤ʥӤˤŬʤ
     service NetworkManager stop
     chkconfig NetworkManager off
    
    • /etc/resolv.confäݤΤnameserverƻɬפ
    • ifcfg-eth0 NM_CONTROLLED=no 򵭽Ҥȥ󥿥եñ̤NM̵Ǥ뤱ɤʤȤʤǼʤΤȤˤ
  • ꤹ衣٤Ȥ
    • /etc/sysconfig/vncservers
       VNCSERVERS="1:root"
       VNCSERVERARGS[1]="-geometry 1280x960"
      
  • ³GNOMEǥȥåפΩ夬褦ˤ
    • /.vnc/xstartup

       #twm &#ιԤ򥳥ȥ
       exec gnome-session# ɲ
      
  • ܸĶˤ
    • LANGĶѿˤäƥ饤Τ.bashrcLANGɤ
       export  LANG=ja_JP.UTF-8
      
    • ̾δĶǤܸˤʤääơեѤʤȲ褦ˤʤ

ե

  • /usr/share/fonts ۲äƤ
    • 桼ñ̤Τ ~/.fonts ۲
  • եȥåΥꥢ
     fc-cache -fv
    
  • ӥƵư³ǧѸĶɤ͡
     service vncserver restart
    
    • ܸˤʤxstartup˸錄
       #twm &
       LANG=ja_JP.utf-8
       export LANG
       exec gnome-session
      
  • ɬפ˱chkconfigǼưưϿ

KVMĶȤ

  • ޥɥ饤Ǥˡ⤢ɤޤϿäƤߤ뤳ȤɸVNCĶޥ͡Ω夲ɲä
  • ۥޥĤΤϴñʤΤdz䰦ͥåȥޤŬǤ
  • ҤȤޤUbuntu 11.04 Server֤ࡣ󥹥ȡOpenSSHɲä褦ˤʤȵͤΤ
  • ư塢ifconfigIP򸫤ơۥOSSSH
    • OSľܿȤƤ⥭ޥåפƥȤѥפȤǤƤʤϤʤShift+7ϤѻܡɤǤʤġ
      • ޥåѤΤϤǤǽʤϤʤѹʤΤǤ᤿
         sudo apt-get console-data
         # θ塢ФʲƤˢqwertyJapanesePC100
         # ʤȤ sudo dpkg-reconfigure console-data
         # dpkg-reconfigure console-setupǥܡɤФϤʤɽФʤʤ
        
      • ֤Ĥϥ󥹥ȡˤĤä桼sudo⤷ʤƤȤʻ͡
    • ǥեȤȲۥͥåȥ 192.168.122.0/24
  • ̥桼 su - Ǥ褦root˥ѥꤹʥǥեȤꤵƤʤΤǰ̥桼餤ʤ su - Ǥʤ
     sudo su -
     passwd
    
  • ͥåȥꤤ롣IPˤ
    • /etc/network/interfaces
       auto eth0
       #iface eth0 inet dhcp
       iface eth0 inet static
       address 192.168.122.100
       netmask 255.255.255.0
       gateway 192.168.122.1
      
    • Ƶư
       /etc/init.d/networking restart
      
  • root
    • /etc/ssh/sshd_config
       PermitRootLogin no #ǤyesιԤΤnoѤ
      
  • 192.168.122.0/24 192.168.1.0/24 ؤΥ롼ƥ󥰤ϤɤǤ󤫤͡ۥ֥åȤȤäݤɤޤ褯狼äƤʤΤĴ٤롣192.168.1.0/24ľܲۥޥsshϤ餽

NFSǤĤ

  • ۥOS˥ݥȥΩƤơOS餽˥
  • rhel6createrepoݥȥrhel5饢checksum顼Фߴ꤬Ȥ
    • httpǥȳˤäƥ¤ɤ¦createrepoǤʤ
    • ۴ĶNFSǤϾʤʤΤǤ롣äʤΤv4Ƴ
  • /etc/idmapd.conf
    • NFSv4Υǡե餷¦ȥ饤¦Ʊˤɬפ餷
    • ǤȤʤŬˡrhel6¦Ǥϲ򥳥ȥȤƥɥᥤѹrhel5¦ǤϥǥեȤǤ񤤤ƤäΤǤҤȤޤΤޤޡɥᥤ̾줵
       Domain = local.domain.edu
       Nobody-User = nobody
       Nobody-Group = nobody
      
  • export
    • /etc/exports
       /var/yum   192.168.1.1/24(rw,no_root_squash,fsid=0)
      
      • rootǤ⤤ꤿäΤno_root_squash
      • fsid=0nfs4ͭΡ饤ȤޥȥݥȤ롼ȤȤƸ褦ˤʤ롣ǤϡФ/var/yum饤Ȥ鸫<server>:/ б
    • ȿ
       exportfs -r
      
  • ӥ餻
     service rpcidmapd restart
     chkconfig rpcidmapd on
     service nfs restart
     chkconfig nfs on
    
  • ݡȤ
    • NFSv4ϻȤݡȤTCP2049
       iptables -A INPUT -p tcp --dport 2049 -j ACCEPT
      
  • ޥȤ
     mkdir /var/yum
     mount -t nfs4 <server>:/ /var/yum
    

P2V ESXi ˾褻

  • Converter 5 dz P2V
    • 󥵥ݡȤ 99% ǼԤ뤱ɵˤʤ
      • http://kb.vmware.com/kb/2007355
      • ޤǤ Linux Ȱä /etc/modprobe.conf ʤХåǤʤƤ
      • modprobe.conf ä initrd ʤmkinitrdˤΤޤǤ Linux P2V СRHEL 6 Ϥꤳˤʤäơɬפʤʤäudev ١ǾˤǧƤޤȤäƤ
  • P2V ν
    • SELinux ̵ˤƤϲ⤷ʤǤưġ Ȼפ
    • SELinux ͭʾ硢relabel ʤȥǤʤʥ̤ޤǤϵư뤱 root ǤïǤʤ
      • 󥰥桼⡼ɤǵư /etc/sysconfig/selinux disabled ѹƵươѹ򸵤ᤷơƵư龡 relabel äƥǤ褦ˤʤä
      • setenforce ̵ͭƺƵưǤɤΤ⡣fixfiles relabel ޥɤǤɤΤ⤷ʤƤʤ

P2V ˼Ԥγǧʬ

  • grub.conf kernel Ԥ rd_LVM_LV LVM Υܥ塼बꤵƤʤ
    • Converter ξ LVM ۤΤǻꤷƤޤޤ kernel panic
  • fstab LVM ޥȤԤĤäƤʤ
    • Converter ξ LVM ۤΤ UUID blkid /dev/hoge dzǧġˤ /dev/hoge ľܻ˽񤭴

NIC ؤ

ʪФ eth0 ưƤȤơ Converter P2V ǻäƤȡ NIC eth1 ˤäĤƤ롣פʪΤȤΥ󥿥եߤΤޤ޻ĤäƤ뤤eth1 ե񤱤Фɡeth0 ե򤽤ΤޤήѤΤľ

RHEL 6 modprobe.conf ǤΥ⥸塼ɤ߹ߤǤϤʤ udev ˤФ롣/etc/udev/rules.d/ ۲եǼưǧ eth* ˳ƤΤǡ򤤤롣ä⥸塼ɤ߹ߤ롣

  • /etc/udev/rules.d/70-persistent-net.rules
    • ѹ
      # PCI device 0x14e4:0x1692 (tg3)
      SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:99:a4:f3:3e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
      
      # PCI device 0x8086:0x100f (e1000)
      SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ea:f1:dc", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
      
      # PCI device 0x15ad:0x07b0 (vmxnet3)
      SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b3:e9:50", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
      
  • ѹ
    # פʤǥХ򥳥ȥȤ
    ## PCI device 0x14e4:0x1692 (tg3)
    ##SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:19:99:a4:f3:3e", ##ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    ##
    ## PCI device 0x8086:0x100f (e1000)
    ##SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ea:f1:dc", ##ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
    
    # NAME  eth0 ˽񤭴
    # PCI device 0x15ad:0x07b0 (vmxnet3)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b3:e9:50", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
    
  • ⥸塼κɤ߹ߤȥӥκƵư
    # ӥ
    service network stop
    
    # ⥸塼Υ
    rmmod vmxnet3
    
    # ⥸塼Υ
    modprobe vmxnet3
    
    # ӥγ
    service netework start
    

Last-modified: 2012-06-03 () 15:43:52 (2153d)