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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
racterub
July 20, 2020
Programming
120
0
Share
ITAC | Linux Basics
ITAC | Linux Basics
racterub
July 20, 2020
More Decks by racterub
See All by racterub
IM620 Web Security
racterub
0
140
ITAC | Websec 3
racterub
0
250
ITAC | Websec 2
racterub
0
220
ITAC | Websec 1
racterub
0
250
Introducing Reverse Engineering @ YZU CS250
racterub
0
230
ITAC | Jinja & Bootstrap
racterub
1
120
ITAC | Flask - Basic Flask
racterub
1
110
ITAC-Flask | Environment setup
racterub
1
94
Other Decks in Programming
See All in Programming
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
AgentCore Optimizationを始めよう!
licux
3
210
Explore CoroutineScope
tomoeng11
0
170
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
310
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
490
Spec-Driven Development with AI Agents (Workshop, May 2026)
antonarhipov
2
310
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
130
実用!Hono RPC2026
yodaka
2
300
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
340
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
490
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.1k
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
Featured
See All Featured
Side Projects
sachag
455
43k
The Language of Interfaces
destraynor
162
26k
Code Review Best Practice
trishagee
74
20k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
270
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Speed Design
sergeychernyshev
33
1.6k
We Are The Robots
honzajavorek
0
220
The SEO identity crisis: Don't let AI make you average
varn
0
460
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
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