Linux/

Top / Linux /

memo


  • ͤߤʬΥʤȤ


createrepo

  • DVD鲶ݥȥĤ롣ǥȤޤ뤴ȥ˥ԡơԡե뷴ˤcreaterepo
  1. ޥ
    mkdir /mnt/RHEL54
    mount -t iso9660 /dev/dvd /mnt/RHEL54
  2. ԡϤɤǤ⤤ɡҤȤޤ㡣
    mkdir -p /var/pub/RPM
    cp -rv /mnt/RHEL54 /var/pub/RPM
  3. createrepo󥹥ȡ
    rpm -ivh /var/pub/RPM/RHEL54/Server/createrepo-0.4.11-3.el5.src.rpm
  4. repodataĤ롣ۤȤServerȤVTȤ̡ΥݥꥷDZѤ٤ʤݤʤΤǤäˤ㤦ʤgroupinstallϻȤʤʤ
    createrepo -v /var/pub/RPM
    • λdzhttpǸʤΤǤХݥȥϴ
    • repoեbaseurlȤưʲ򵭽Ҥ
      file:///var/pub/RPM
    • groupinstallȤ֤ǥݥȥʤ顢ServerClusterClusterStorageVT줾ˤ̡createrepoơrepoե̡˻ꤷʤȤʤʤ֤
      • createrepo -g ǵxmlեꤹ롣ServerФ
        createrepo -g /var/pub/RPM/RHEL54/Server/repodata/comps-rhel5-server-core.xml /var/pub/RPM/RHEL54/Server
      • repodata/comps-rhel5-<hoge>.xml ˥롼פξ󤬤褦졢xml礷ꤳսǺѤΤʡɤʤ
  5. Ȥ˥åä
    yum clean all
  6. Τɬפʤ
    1. httpdΥ󥹥ȡʾfile:///ˤyum뤫뤤rpmľܡ
    2. httpdȵư
      • /var/pub/RPM롣/etc/httpd/conf.d/RPM.confȤäƵ
        Alias /RPM "/var/pub/RPM"
        <Directory "/var/pub/RPM">
         Options Indexes
        </Directory>
    3. repoեĤ

swapout/pageout

  • åץ
    • ץȥåפ
  • ڡ
    • ­ʤڡʬåפ
  • UNIX/Linuxΰ㤤
    • LinuxˤϥåץȤϤʤ

mysql

rootΥѥ

set password for root@localhost=password('<password>');

Хåå

  • פȤ
    • DBΤ
      mysqldump -u root <database-name> > hoge.dmp
    • mysqldump -u root -x --all-databases > hoge.dmp
  • פ᤹
    • DBΤ
      mysql -u root <database-name> < hoge.dmp
    • mysql -u root -p < hoge.dmp

68kb_v2

  • mysql68kbv2ȤƤ
  • ʤ̤
    • index.php/admin User ֤ˤȥ顼
      An Error Was Encountered [ 500 ]
      Unable to locate the models file: orders/orders_model.php
    • Add article Save Ƥ 404
      • ⤽ articles ʤƥǥ쥯ȥǤƤʤ
  • /var/log/httpd/error_log ˤ
    [Fri Sep 30 10:56:39 2011] [error] [client 192.168.0.11] PHP Fatal error:
     Call to a member function parse() on a non-object in /var/www/html/68kb/system/68kb/libraries/Template.php on line 266,
     referer: http://station11/68kb/index.php/admin/kb/articles
    • ĽϤ
       $result = $this->_ci->simpletags->parse($this->_body, $this->_data, array($this->_ci->events, 'parser_callback'));
  • ɬפʥե뤬̵ɤʤ

68kb_v1

  • äȤɥɤФǤ

yum

  • Transaction TestmountΰӤäݤ
  • nfsΰޥȺѤ߾֡ĥ⡼ȥȤ˥ǤʤʥݡȤĤƤȤåȥ֤ȤˤӤ줺˸Ǥޤ
    • Ǥޤä֤ľˤ kill -9 yum 򻦤 /var/run/yum.pid ɬפ

н

  • ȯ褹ʤƵưФ褤
  • ƻˤʤ⡼ȥȤnfsΰ˥Ǥ褦ꤷʤʤ
    • ޥȤȤƤ⤤ɥޥΰlsǤǤޤΤ񤷤󤸤ʤ

nfs

  • 饤Ȥ⡼ȥȤؤΥݡȥν
    • portmap111Ū
    • NFSv42049Ū
    • NFSv3äʥ⡼Ȥ/etc/sysconfig/nfs˰¸ݡȡ

du

  • ̤礭ΤĴ٤شĶ
    du -sk * .??* | env LANG=C sort -nr | lv
    • sort env LANG=C ǤɬפϤΤ

lftp

  • lftp <username>@<servername>
  • ե
    ޥ
    cd⡼ȤΥǥ쥯ȥư
    lcdΥǥ쥯ȥư
    ls⡼ȤΥեꥹɽ
    !lsΥեꥹɽ
    pwd⡼ȤΥȥǥ쥯ȥɽ
    !pwdΥȥǥ쥯ȥɽ
    rm⡼ȤΥե
    • ץȤϤĤΤȤäʤΤǾά
    • !ʤlǤ⤤äݤɤΤˤ
  • åץɤȥ
    ޥ
    put <filename>ĤΥե򥢥åץɡ磻ɥɤϻȤʤ
    get <filename>ĤΥեɡ磻ɥɤϻȤʤ
    mput <filename> [<filename> ...]ʣΥե򥢥åץɡ磻ɥɻѲ
    mget <filename> [<filename> ...]ʣΥեɡ磻ɥɻѲ
  • λ
    exit

script

  • 褯Ȥ
    for i in $(seq 1 100)
     do 
      touch hoge${i}
     done
    • 饤ʤˤʤ餳
      for i in $(seq 1 100); do touch hoge${i}; done;
    • ۤȤϤ֤ i ȤȤΤĤʤ

dd

dd if=<inputfile> of=<outputfile> bs=<blocksize> count=<count>
  • ȤץȤ
    <inputfile>ϥե롣/dev/zero ѽФäݤ
    <outputfile>ϥե
    <blocksize>֥åñ̤Ȥ롣1mȤ
    <count>֥åͤΥե뤬ǤΤǤƤȤĴ
    • ֥åäƤΤϰ٤i/oǰǡ̡ǥեȤ512ʤФȡˤǡХåե512kΥǡޤȥϡɥǥ˽񤭹।᡼礭ΨϤ롣ŬͤϥǥХˤäư㤦äݤ衣

sl

  • lsΤslˤ㤦Ȥ褯͡
  • slޥɤͭ̾ʥ硼ޥɤ衪 ְ㤨släǤääȤˤäȤۤäꤹ衪 ֤ʤƵޤǤȤȲꤿʤ뤱ɤ͡

sl򥤥󥹥ȡ뤹

  1. &ref(): File not found: "sl.tar" at page "Linux/";ɤ
  2. ɤΤह
    tar xvf sl.tar
  3. ư
    cd sl
  4. ӥɤɬפʥѥå򥤥󥹥ȡ뤹
    yum install ncurses-devel
  5. äԽ
    vi Makefile
    • ʲ̤ˤ
      • Խ
        sl: sl.c sl.h
        	$(CC) $(CFLAGS) -o sl sl.c -lcurses -ltermcap
        #	$(CC) $(CFLAGS) -o sl sl.c -lcurses
      • Խ
        sl: sl.c sl.h
        #	$(CC) $(CFLAGS) -o sl sl.c -lcurses -ltermcap
        	$(CC) $(CFLAGS) -o sl sl.c -lcurses
  6. ӥɤ롣ٹǤ뤱̵뤷
    make
  7. ԡ
    cp sl /usr/local/bin

ޥ

  • Ĥ -l Ȥ -a Ȥ -F ȤѰդƤ衪 SL衪

vi

ʸɴط

  • ~/.[exrc|vimrc]ˤǤ⡣ξǤ⤤ɡ
    set encoding=hoge
    set fileencoding=hoge
  • ǧ
    • ߤʸ
      :set enc?
    • եʸ
      :set fenc?
    • ưȽ̤ʸ
      :set fencs?
  • ʸɤꤷƳʤ
    :e ++enc=hoge

ɥʬ

  • ľʬ
    :vsp
    [Ctrl+w]-[v]
  • ʿʬ
    :sp
    [Ctrl+w]-[s]
  • ̤ư
    [Ctrl+w]-[||||h|j|k|l]
  • ̤Ĥ
    • Τ̤Ĥ
      :q
    • Ĥ
      :qall
    • Τ̰ʳĤ
      :only
  • ư
    • ޥɤϥΤ륦ɥФƼ¹Ԥ
    • ХåեͭƤΤǥɥ֤ǤԤڤǤ

ʣեԽ

  • ʣΥեϤ
    vi hoge piyo
  • եڤؤ
    • Υեڤؤ
      :n
    • Υեڤؤ
      :rew
  • ư
    • ɥʬȤ߹碌Ǥ

x

  • xưʥޥͷ٤
    x
  • Ǿxưʥߥʥ¹Ԥ줿֡
    initx
  • xΥ饤ȥӥΩ夲
    nohup metacity
    nohup gnome-panel
    nohup nautils
    • nohupʤƤפʵ뤱̤ǧ

texinfo

info hoge
  • man suϸŤäݤ

bash

  • [esc]-[.]historyΰäƤ롣ʣϲ
    cat /etc/passwd
    vi [esc]-[.]
  • [^<hoge>^<fuga>]ǤҤȤϥޥɤΰִƼ¹ԤǤ
    cat ~/flie1
    ^li^il
  • history饤󥯥󥿥륵ǰĥäƤ
    cat ~/file1
    cat ~/file2
    [Ctrl+r] ca
    • ˰ưˤϸˤ⤦[Ctrl+r]

font

  • [ƥ]-[]-[ե]-[ܺ]-[եȤΥե˰ư]dzե *.ttf ꤳ
    • ƥ󤤤ä
    • otfϤᤸʤʡ狼ʤ
    • ޥɥ饤󤫤ˤϤɤ

useradd

  • passwd ǤѥɤϤ useradd ȤɤΤȤ
  • ץȽȤäݤ

[] passwd stdin Ϥ

useradd <username>
echo <password> | passwd --stdin <username>
  • ϥå岽ȤsaltͤpasswdǤˤǤΤǥޡ

[] useradd -p ǥϥå岽ѥɤϤ

  • ⤽̵ԤǤǤ⤤󤸤ʤΡΤǤФ
  • mkpasswd Ȥʤ饤󥹥ȡ뤬ɬסexpectѥå
    yum install expect
  • useradd
    useradd -p $(openssl passwd -1 -salt $(mkpasswd -s 0 -l 8) <password>) <username>
  • ϥåʸsaltͤ [0-9a-zA-Z]{8} ΥäݤʸϤ
    • salt˵ϤäƤ礦֤äݤΤ [-s 0] ʤʤǤ $ ФƤ饢ȡ
    • ʸϤɤΤޡȡ
      • [openssl rand -base64 8] Ǥġ
      • mkpasswd ΥץȤ餽Ȥǥ뤤

public_html

  • SELinux Τ /home/*/public_html Apache Ǥ 403 ˤʤ
    /sbin/restorecon -R /home/hoge

find

  • inodeֹǤ⸡Ǥ
    find <search-path> -inum <inode-number>

𥵡

ʥߥåDNSӥ

  • ʬΥФIPǤϤʤơhogehoge.dyndns.org Ȥ fugafuga.dip.jp ȤDZѤǤ褦ˤǤ륵ӥ
  • ʬβȤΥХIPɥ쥹ȾߤʥɥᥤɳդƤ

ӥ

ưɬ

  • IPʤϿDNSΥ쥳ɤ򹹿ɬפϤʤɡ̲ȤưŪIPĶIPɥ쥹Ѥ뤿ӤDNSϿιɬ
  • IPǤ⡢̵ξ嵭ӥξ硢֥󤬤ʤȥȾä뤳Ȥ
  • ŪIPĶˤưŪIPĶˤŪ˥󤷤Ͽιɬ

ưˡ


Last-modified: 2011-10-12 () 22:19:29 (2291d)