คู่มือประกอบการอบรม ubuntu administrator.pdf

Upload: kittipong-suwannaraj

Post on 02-Mar-2016

57 views

Category:

Documents


4 download

DESCRIPTION

Ubuntu Server

TRANSCRIPT

  • ()

    26 .. 2554

    www.lanna-oss.org

  • 2/37

    50% Server

    Ubuntu Administrator Ubuntu Server

    Ubuntu Server Text Mode Text Mode Server

    (www.lanna-oss.org) 08-7185-0920

  • 3/37

    ubuntu 4 6 7 Ubuntu Server 10 command line 23 vi 34 shell script 35 37

    (www.lanna-oss.org) 08-7185-0920

  • 4/37

    Mac

    GUI Graphics User Interface mouse

    Unix (Linus Benedict Torvalds) Unix (http://en.wikipedia.org/wiki/Linus_Torvalds)

    . (Richard Matthew Stallman) GNU copy left copy right Driver Printer (http://en.wikipedia.org/wiki/Richard_Stallman)

    (www.lanna-oss.org) 08-7185-0920

  • 5/37

    (Mark Shuttleworth) (Canonical)

    I am what I am because of who we all are. (http://www.ubuntu.com/project/about-ubuntu)

    Server 50% Server Serve Ubuntu Linux Ubuntu Ubuntu Desktop Ubuntu Server Ubuntu help.ubuntu.com

    (www.lanna-oss.org) 08-7185-0920

  • 6/37

    Hardware Hardware Hardware Kernel (Application)(Hardware) Kernel www.kernel.org

    shell x-windows shell x-windows x-windows Gnome(www.gnome.org) Ubuntu

    Application Application

    (www.lanna-oss.org) 08-7185-0920

  • 7/37

    FAT , FAT32, NTFS EXT2 , EXT3, EXT4 Unix DOS 2 1. (File Name) Case Sensitive Mydata mydata Case Sensitive copy FAT32 NTFS External drive copy copy FAT32 NTFS

    2. (Permission)

    DOS FAT32 NTFS (Read only) (Hidden File)

    (www.lanna-oss.org) 08-7185-0920

  • 8/37

    Unix (Multi User)

    (Owner) (Group) Other

    3 read write execution (run program)

    (www.lanna-oss.org) 08-7185-0920

  • 9/37

    ls -l ls -l ternmal ouychai@ouychai-desktop:~/C$ ls -l total 44 -rw-r--r-- 1 ouychai ouychai 864 2009-12-13 10:29 myfirsttime.c -rw-r--r-- 1 ouychai ouychai 0 2009-12-13 10:29 myfirsttime.c~ -rwxr-xr-x 1 ouychai ouychai 8260 2010-01-15 06:47 test2 -rw-r--r-- 1 ouychai ouychai 88 2010-01-15 06:46 test2.c -rw-r--r-- 1 ouychai ouychai 209 2010-01-15 06:45 test2.c~ -rwxr-xr-x 1 ouychai ouychai 8260 2010-01-15 06:47 test3 -rw-r--r-- 1 ouychai ouychai 84 2010-01-15 06:47 test3.c -rw-r--r-- 1 ouychai ouychai 84 2010-01-15 06:46 test3.c~

    ouychai@ouychai-desktop:~/C$ ouychai ouychai ouychai ouychai permission

    (permission) drwxrwxrwx d Directory Directory r Read w Write x Execution -

    (www.lanna-oss.org) 08-7185-0920

  • 10/37

    Ubuntu Server

    ubuntu Server BIOS boot CD ROM boot

    1 English

    (www.lanna-oss.org) 08-7185-0920

  • 11/37

    2 2 Install

    Ubuntu Server Enter

    (www.lanna-oss.org) 08-7185-0920

  • 12/37

    3

    4 Asia

    Other

    (www.lanna-oss.org) 08-7185-0920

  • 13/37

    5 Asia

    6

    (www.lanna-oss.org) 08-7185-0920

  • 14/37

    7 Keyboard Layout

    No

    8 USA

    (www.lanna-oss.org) 08-7185-0920

  • 15/37

    9 keyboard USA

    10 IP DHCP

    (www.lanna-oss.org) 08-7185-0920

  • 16/37

    11 hostname

    12

    Domain name

    (www.lanna-oss.org) 08-7185-0920

  • 17/37

    13 Disk Guided use entire disk

    and set up LVM

    14 LVM

    Yes

    (www.lanna-oss.org) 08-7185-0920

  • 18/37

    15 Harddisk Continue

    16 Yes

    (www.lanna-oss.org) 08-7185-0920

  • 19/37

    17 login

    18

    (www.lanna-oss.org) 08-7185-0920

  • 20/37

    19 folder home

    No

    19 proxy

    (www.lanna-oss.org) 08-7185-0920

  • 21/37

    20 Install security updates

    automatically

    21 Server package

    (www.lanna-oss.org) 08-7185-0920

  • 22/37

    22

    CD Continue

    (www.lanna-oss.org) 08-7185-0920

  • 23/37

    command line

    command line Ubuntu Server login command line command line

    Unix Case sensitive case sentsitive command .....

    ls ( dir DOS) list ls [option] [file]option ls -l Long Format Permission -a -F / Directory * execute ls l ls -al ls -F

    adduser User Unix,Linux adduser -g (group) -d (Directory) (User) adduser -g root -d /home/user1 user User Login user1 root

    useradd User Unix,Linux ( adduser) useradd -g (group) -d (Directory) (User) useradd -g root -d /home/user1 user User Login user1 root

    userdel User Unix,Linux userdel [option] (Username)

    (www.lanna-oss.org) 08-7185-0920

  • 24/37

    userdel -r root user1 User Login User1 -r Home Directory User1 passwd User Unix,Linux passwd [Username] passwd user1 ( User1 User Unix Login )

    alias Unix,Linux ( SET DOS RUN ) alias [=] alias copy=cp copy cp

    bash Bourne again shell Unix,Linux bash bash [Enter] ( Bourne again shell)

    bc Unix,Linux bc [-lwsqv] [option] [file] bc [Enter] 1+2 [Enter] 1^2 [Enter] a=3 [Enter] b=4 [Enter] a*b [Enter] x=2;y=5;x+y[Enter] [Ctrl-d] : Install Packet

    cp ( copy DOS) copy cp source target #cp test.txt /home/user1

    cal Unix,Linux cal

    (www.lanna-oss.org) 08-7185-0920

  • 25/37

    cal [Enter]( )cal -y [Enter]( )

    cat File Unix,Linux ( Type DOS) cat cat /home/user1 | more /home/user1

    C Compiler Compile C Unix,Linux ( Type DOS) cc [filename] cc /home/user1/industry.c Compile C industry.c Directory /home/user1

    cd Change Directory Unix,Linux ( CD DOS) cd [directory] cd /etc [Enter] Directory etccd ..[Enter] Directory 1

    chfin Change your finger information Unix,Linux ( User ) chfn [username] chfn User1 User1

    chgrp Change Group Unix,Linux () chgrp [-chfRv] (Group) (File) chgrp root /root/* Group /root Group root

    chmod Change Mode Unix,Linux ()

    (www.lanna-oss.org) 08-7185-0920

  • 26/37

    chmod [] (File) test chmod 754 test chmod go +r-w test chmod o-r * Mode rwx = 7 ; rw - =6 ; r-x =5 ; r- - = 4 ; - wx = 3 ; - w - = 2 ; - - x = 1 ; - - = 02 1.2. 2 (1 ) User Group Other = ugo go-r-w+x Run -rwx rwx rwx = Read Write Execute 111 101 100 = 754 Group Execute

    chown Change Owner Unix,Linux () chown [] ( File) chown user1 filename filename User1chown -R user1.root dirname Sub dirname.

    chsh chsh Unix,Linux ( Shell User) chsh [Username] chsh user1 [Enter] /bin/bash [Enter]

    clear clear Unix,Linux ( cls dos) clear clear [Enter]

    cal Unix,Linux cal cal [Enter]( )

    (www.lanna-oss.org) 08-7185-0920

  • 27/37

    cal -y [Enter]( )

    mesgmesg status terminalmesg y terminal mesg n terminal

    date date 17 May 2004

    df df Unix,Linux () df [option] [file] df [Enter]

    dmesg dmesg Unix,Linux ( Boot) dmesg dmesg | more [Enter] Linux Driver CD-Rom

    echo echo Unix,Linux ( ECHO DOS) echo () echo my name is user1echo Hello > /dev/tty2 Hello 2

    ed ed Unix,Linux ( Text file edlin DOS) ed (fileName) ed /home/user/test ( q)

    (www.lanna-oss.org) 08-7185-0920

  • 28/37

    pico vi emacs

    emacs emacs Unix,Linux ( Text file ) emacs (fileName) emacs /home/user/test (help Ctrl - h ; Ctrl - x Ctrl - c)

    exit exit Unix,Linux ( ) exit exit

    finger finger Unix,Linux ( User Login Who ) finger [username] finger user1 user1

    fsck fsck Unix,Linux ( Linux file system Scandisk Dos) fsck [option] /sbin/fsck -a /dev/hd1

    ftp ftp Unix,Linux (- ) ftp (IP or Name of FTP Server ) ftp 132.209.1.2 [Enter]

    Login:anonymous , Password: [email protected] ls - ; pwd -dir. ;cd - dir ;lcd - local dir ;mput* - ;mget ;bye -

    (www.lanna-oss.org) 08-7185-0920

  • 29/37

    grep grep Unix,Linux ( ) grep (option) grep -i ftp /etc/test "ftp"- /etc/test

    groupadd groupadd Unix,Linux ( User) groupadd (GroupName ) #groupadd staff User Staff

    groupdel groupdel Unix,Linux ( User) groupadd (GroupName ) #groupdel staff User Staff

    gzip/gunzip gzip/gunzip Unix,Linux () gzip gunzip (-cdfhlLnNrtv19 ) [file] #gzip -9vr /home/samba/* Sub /home/samba .gz#gunzip -dvr /home/samba/* .gz Sub /home/samba

    halt halt Unix,Linux () halt [-n] [-w] [-d] [-f] [-I] [-p] #halt Shutdown ; init0 , reboot

    history history Unix,Linux ( Command line F7 DOS Dos key) history [n] [-r wan [filename] ]

    (www.lanna-oss.org) 08-7185-0920

  • 30/37

    #history 20 20

    ifconfig history Unix,Linux ( Network Lan Card) ifconfig [option] #ifconfig

    ipchains ipchains Unix,Linux ( Firewall) ipchains [parameter] command [option] #ipchains -L Set IPchains

    jobs jobs Unix,Linux ( Firewall) jobs #sleep 20 & jobs

    kill kill Unix,Linux ( Process) kill [option] (process ID) ps -A PID Process Kill -9

    login login nnn nnn PID -9 Unix,Linux ( User Login) login [fp] (UserName) #login:root

    mkdir directory ( dos) make directory mkdir mkdir [option] [file] option mkdir

    (www.lanna-oss.org) 08-7185-0920

  • 31/37

    -m Permissioin ( chmod )-p Parent Directory directory relative absolute path mkdir /homemkdir -p -m755 ~/home/user1

    mv Directory ( dos) move mv source target mv *.tar /backupmv test.txt old.txtmv bin oldbin

    more cat more more file more = q h help more test.txt

    man man Unix,Linux ( ) man (Command) #man ls q ;-b|-k|-m] option free

    (www.lanna-oss.org) 08-7185-0920

  • 32/37

    -b byte-k kilobyte-m megabyte free free b free -k

    pwd Directory ( cd DOS) print work directory / pwd

    uname OS cpu uname -a

    hostname hostname

    tty terminal tty

    id id

    http://forum.ubuntuclub.com/forum?topic=14294.15

    (www.lanna-oss.org) 08-7185-0920

  • 33/37

    3 - apt-get

    apt-get package sudo apt-get install sudo apt-get remove sudo apt-get update sudo apt-get upgrade - aptitude

    aptitude apt-get aptitude upgrade kernel- compile

    compile compile tar -zxvf .tar.gzcd ./configuremakesudo make install

    (www.lanna-oss.org) 08-7185-0920

  • 34/37

    VI

    Editor edit DOS CW , RW word processor editor help vi

    vi editor classics pico nano

    $vi myfile.txt i myfile.txt esc command mode :w vi :q vi :q!

    https://help.ubuntu.com/community/VimHowto

    (www.lanna-oss.org) 08-7185-0920

  • 35/37

    shell script

    command line command line command line shell script DOS Bat File (.BAT)

    shell Ubuntu Server

    shell script

    shell script vi editor $vi myscript.sh#!/bin/shecho This is my shell script.ls -l

    $./myscript.sh shell shell # #!/bin/sh shell sh

    shell script

    shell script vi editor !/bin/sh if [ $# = 0 ] then echo " Do nothing. " exit elif [ $1 = 'died' ] then echo "I will destroy everything"

    (www.lanna-oss.org) 08-7185-0920

  • 36/37

    elif [ $1 = 'leaving' ] then echo "I will leaving." else echo " I don't understand ". fi echo "finish command."

    shell script shell script $./myscript.sh leaving I will leaving

    (www.lanna-oss.org) 08-7185-0920

  • 37/37

    . Ubuntu. 1. : , 2551

    . Red Hat Linux. :

    . Linux Admin. :,2544.

    . . Ubuntu Linux Server 2. Bandhit Press 2553.

    . Ubuntu + Perl. 1. : , 2552

    (www.lanna-oss.org) 08-7185-0920