培训时间: 2009.11.12

  • Upload
    shayla

  • View
    67

  • Download
    7

Embed Size (px)

DESCRIPTION

超级计算平台 Linux 初级培训. 培训时间: 2009.11.12. 课程简介. 本课程为 超算平台 培训课程之一 课程内容: Linux 操作系统的初级培训 培训对象:所内所有人员 培养目标:此培训纲要针对 Linux 入门级学习,使大家能够独立安装 Linux ,并进行简单的系统维护;掌握 Linux 操作系统的相关基础知识及一些常用的命令。. 目录. 前言:超算平台简单介绍 第一章: Linux 操作系统简介 第二章: Linux 操作系统安装和基本配置 第三章: Linux 操作系统的文件系统结构 第四章: Linux 操作系统的用户管理 - PowerPoint PPT Presentation

Citation preview

  • 2009.11.12Linux

  • LinuxLinuxLinuxLinux

  • LinuxLinuxLinuxLinuxLinuxLinux

  • http://[email protected]

  • 3.638TC26002.1GHzAMD Opteron 2352 x86_6416GB2.55A950r-F2.2GHzAMD Opteron 8354 x86_6464GB0.56IOA620r-FX2.1GHzAMD Opteron 2352 x86_648GB0.4A620r-FX,2.1GHzAMD Opteron 2352 x86_6416GB0.13 10Gb/sInfiniBand5TBHDS WMS100Red Hat Enterprise Linux Server 5.3x86 Open64IntelPGIGNUC/C++ FortranACMLIntel MKLGoto BLASATLASBLASScaLapackOpen MPIMVAPICHOpenMPMPIOpenMP

  • 8

    178

  • 2009717

  • Linux Linux Linux Linux Linux Linux

  • Linux

  • Linux Linux Unix Unix Unix Linux Linux

  • Linux1991Linus TorvaldsUNIXLinuxLinusLinuxInternethackLinuxLinuxLinuxLinuxLinuxGPLGNULinuxIBMINTELCAORACLELinuxLinuxlinux1.1 Linux

  • OSI LinuxLinuxLinuxLinux LinuxLinuxMaemoAndroidChrome OSMoblin

    1.2 Linux

  • KernelShellbash,ash,pdksh,tcsh,ksh,csh,zsh.Utility1.3 Linux

  • 2.4.32 2.5.19-6.(/.-patchhttp://www.kernel.org/pub/linux/kernel/linux-2.6.31.tar.gz 1.4 Linux

  • 1.5 Linux

  • Linux

  • 2.1

  • 2.2

  • 2.3

  • 2.4Next

  • 2.5

  • 2.6U.S.English

  • 2.7

  • 2.8

  • 2.9

  • 2.10root

  • 2.11

  • 2.12

  • 2.13

  • 2.14

  • 2.15

  • 2.16

  • 2.17

  • 2.18

  • 2.19

  • 2.20

  • 2.21

  • 2.22

  • 2.23

  • 2.24

  • 2.25

  • 2.26

  • 2.27

  • 2.28Linux-Windows1

    ++++xmms winamp mplayer (:kmplayer gmplayer) ,VLC player(MPC),mplayer,kmplayerxinewindvd,powerdvdrealplayerrealplayer++++gimpphotoshopKolourpaint++++x-cd-roast, k3b,nautilusnero express,nero burning rom,roxio dvd creator++++cdemu, mountmount -t iso9660 mycd.iso /mnt/mydir -o loop),cp(cp /dev/cdrom mycd.iso)daemon tools,alcohol

  • 2.28Linux-Windows2

    ++++IDL,GDLIDLMaple,Maxima,MuPadMapleMathematica,Maxima,MathomaticMathematica Matlab,Octave(+ Gnuplot),ScilabMatlab ++++ ++(gedit,vi,emacs,kate,scite+gcc,gfortran,ifortg95tcKDevelopment,Eclipse Visual Studio++++qtiplot,scigraphicaorigin,microcal orginKmplot, gnuplot,... ++++kstar,xephemskymap,the sky,redshift, deep space explorer++++irafavis,iris,ds9ds9

  • 2.28Linux-Windows3

    ++++gnome-terminal,konsoleDOS>>cmdkonqueror,nautilus(explorer)ksysguard,gnome-system-monitor(taskmgr)sambakwikdisk, kdiskfree ,system-config-lvmwindowshwbrowserredhat network,yum,aptwindows****rpm,yum windows-installer++++kde,gnomegconf-editor, /etc/home/$username(regedit)system-config-networksystem-config-services >>/etc/rc.d msconfig

  • 2.28Linux-Windows4

    ++HTTP++firefox, mozilla,netscape,opera,konqueror firefox,mozilla,netscape,opera,ie (maxthon,..)++++pidgin() AMSN MSN+YAHOO+OICQ+ qq linuxQQ,tm++++thunderbird,mozilla mail foxmail,thunderbird,mozilla mailkmail,evolutionoutlookmail-notification gmail-notifier++ftp++ftp,lftp ftp (dos)gftp,konquerorFlashFXP,CuteFTPSecureFX++ssh++sshSecureCRT ++++kget, downloader4x, flashgotflashget,nettransport,DownThemAll (firefoxDownThemAll++P2P++emule,amule, XmuleBT azureus,Bittorrent,snark

  • 2.28Linux-Windows5

    ++++openoffice,kofficems officegedit,kwrite,kate,Kedit,vim,emacs,emeditor,Ultraedit **TEX**MikTex,WinEdit Tex,TeTex,LaTex,Kile,LyX**PDF**>>PDFAdobe Acrobat Distiller****openoffice math,kformula mathtype,****kig ****KHexEdit,ghex,hexerUltraedit,WinHex++++**PDF**acroreader,xpdf,gv,evinceadobe reader**PS,GS**gv,evince,kghostview PSAngel,gsview****BXViewer (ssreader)++++file-roller,ark tar,gzip,rarwinrar, winzip ++++(stardict)chinput,fcitx,scim abc,kcalc,Gcalctool

  • 2.29RPMYum

  • 2.30yum

    yumyum = Yellow dog Updater, Modified//RPMyum1yum check-update2yum update3yum install 4YUMyum remove 5: yum search yum search pidgin ; yum install pidgin ; yum remove pidgin

  • #cd /etc/sysconfig/network-scripts #vi ifcfg-eth0 IP #vi ifcfg-eth1 IP IP # /etc/init.d/network restart ifcfg-eth0 ifcfg-eth1 GATEWAY=IP DNS /etc/resolv.conf nameserver DNSIP

    2.31 Linux-

  • Linux

  • (inode).

    3.1

  • mountmount NTFSFAT LinuxLinuxls NFS 3.2

  • ext2 ext2LinuxLinuxext2LinuxRedhatFedora ext3 ext3ext2Linuxext2ext2undelete ext3 ext2 ext3 is a Journalizing file system for Linuxext3Linuxext3undelete RedhatFedoraext3reiserfs reiserfs undeletereiserfs 3.3 Linux

  • 1024 Bytes = 1 KB; 1024 KB = 1 MB; 1024 MB = 1 GB; 1024 GB = 1 TB; 1024 TB = 1 PB; 1024 PB = 1 EiB 3.4

    FilesystemFile Size LimitFilesystem Size Limitext2/ext3 with 1 KiB blocksize16448 MiB (~ 16 GiB)2048 GiB (= 2 TiB)ext2/3 with 2 KiB blocksize256 GiB8192 GiB (= 8 TiB)ext2/3 with 4 KiB blocksize2048 GiB (= 2 TiB)8192 GiB (= 8 TiB)ext2/3 with 8 KiB blocksize (Systems with 8 KiB pages like Alpha only)65568 GiB (~ 64 TiB)32768 GiB (= 32 TiB)ReiserFS 3.52 GiB16384 GiB (= 16 TiB)ReiserFS 3.6 (as in Linux 2.4)1 EiB16384 GiB (= 16 TiB)XFS8 EiB8 EiBJFS with 512 Bytes blocksize8 EiB512 TiBJFS with 4KiB blocksize8 EiB4 PiBNFSv2 (client side)2 GiB8 EiBNFSv3 (client side)8 EiB8 EiB

  • Linuxmkfs /dev/sdb #fdisk /dev/sdb /dev/sdb1 #mkfs t /dev/sdb13.5

  • 3.6 Linux

  • 3.6 Linux

    /Linux/binBinaryls,cp,SHELLbash/bootvmlinuz,initrd.img/devsda/etcPasswd/etc/x11X Windows System/home/lib/lib64) /bin/sbinlibrary/mnt/mnt/cdrom/opt/procPS/root

  • 3.6 Linux

  • ASCII -rw-r--r-- 1 root root 39599 Mar 8 12:15 x -rwxrwxrwx 1 root root 46888960 Dec 9 2005 x.shd drwxr-xr-x 2 root root 4096 Aug 2 2006 bin.b brw-rw---- 1 root disk 3, 1 Jan 30 2003 hda1c crw------- 1 root root 4, 1 Jul 31 13:49 tty13.6.1 Linux

  • [root@localhost ~]# ls -lih 104K 2408830 drwxr-xr-x 2 root root 4.0K 04-21 12:46 mkuml-2004.07.17 2408260 drwxr-xr-x 2 root root 4.0K 04-21 22:15 mydir 2408258 lrwxrwxrwx 1 root root 7 04-21 22:16 sun001.txt -> sun.txt 2408263 -rw-r--r-- 2 root root 39K 04-20 14:17 sun.txt inode inode U ... ... inodeBlockBlockinodeinodeinodeinode 3.6.2 Linux

  • [root@zhz home]# ls -ltotal 32drwxrwxrwx 38 down root 4096 Jul 5 19:09 downdrwx------ 9 glh glh 4096 Mar 26 19:08 glhdrwx------ 4 lei lei 4096 Mar 21 08:40 leidrwxr-xr-x 5 root root 4096 Apr 12 2006 softwareLinux 9 (Ower)rwx (Group)rwx (Other)rwx - 3.6.3 Linux

  • Linux

  • LinuxLinux Linux FTPweb 4.1 Linux

  • user Linux Linux(user),Linuxgroup groupuser 4.2 Linux

  • user /etc/passwd user /etc/shadow user

    group /etc/group group /etc/gshadow group4.3 Linux

  • useradd adduser userdel passwd usermod usermod pwconv /etc/passwd /etc/shadow pwck pwck/etc/passwd /etc/shadow pwunconv pwcov /etc/shadow /etc/passwd /etc/passwd /etc/shadow finger id UIDGID chfn su sudo sudo execute a command as another usersu sudo sudo root root rootvisudo /etc/sudoers visudo visodo /etc/sudoers vi /etc/sudoers sudoedit sudo 4.3.1 Linux

  • groupadd groupdel groupmod groups grpck/grpconv /etc/group/etc/gshadow /etc/gshadow /etc/gshadow grpunconv /etc/group /etc/gshadow /etc/group,gshadow4.3.2 Linux

  • /etc/skel /etc/skelroot/etc/skel .file/etc/skel/etc/skel useradd adduser useruser /etc/passwd /etc/skel chown 4.3.3 Linux

  • /etc/default/useradd useradd # useradd defaults file GROUP=100 HOME=/home /home INACTIVE=-1 -1 EXPIRE= SHELL=/bin/bash SHELL SKEL=/etc/skel adduser4.3.4 Linux

  • /etc/login.defs /etc/login.defs UIDGIDroot Fedora /etc/logins.defs MAIL_DIR /var/spool/mail /var/spool/mailmail PASS_MAX_DAYS 99999 PASS_MIN_DAYS 0 PASS_MIN_LEN 5 PASS_WARN_AGE 7 UID_MIN 500 UID500 UID 500 UID_MAX 60000 UID60000 GID_MIN 500 GID 500 GID_MAX 60000 CREATE_HOME yes 4.3.5 Linux

  • umask umask ,umask , -rw------- drwx--x--x umask 666666umask umask 777777umaskFedora /etc/login.defsCREATE_HOME yes UMASK 077umask077 077/home777-077=700 rwx------ 4.3.6 Linux-umask

    umask 067156245334423512601700

  • setuidsetgid setuid setgidrootrootsetuidsetgid setuid4000setgid2000 setuidchmod4 [root@localhost ~]# chmod 4755 /bin/rm rm4755 setuid -rwsr-xr-x 1 root root 26556 Feb 19 2003 /bin/rm setgid 2000 setuidsetgidsetuidsetgid (4000+2000=6000),chmod 4.3.7 Linux-setuid/gid

  • test,workgroup#groupadd u 1000 workgroup#useradd u 1000 g 1000 m /home/test s /bin/bash testtest #userdel test #rm rf /home/test4.3.8 Linux

  • Linux

  • :ls cd dir :cat more less :mkdir rmdir :touch vi rm cp mv ln tar gzip gunzip whereis whatis 5.1

  • ls(list) ls[] []5.1.1 ls

  • cd (change directory)[test@linux home]$ cd test test[test@linux test]$ cd .. [test@linux home]$ cd /[test@linux /]$ cdcd~)[test@linux test]$ cd /usr/bin/usr/bin5.1.2 cd

  • mkdir(make directory) mkdir [] [test@linux test]$ mkdir dir dir [test@linux test]$ mkdir -p dir1/dir2 dir1dir1dir2dir1/dir1/dir2.rmdir(remove directory)rmdir [] [test@linux test]$ rmdir dir dir [test@linux test]$ rmdir p dir1/dir2 dir1dir2dir15.1.3 mkdirrmdir

  • cp(copy)cpcp[][test@linux test]$ cp test1.txt test2.txt test1.texttest2.txt[test@linux test]$ cp test3.txt /tmp test3.txt/tmp[test@linux test]$ cp r test1( test2( -r5.1.4 cp

  • rm[] [test@linux test]$ rm myfiles [test@linux test]$ rm * -f [test@linux test]$ rm f *.txt txt -r5.1.5 rm

  • -i [test@linux test]$ rmi * rm:backup: is a directory rm : remove myfiles.txt ? Y ,YN rm-f5.1.5 rm-i

  • ,cat[][test@linux test]$cat test.txt test.txt[test@linux test]$cat test.txt | more test.txt[test@linux test]$cat test.txt >>test1.txt test.txttest1.txt[test@linux test]$cat test.txt test2.txt >readme.txt test.txttest2.txtreadme.txt5.1.6 cat

  • moremoreQ [test@linux test]$ more /etc/named.conf etc/named.conf lsmore [test@linux etc]$ ls -al | more etcQ5.1.7 more

  • lessmorelesslessQ [test@linux etc]$less named.conf /etc/named.conf [test@linux etc]$ls -al | less /etcQ5.1.8 less

  • headhead[][root@linux root]# head -10 /etc/passwd/etc/passwd/10tail tail[] [root@linux root]# tail -10 /etc/passwd /etc/passwd/10

    5.1.9 headtail

  • [] [test@linux dir1]$ mv a.txt ../ a.txt [test@linux dir1]$ mv a.txt b.txt a.txtb.txt [test@linux dir1]$ mv dir2 ../ dir25.1.10 mv

  • pwd [test@linux test]$ pwd /home/test test/home/test 5.1.11 pwd

  • Findfind [] [] [root@linux root]# find / -name httpd.conf httpd.conf /etc/httpd/httpd.conf [root@linux root]# find /etc name httpd.conf /etchttpd.conf /etc/httpd/httpd.conf

    5.1.12 find

  • grep[] [root@linux root]# grep linux test.txt test.txtlinux [root@linux root]# rpm -qa | grep httpd rpmhttpd who | grep tty15.1.13 grep

  • /touch [test@linux test]$ touch * [test@linux test]$ touch d 20070806 test test20070806 [test@linux test]$ touch abc abc5.1.14 touch

  • who/w[] [root@linux root]# who root tty1 1 test pts/0 15.1.15 whow

  • tar/binUnixtargzipxxx.tar.gz(xxx.tgz)tar-ctar-v-f-zgzip-t-xtar5.1.16 tar

  • [root@linux test]# tar -cvf test.tar *test.tar,.tar[root@linux test]# tar -zcvf test.tar.gz *test.tar,gzip[root@linux ljr]# tar -tf test.tartest.tar[root@linux test]# tar -xvf test.tar test.tar[root@linux test]# tar -zxvf foo.tar.gz foo.tar.gz5.1.16 tar

  • date/[root@linux root]# date 121010232004121010232004 [MMDDhhmmYY][root@linux root]# cal [root@linux root]# clock 5.1.17 datecalclock

  • cal(calendar)cal [] [root@linux root]# cal [root@linux root]# cal 4 2004 20044[root@linux root]# cal -y 2003 20035.1.18 cal

  • vi vi filename : vi +n filename n vi + filename vi +/pattern filenamepattern vi -r filename vifilename vi filename....filename :k nk:n :j nj:n :h nh:n :l nl:n gg G

    5.1.19 vi

  • . Ctrl+u Ctrl+d Ctrl+f Ctrlb z"-" z"." nznn . i I a A o O r RESC s S ncwnCW nCC 5.1.19 vi

  • .n1,n2 co n3n1n2n3 n1,n2 m n3n1n2n3 n1,n2 d n1n2 w e filenamefilename x qvi q!vi !commandshellcommand n1,n2 w!commandn1n2commandn1n2command r!commandcommand5.1.19 vi

  • . ndwndWn-1 d0 d$ nddn-1 xXxX Ctrl+u . /patternpattern ?patternpattern n N s/p1/p2/gp1p2 n1,n2s/p1/p2/gn1n2p1p2 g/p1/s//p2/gp1p2 5.1.19 vi

  • vimemacs k c-p j c-n h c-b l c-f bm-b wm-f (m-a )m-e c-fc-v c-bm-v ggm-< Gm-> 0c-a $c-e :w c-x c-s :x|:wq|QQc-x c-s c-x c-c :q!|ZQc-x c-c xc-d dwm-d ddc-k v move xc-@ move c-w pc-y yyc-@ move m-w uc-x u c-rc-x u c-x u %s//c-@ c-m-% c-n|c-pm-/

    5.1.20 Emacsvim

  • dmesg df du free 5.2

  • 5.2.1 dmesg

  • 5.2.2 df

  • du [] 5.2.3 du

  • 5.2.4 free

  • lftp ssh netstat ping traceroute route

    5.3

  • lftp ls cd lcd ascii ASCII binary getmget putmput quitftpmirror mirror -R

    lftp5.3.1 lftp

  • ssh ssh /IP /IPIP ssh X Wndow scp 5.3.2 ssh

  • netstat 1. Linux 2. netstat[-acCeFghilMnNoprstuvVwx][-A][--ip] 3. -a--allSocket -c--continuous -e--extend -g--groups -i--interfaces -l--listeningSocket -n--numericIP -r--routeRoutingTable -s--statistice -t--tcpTCP -u--udpUDP -v--verbose -w--rawRAW5.3.3 netstat

  • ping /IP -c -f -I -l -q -r -s 568ICMP64ICMP 5.3.4 ping

  • ping traceroute[root@linux ~]# traceroute [-nwig] IP -n IP -w ...5 -i ADSLppp-ippp0ppp1 -g -i-ggatewayIP [root@linux ~]# traceroute -n tw.yahoo.com traceroute to tw.yahoo-ap1.akadns.net (203.84.202.164), 30 hops max, 38 byte packets 1 61.59.121.1 42.174 ms 41.690 ms 41.058 ms 2 139.175.172.2 40.962 ms 41.978 ms 40.973 ms 3 192.72.122.130 40.983 ms 41.930 ms 41.003 ms 4 139.175.58.210 42.956 ms 41.997 ms 42.337 ms 5 139.175.58.153 47.591 ms 47.972 ms 48.748 ms 6 139.175.56.30 48.193 ms 47.970 ms 47.986 ms 7 139.175.57.94 47.959 ms 47.951 ms 47.985 ms 8 139.175.56.138 48.363 ms 47.586 ms 47.995 ms 9 139.175.58.42 49.256 ms 50.668 ms 47.490 ms 10 61.58.33.133 201.882 ms 201.565 ms 200.973 ms 11 61.58.33.50 199.910 ms 199.019 ms 198.961 ms 12 203.84.200.226 202.391 ms 202.567 ms 209.283 ms

    5.3.5 traceroute

  • IP route [-f] [-p] [Command] [Destination] [mask Netmask] [metric Metric] [Gateway] dev [Interface] -f -p add Command (Add/Change/Delete/Print) Destination mask Netmask metric Metric 1 9999() Gateway IP 5.3.6 route

  • Linux

  • OpenOffice WWWapachehttpdapachehttpd6.1

  • rootFedoraRedhathttpd /etc/init.dhttpd/etc/init.d/httpd httpd35[root@localhost ~]# chkconfig --level 35 httpd onhttpd6.1.1

  • IDPID)IDPPID)IDUIDGIDRSZCPU6.1.2

  • httpd6.1.3

  • Linuxpskillpgrep 6.2

  • ps : ps -eLf ps axms ps -ejH ps axjfl u j f a x r 6.2.1 ps

  • USER PID ID PPID ID%CPU CPU%MEM NI NICECPU VSZ RSS TTY IDWCHAN START TIME CPUCOMMAND 6.2.1 ps aux lax

  • STAT D Uninterruptible sleep (usually IO)R S T W 2.6 X Z < N L s l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do) + WCHAN START TIME CPU COMMAND 6.2.1 ps aux

  • pgrep pgrep -l ID -o ID -n ID [root@localhost ~]# pgrep -l httpd 4557 httpd 4560 httpd 4561 httpd 4562 httpd6.2.2 pgrep

  • kill killallpkillxkill mysqlpkill mysqld killall mysqld kill6.3 kill killallpkill

  • killps pgrep kill ID 15 9 [root@localhost ~]# pgrep -l gaim 5031 gaim [root@localhost ~]# kill -9 5031 6.3.1 kill

  • killall killall killall pspgrep pspgrep [root@localhost test]# pgrep -l gaim 2979 gaim [root@localhost test]# killall gaim 6.3.2 killall

  • pkill killall killpkill [root@localhost test]# pgrep -l gaim 2979 gaim [root@localhost test]# pkill gaim6.3.3 pkill

  • ps toptop -b -c -d N -d 55 -i -n NUM -n 5top5 -p PID IDPID -q -s -S CPU 6.4 top

  • yumLs a,-lmFcolor