Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ITAC | Linux Basics
Search
racterub
July 20, 2020
Programming
0
98
ITAC | Linux Basics
ITAC | Linux Basics
racterub
July 20, 2020
Tweet
Share
More Decks by racterub
See All by racterub
IM620 Web Security
racterub
0
120
ITAC | Websec 3
racterub
0
230
ITAC | Websec 2
racterub
0
190
ITAC | Websec 1
racterub
0
230
Introducing Reverse Engineering @ YZU CS250
racterub
0
210
ITAC | Jinja & Bootstrap
racterub
1
95
ITAC | Flask - Basic Flask
racterub
1
100
ITAC-Flask | Environment setup
racterub
1
72
Other Decks in Programming
See All in Programming
デザイナーが Androidエンジニアに 挑戦してみた
874wokiite
0
310
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
350
Android 16 × Jetpack Composeで縦書きテキストエディタを作ろう / Vertical Text Editor with Compose on Android 16
cc4966
1
190
旅行プランAIエージェント開発の裏側
ippo012
2
890
時間軸から考えるTerraformを使う理由と留意点
fufuhu
15
4.7k
Testing Trophyは叫ばない
toms74209200
0
860
個人軟體時代
ethanhuang13
0
320
ソフトウェアテスト徹底指南書の紹介
goyoki
1
150
RDoc meets YARD
okuramasafumi
4
170
Namespace and Its Future
tagomoris
6
700
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
520
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Six Lessons from altMBA
skipperchong
28
4k
Speed Design
sergeychernyshev
32
1.1k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Embracing the Ebb and Flow
colly
87
4.8k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.9k
Designing Experiences People Love
moore
142
24k
Optimizing for Happiness
mojombo
379
70k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Transcript
Linux Racterub @ ITAC 1
我是誰 • 元智電通英專⼤⼀ • ID: Racterub • 2017-19 AIS3 學員
• 2019 台灣好厲駭 學員 • 最近在補技術債QQ • 我就爛 2
Linux • Linux 是什麼? 3
Linux • Linux 是什麼? • ⼀個作業系統 (廢話) 4
Linux • Linux 是什麼? • ⼀個作業系統 (廢話) • 今天會讓你們實際操作,希望你們已經先載好了 5
Linux • Linux 是什麼? • ⼀個作業系統 (廢話) • 今天會讓你們實際操作,希望你們已經先載好了 •
沒載好的找我領 USB 6
Linux • Linux 是什麼? • ⼀個作業系統 (廢話) • 今天會讓你們實際操作,希望你們已經先載好了 •
沒載好的找我領 USB • Linux 有什麼⽤? 7
Linux • Linux 是什麼? • ⼀個作業系統 (廢話) • 今天會讓你們實際操作,希望你們已經先載好了 •
沒載好的找我領 USB • Linux 有什麼⽤? • 炫砲 8
我原本在想要不要講他的一些背景 但是大概你們會先睡死 9
Ubuntu • Linux 底下的⼀個分⽀ • 新⼿好入⾨ • ⽬前⼤約有⼀億⼈在使⽤ ubuntu 10
• / 根⽬錄 • /bin 系統內建會⽤到的執⾏檔 • /boot 系統啟動會⽤到的檔案 •
/dev Linux 核⼼有認識的設備和裝置的資訊 • /etc 系統設定檔 • /home 所有(非 root)使⽤者的家⽬錄 Filesystem 11
Filesystem • /lib & /lib64 系統程式庫和核⼼模組 • /media & /mnt
裝置的掛載點 • /opt 無法透過套件安裝的軟體的安裝點 • /proc 每個 process 相關檔案 • /root root 使⽤者的家⽬錄 • /usr/bin Ubuntu 預載或是透過套件安裝的安裝點 12
Filesystem • /usr/local ⾃⼰⼿動編譯安裝的安裝點 • /var 常態性變動的檔案 • /tmp 暫存檔
(每次重開機都會清除) Ref: http://linux.vbird.org/linux_basic/0210filepermission.php#dir_fhs 13
好ㄌ 該來實際用用看 了 14
VM • Ubuntu 18.04.3 bionic • 匯入 • ⼯具 ->
匯入 • 密碼: itac 15
VM • How to use? • 打開 Terminal • 輸入
cd ~/Desktop/ • (如果要重置的話輸入 removepg ) • (輸入完再輸入 cd ../playground ) 16
VM • 檢查⼀些設定 • 設定 -> 網路 -> 連接埠轉送 •
應該會長這樣
常見指令 我們這裡只討論 Bash :D 18
? • 如果想知道指令該怎麼⽤,有什麼 option 可以⽤ • man && -- help
• man <command> • <command> -- help 19
Commands • ls [options] <dir> :列出當前⽬錄 • options • -a
all • -l long-list • -h human-readable • cd <dir> :切換當前⽬錄 20
Commands • cp [options] <src> <dst> :複製檔案/資料夾 • -r recursive
• rm [options] <file> :刪除檔案/資料夾 • -r recursive 21
Command • mkdir <dir> :建立資料夾 • rmdir <dir> :刪除資料夾 •
rmdir v.s rm? • rmdir 只能刪除空資料夾,rm 則沒限制 22
Command • find <basedir> [options] :搜尋檔案/資料夾 • -type <options> •
d 資料夾 • f 檔案 • l 連結檔 (Only symbolic link) • s socket 23
Command • find <basedir> [options] :搜尋檔案/資料夾 • -name <filename> •
這個指令建議配 sudo 使⽤,要不然會噴⼀堆垃圾給你 24
Command • cat <filename> :讀取並輸出檔案內容 • head / tail [options]
<filename> :讀取前⾯部分檔案內容並 輸出 • -c <bytes> 讀取前N-bytes • -n <lines> 讀取前N⾏ 25
Command • ssh <user>@<ip/domain> [options] • options • -p <port>
指定 port • -i <identity file> 指定 key file • -R -L 可做 port-forwarding • https://dev.to/samuyi/the-how-to-of-ssh-port- forwarding-1f4e
Command • vim / emacs • 痾那個 • 我不會⽤ emacs
• 不要砲我 • 會的可以上來教 • https://emacs.was.best 27
Vim • Vim 共有三個 mode (常⽤到的 • Normal mode •
Insert mode • Visual mode 28
Vim • Normal mode • 輸入 “:” 就可以輸入指令 • :w
寫入檔案 • :q 離開 vim • 也可 :wq 就是寫入後離開 • 按下 i 就可以進入 insert mode 29
Vim • Insert mode • 就簡單的輸入模式 • 要切換成 normal mode
就按 esc 30
阿系統空空的是能幹嘛? 用 apt 安裝 ! 31
apt • sudo apt <command> [arg1, arg2 …] • command
• install • update • upgrade • show • list • info • remove 32
Webservers 33
Webserver • 主流 • IIS (Microsoft) • Apache (Apache Software
foundation) • Nginx (Nginx, Inc. or F5 Networks) 34
Webservers • IIS • 是由微軟公司提供的基於運⾏Microsoft Windows的網際 網路基本服務。 35
36
Webservers • Apache • Based on httpd • 有多個模組可以使⽤, 包含
php, python .. ,亦有認證 模組 37
38
Webservers • Nginx • 這跟剛剛兩款⼜有⼀點不⼀樣了,除了網⾴伺服器,他 還可以反向代理,負載平衡和 HTTP 快取 • 效能相對
apache 會好⼀點 (不⼀定) • 這次會教你們⽤ nginx 接上 php 39
40
該來手動架 server 了 41
Nginx • 系統內建並沒有 nginx ,所以必須透過 apt 安裝 • sudo apt
install nginx 42 ▲安裝完成⽤瀏覽器會看到這⼀⾴
Nginx • 好的,這樣就算架好 server 了 • 我們可以寫⾃⼰的 html 來玩 •
預設的網⾴根⽬錄是在 /var/www/html 43
Nginx • 可以顯⽰⾃⼰要的東⻄了,但是我們要接 php 才可以在網 ⾴上顯⽰ php 執⾏出來的內容 • 我們依舊需要
apt 來安裝 :D • sudo apt install php-fpm (ubuntu 18.04 預設是 7.2 版的 ㄛ) 44
Nginx + php • Nginx 跟 php-fpm 是載好了,但是兩個完全沒搭上線,需 要⾃⼰進 nginx
的設定檔才⾏ 45
Nginx + php ▲注意,這邊 php7.0-fpm.sock 要改成 php7.2-fpm.sock 46 安裝完了之後就要在 Nginx
接上 php,所以需要在兩個地⽅改設定 ▲在 index.html 後⾯加上 index.php
Nginx + php • 最後還要修改⼀個 php 的設定,他會造成你的 php server 出現漏洞
• 檔案在 /etc/php/7.2/fpm/php.ini • ;cgi.fix_pathinfo = 1 ➤ cgi.fix_pathinfo = 0 47
Nginx + php • 最後重啟 nginx 跟 php-fpm 就可以了 •
sudo systemctl restart nginx • sudo systemctl restart php7.2-fpm 48
Nginx + php • 在 /var/www/html 撰寫⾃⼰的 php 檔應該就可以正常顯⽰ 了喔
! 49
Domains? 50
Domains • 簡單來說,domain ⼤概會像這樣運作 w w w.yzu.edu.tw ? DNS Server
Client 51
Domains • 簡單來說,domain ⼤概會像這樣運作 w w w.yzu.edu.tw ? 139.162.77.188 DNS
Server Client 52
Domains
Domains • 簡單來說,domain ⼤概會像這樣運作 racterub.m e? 139.162.77.188 DNS Server Client
www.yzu.edu.tw (140.138.8.10) HTTP GET 54
Domains (racterub.me)
Domains 56
Domains 57
資源 • ⿃哥 http://linux.vbird.org/ • DigitalOcean https://www.digitalocean.com/community/ tutorials/how-to-install-linux-nginx-mysql-php-lemp- stack-ubuntu-18-04
QA? 59
@racterub @racterub 60