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
96
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
93
ITAC | Flask - Basic Flask
racterub
1
98
ITAC-Flask | Environment setup
racterub
1
71
Other Decks in Programming
See All in Programming
Porting a visionOS App to Android XR
akkeylab
0
270
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
270
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
270
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
260
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
520
Is Xcode slowly dying out in 2025?
uetyo
1
250
0626 Findy Product Manager LT Night_高田スライド_speaker deck用
mana_takada
0
150
C++20 射影変換
faithandbrave
0
560
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
180
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
140
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
130
XP, Testing and ninja testing
m_seki
3
230
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
53
7.7k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Side Projects
sachag
455
42k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
The Cult of Friendly URLs
andyhume
79
6.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
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