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
86
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
110
ITAC | Websec 3
racterub
0
220
ITAC | Websec 2
racterub
0
190
ITAC | Websec 1
racterub
0
230
Introducing Reverse Engineering @ YZU CS250
racterub
0
190
ITAC | Jinja & Bootstrap
racterub
1
84
ITAC | Flask - Basic Flask
racterub
1
91
ITAC-Flask | Environment setup
racterub
1
64
Other Decks in Programming
See All in Programming
AWS Organizations で実現する、 マルチ AWS アカウントのルートユーザー管理からの脱却
atpons
0
150
さいきょうのレイヤードアーキテクチャについて考えてみた
yahiru
3
750
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
130
Linux && Docker 研修/Linux && Docker training
forrep
24
4.5k
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.3k
Immutable ActiveRecord
megane42
0
140
『テスト書いた方が開発が早いじゃん』を解き明かす #phpcon_nagoya
o0h
PRO
2
280
昭和の職場からアジャイルの世界へ
kumagoro95
1
380
SwiftUI Viewの責務分離
elmetal
PRO
1
240
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
330
Amazon S3 TablesとAmazon S3 Metadataを触ってみた / 20250201-jawsug-tochigi-s3tables-s3metadata
kasacchiful
0
170
Honoとフロントエンドの 型安全性について
yodaka
7
1.3k
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
306
110k
Rails Girls Zürich Keynote
gr2m
94
13k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
Adopting Sorbet at Scale
ufuk
74
9.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Bash Introduction
62gerente
611
210k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Writing Fast Ruby
sferik
628
61k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
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