20121111 linux intro

71
自由軟體與Linux 張明泰 [email protected] 2012.11.12

Upload: chang-mt

Post on 07-Jul-2015

887 views

Category:

Education


1 download

TRANSCRIPT

Page 1: 20121111 linux intro

自由軟體與Linux

張明泰 [email protected]

2012.11.12

Page 2: 20121111 linux intro

軟體下載

• 請下載底下網址的軟體

• Ubuntu linux .影像檔

• VirtualBox 虛擬機器

http://140.117.7x.xx:8080/

Page 3: 20121111 linux intro

Linux和自由軟體

• Linux 是一套作業系統,用來管理電腦的資

源,並作為人類和電腦間的橋樑。

• Linux 、 MAC OS 和 Windows 的都是作業

系統。

Page 4: 20121111 linux intro

作業系統架構

Page 5: 20121111 linux intro

自由軟體

• 自由軟體(Free Software)是一種可以不

受限制地自由使用、複製、研究、修改和

分發的軟體。

• 與自由軟體相對的是非自由軟體,也常被

稱為私有軟體、封閉軟體(其定義與是否

收取費用無關──自由軟體不一定是免費軟

體)。

• 自由軟體也可以看作開源軟體的一個子集。• REF:http://zh.wikipedia.org/wiki/%E8%87%AA%E7%94%B1%E8%BB%9F%E9%AB%94

Page 6: 20121111 linux intro

自由軟體

Page 7: 20121111 linux intro

知名的自由軟專案

Page 8: 20121111 linux intro

網路伺服器http://news.netcraft.com/

Page 9: 20121111 linux intro

Linux 可以做什麼?t

Page 10: 20121111 linux intro

當個專業的鄉民

Page 11: 20121111 linux intro

養驢

院內請勿

養動物

Page 12: 20121111 linux intro

Page 13: 20121111 linux intro

Office 辦公室文書

Page 14: 20121111 linux intro

即時訊息

決定收攤的MSN

SKYPE

Page 15: 20121111 linux intro

DropBox

Page 16: 20121111 linux intro

上FB 看看正妹

傳說中的打卡地標

「胖女美女靜」本人

Page 18: 20121111 linux intro

簡單版的歷史

Page 19: 20121111 linux intro

History

• 1969 年電腦很貴,Bell , MIT 與 GE 想要降

低使用的成本。 開發Multics 系統失敗收場。

Page 20: 20121111 linux intro

Unix 誕生

• 1969年 Ken Thompson 用 Assembler 寫

出一個小型file server system為了玩一套名

為『太空旅遊』的遊戲。(B語言)

• 1973年:Unix的正式誕生,Ritchie等人以

C語言寫出第一個正式Unix核心

Page 22: 20121111 linux intro

KenTompsonKen Thompson有一次被問到,如果你有機會重新設計UNIX系統,你最想改的是甚麼?

他回答:我會讓 creat 這個拼寫加上 e 。

經過 40 年,他做到了。

Ref:http://kevinwatt.net/blog/tag/ken-thompson/

Page 24: 20121111 linux intro

Linus Torvalds

• 1991年在大學修 OS 的 Linus 寫了一個作

業放在網路上。

• 1991年10月(Linus Torvalds)在

comp.os.minix上發佈一則訊息原文連結

https://groups.google.com/forum/?fromgroups#!msg/comp.os.minix/dlNtH7RRrGA/SwRavCzVE7gJ

Page 26: 20121111 linux intro

Linux Distribution

Page 27: 20121111 linux intro

下載

• 中山大學 FTP

• ftp://ftp.nsysu.edu.tw/pub/

• 國網中心

• ftp://ftp.twaren.net/pub/

• I386 32bit

• X86_64 64bit

Page 28: 20121111 linux intro

自由軟體與授權

• GNU General Public License (GPL)要分享

• Berkeley Software Distribution (BSD) 自由

的用

• 權力不變,創意無限(CC授權)

• 全球第一個 GPL 完整法院訴訟案例剖析-

Dlink

• CISCO Linksys 違反 GPL - Linksys使用了

Linux 2.4.5核心系統與其他的GPL程式碼

Page 29: 20121111 linux intro

第三方韌體

• NSLU 計畫及 LinkSYS的熱

銷 http://www.nslu2-linux.org/

• ASUS WL, RT 系列 及 Dlink DI 系列第三

方韌體 OLEG , TOMATO, DD-WRT

Page 30: 20121111 linux intro

DD-WRT

Page 32: 20121111 linux intro

如何入門?

• IT相關知識學習

• 買本書 http://linux.vbird.org/

• 改變你的 OS 環境

• 參與社群

Page 33: 20121111 linux intro

線上書籍

Page 34: 20121111 linux intro

電腦安裝 Linux

Page 35: 20121111 linux intro

MAC ubuntu Linux

Page 36: 20121111 linux intro

參與社群

Page 37: 20121111 linux intro

使用虛擬機器安裝Linux

• VirtualBox https://www.virtualbox.org/

• Vmware http://www.vmware.com/tw/

Page 38: 20121111 linux intro

網路的選擇

VirtualBox

OS (Win)

橋接網路模式

Linux

192.168.123.xx

VirtualBox

OS (Win)

NAT網路模式

Linux

192.168.123.xx

10.0.0.xx

Page 39: 20121111 linux intro

VirtualBox 安裝

• hot key: default key is 'right ctrl‘

• 作業系統選擇:Linux -> Ubuntu 64bit or

32bit 需要注意。

• 記憶體:512MB(以上)

• 硬碟:8GB(建議)-動態產生

• VT-x/AMD-V 有支援就打開(啟用)

• 注意開機順序要,安裝時光碟開機,安裝完成

後硬碟開機,或是退出光碟片。

• 網卡橋接模式及NAT模式

Page 40: 20121111 linux intro

Linux安裝流程

(Linux mint)

• 啟動安裝光碟 -> 桌面 install linux

• 下一步 * n

• 裝好了….

Page 41: 20121111 linux intro

分割區及檔案系統

• ext3 , ext4 Linux 的檔案系統

• Fat32 通用的檔案系統, 2GB 限制

• Linux 最上層只有一個 / 為主要起始路徑

• 分割原則:3主分割+1擴充(64邏輯分割)

• Swap 在記憶體很大的電腦上已經失去作用

MBRGRUB

/ ext45G ~ 10G

SWAPRAM 1~2倍

新手純Linux 電腦分割區規劃

Page 42: 20121111 linux intro

和 Windows 並存

• 先切割分割區安裝Windows

• 在安裝 Win7 or WinXP。因為Win7自動分

割會產生一個100M分割。

• WinXP 及 Win7 會自動覆蓋 MBR。

• 安裝完成Win 後再安裝Linux

MBRGRUB

/ ext45G ~ 10G

SWAPRAM 1~2倍

Win7 NTFS30G ~ 60G

Page 43: 20121111 linux intro

Soft RAID

• 浪費的磁碟系統(增加可靠度)

SIZE: N SIZE: N/2 SIZE: N/2

Page 44: 20121111 linux intro

RAID

• 較常用的作法,大多以硬體實現。

SIZE: N-1 SIZE: N-2

Page 45: 20121111 linux intro

LVM

• 提供在執行系統期間動態分割硬碟的功能。

Page 46: 20121111 linux intro

SELinux

• 對於程式的行為作規則的管控的安全機制

Page 47: 20121111 linux intro

系統管理員 root

• Root 系統管理員

• 一般使用者

• 命令:Su 可以切換任何使用者身分(需有

對方密碼)

• 命令:sudo 可以臨時擁有特權(需要設定)

• 每個檔案/目錄都有擁有者和群組

• 依據權限(rwx)決定對檔案系統的存取權。

Page 48: 20121111 linux intro

Guest Additions

• 安裝 VirtualBox Guest Additions

• Vbox 成為虛擬顯卡,加快 Virtualbox 的顯示

速度。

Page 49: 20121111 linux intro

軟體中心

• Ubuntu software center

Page 50: 20121111 linux intro

套件

• .deb 預先編譯好的2進位程式

• .rpm預先編譯好的2進位程式

http://www.playdeb.net http://rpmfind.net/

Page 51: 20121111 linux intro

軟體系統更新

• 更新 APT 資料庫

• Apt-get update

• 更新軟體

• Apt-get upgrade

• 安裝套件

• Apt-get install 套件名稱

Page 52: 20121111 linux intro

遠端連線 xrdp

• Apt-get install xrdp

Page 53: 20121111 linux intro

Openssh-server

• 安裝

• Sudo apt-get install openssh-server -y

• 啟動

• Service openssh-server start

Page 54: 20121111 linux intro

Openssh-Client

• ssh Cleint 端

• ssh 帳號@主機 [命令]

• Ex:ssh://[email protected]:22

Page 55: 20121111 linux intro

Xshell

Page 56: 20121111 linux intro

Pietty or putty

Page 57: 20121111 linux intro

特效 compiz

• Compizconfig settings Manager

• http://www.youtube.com/watch?v=4QokO

wvPxrE&feature=related

Page 58: 20121111 linux intro

輸入法

• IBUS 輸入法框架

• 酷音輸入法 chewing

Page 59: 20121111 linux intro

網路設定

• 無線網路

• 有線網路

http://wiki.ubuntu-tw.org/index.php?title=ADSL

Page 60: 20121111 linux intro

驗證網路

• Ifconfig 觀察網卡及IP資訊

• Ping 偵測連線是否正常

• Dns 名稱轉換為 IP

Page 61: 20121111 linux intro

ifconfig

Page 62: 20121111 linux intro

ping

Page 63: 20121111 linux intro

Nslookup , host

Page 64: 20121111 linux intro

Command mode

• 命令列模式是為了讓工作更有效率。

• Shell script 可以將經常性的工作寫成程式

工作。

• Bash SHELL

Page 65: 20121111 linux intro

樹狀結構

Page 66: 20121111 linux intro

ls and help

mtchang@mtchang-mint ~ $ ls --helpUsage: ls [OPTION]... [FILE]...List information about the FILEs (the current directory by default).Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.-a, --all do not ignore entries starting with .-I, --ignore=PATTERN do not list implied entries matching shell PATTERN

mtchang@mtchang-mint ~ $ ls -l -a -h /etc/passwd /etc/shadow-rw-r--r-- 1 root root 2.2K 9月 14 14:31 /etc/passwd-rw-r----- 1 root shadow 1.6K 9月 14 14:31 /etc/shadow

Page 67: 20121111 linux intro

命令補齊及history

• 連續兩次 tab 系統會判斷最接近的命令或是

檔案,表列提供選擇。

• 上下 按鍵可以呼叫出前一個使用過的指令

Page 68: 20121111 linux intro

Shell script

• Hello bash shell

mtchang@mtchang-mint ~ $ chmod +x hello.sh#!/bin/bashecho 'hello bash shell'echo "today is $(date +%Y%m%d)" mtchang@mtchang-mint ~ $ vim hello.shmtchang@mtchang-mint ~ $ ./hello.shhello bash shelltoday is 20121112

Page 69: 20121111 linux intro

LAMP

• 安裝 apache2 + php5

• sudo apt-get install apache2 php5 –y

• 啟動服務

• sudo service apache2 start

• Browser 測試

• http://localhost/

Page 70: 20121111 linux intro

ENJOY IT !!!

更多? 那就開始動手做….

Page 71: 20121111 linux intro

Q&A

● 對於 RHCSA or RHCE 有任何問題請發問