NCNU-OpenSource
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: 1101, lsa --- - Book mode https://hackmd.io/@ncnu-opensource/book # Week 02(2021/09/30) [TOC] ## ubuntu 安裝補充 [ubuntu 安裝共筆](https://hackmd.io/iRFQSqTaQgyOTa4reEtXag) ### 記憶體 - 電腦本身記憶體若是 6G 以上,選 4G (電腦記憶體 4G 就給 2G) ### 磁碟格式 - VDI for virtual box - VHD for microsolft - VMDK for VMware > 格式轉換: vboxmanage - LVM 虛擬分割技術 - 缺點: 虛擬的,不會直接寫在硬碟上面,比較難救援回來 ### 存放裝置在實體硬碟 - 動態分配:需要多少給多少,隨著使用需求會「增長」,達到原本分配到的上限為止。 - 固定大小:一開始就固定容量大小 - 好處是一開始就規劃好了,不需要有增長的動作,動作會比較快 ### 無聊記事 - 可以使用 Try Ubuntu 製作 usb 開機碟 - 剛安裝完 Window、網頁跳出中獎消息、安裝盜版軟體都容易中毒 - 因為容易有人發覺舊系統的漏洞,並且針對它攻擊,所以在剛裝完電腦的時候尚未對系統進行保護的時候容易中毒 - 電腦會用 NTP(Network Time Protocol)來校時,電腦主機板上也有RTC(Real-time clock)做校準 - Windows 的 CMD 就是 Ubuntu 的 Terminal - Ubuntu 可以不關機更新核心,降低被攻擊的可能 ### LVM - 如果你有很多顆硬碟,它可以幫你組成一個大硬碟,之後可以做分割 - 缺點:救援方面困難 ![](https://i.imgur.com/hxSLX5A.png) - 勾選【Encypt the new Ubuntu installation...】可避免電腦密碼的設置被跳過,就算真的被跳過也僅會看到亂碼 - 如果虛擬機設密碼,要加密就會解密,要解密就會比較吃 CPU ### TrueCrypt & VeraCrypt - TrueCrypt: 可以在一個虛擬的加密磁碟加密或加密一個分割區 - VeraCrypt: 可以對一顆硬碟直接加密,只要沒有正確密碼,都是看到亂碼 ### ZFS - ZFS 是一個結合了邏輯磁碟管理功能檔案系統 - 相較於 EXT 更新型的檔案系統,可直接做硬碟陳列,甚或加上 SSD 做磁碟寫入及讀取提升效能 - 電腦可以一邊運作一邊做快照,還可以直接傳到遠端做備份 - 弄壞還可以復原(每次重開機前會快照,下次重開機就可以回到上次重開機前的狀態) - 目前(20.04)還是實驗階段 eg ### SDA ![](https://i.imgur.com/98m3esw.png) - 硬碟編號方式:早期的 IDE 硬碟會用HD(HardDisk)+A.B.C.D,例如:HDA port接出去的第一顆硬碟 - 要改變那些硬碟的 partition table:sda - SATA 介面的硬碟=> SDA;HardDisk 介面的硬碟=> HDA - 記憶卡如 SD 卡 : mmca - 預設為一般家用使用者,自動分割以下 2 個硬碟 - partition #1 - partition #5 - ext4 最新使用的檔案系統:穩定性佳 - zfs:效能較佳 ### 時區 - 電腦時間如何校準 - NTP protocol : 網路對時協定 - 和很多台校時伺服器做時間校對 - 連上網路就可以自動對時 - [維基](https://zh.wikipedia.org/wiki/%E7%B6%B2%E8%B7%AF%E6%99%82%E9%96%93%E5%8D%94%E5%AE%9A) - 如果沒有網路,主機板有顆小電池,供應Realtime Clock(RTC)電力,其採用石英振盪持續校時 - 石英振盪一年會誤差1-2秒,有的會採用原子鐘 - 如果筆電很久不充電,讓備用電源沒電,時間就會reset ### 密碼複雜度 - 只有數字:10^n^ 種變化 - 數字加英文:36^n^ 種變化 - 英文大小寫加數字加特殊符號:(70+)^n^ 種變化 > - 加了特殊符號,複雜度提升很多 > - 例如:iloveyou < 3iloveyouYahoo < 3iloveyou# > - n 是密碼長度 ## Linux 歷史 - 不易中毒 - 安全性相較於windows好很多 ### Ubuntu - 3種版本 - 桌面板本 - 伺服器版本 - Core版本 - 針對物聯網裝置 - Ubuntu基金會 - ubuntu台灣負責人:BlueT 大大 - live patch - 註冊後可使用,可以在開機狀態下更新核心 - 可避免機器一開開十年都沒更新漏洞 > 一人最多三台 - metadata - 檔案的資料 - ex : 擁有者 建立時間 #### 硬碟 - 多個 sector 圍成一圈,組成一個 track ##### CHS - 磁碟分割 - 方便管理 - 當某一個部分損壞時,就只會那一區域損壞,不會害到整體 ##### FileSystem - 使用檔案和樹狀目錄的抽象邏輯概念代替硬碟、光碟等物理裝置使用資料塊的概念 #### SWAP - 一種虛擬記憶體的置換空間 - 記憶體快滿了或是滿了,但是今天要開一個軟體或是其他應用程式時,記憶體不夠了,電腦就會把記憶體裡一些老舊、比較用不到的資料放到 SWAP - SWAP != 虛擬記憶體 ## FHS > 沒遵守FHS redhat : Centos , - 全名: **F**ilesystem **H**ierarchy **S**tandard - 由linux foundation 進行維護及協同管理 - 定義了Linux作業系統中的**主要目錄結構與目錄內容** - 讓使用者了解檔案的位置在哪裡 ### 架構 ![](https://i.imgur.com/hS53GKi.png) - FHS一層一層的資料結構,像tree - FHS文件形式,僅定義出三層目錄下有哪幾種 - `/`:一切的起始點 - `/usr`:與軟體/安裝執行有關 - `/var`:跟系統運作有關 ### 根目錄與其子目錄 - 萬物之根源,稱為 root - 所有目錄都是從 root 衍生出 - 避免將各種檔案放在 root 的分割區裡,FHS 有規範甚麼檔案放哪 - 減少系統出錯(虛擬化技術尚未流行時) - 因為如果一個步驟導致一個地方壞掉,就只會那一個根目錄被弄壞,不會影響其他的地方,你的心才不會痛痛 - 當所有檔案都放在同一個分割區裡,只要該磁區有一個bit壞掉,系統就有可能 crash - 單機系統穩定轉變成整體系統的穩定(虛擬化技術流行後) - 由於虛擬機的興起,如果一間有十幾台主機的機房,其中一台主機壞了還有其他主機頂著 - 資料不能遺失才是重點 ### 根目錄下需要存在的目錄 - `/bin` - 放置基礎重要指令 - e.g `ls`,`cd`,`rm` - ls: 顯示目錄下的檔案 - cd: 切換位置 - rm: 刪除檔案 - `/sbin` - s 就是 Super User, 是Superuser Binaries - 只有系統管理員能使用的指令 - 專放所有會對系統的運作產生破壞影響指令 - 開機、修復、還原系統所需要的指令 - 這些指令只有==root==才能夠利用來**設定**系統 - 其他user最多只能用來查詢 - 基本指令都在 `/bin`,superuser專用放在 `/sbin` - e.g: `ifconfig`,`reboot`,`shutdown` :::info ifconfig - 查看所有已啟動的網路介面卡 - 下此指令 `apt install net-tools` - 可以看網卡的各項資訊 - 需要使用 `ifconfig eth0(網卡名稱) down` - eth0是網卡名稱 - 把你的網卡關掉 - 然後就不能上網了! > terminal畫面: ![](https://i.imgur.com/uJVzP05.png) - 使用`ifconfig enp0s3(網卡名稱) up` - 可以將網卡再次開啟,但要記得網卡名稱! ::: - **lib** = library - 放置在開機時會用到的函式庫 - 在`/bin`or `/sbin`底下的指令會呼叫函示庫 - **boot** - 放置在開機時會使用到的檔案 - 包括Linux核心檔案以及開機選單與開機所需設定檔 - e.g `initrd.img` - Initial ramdisk - 指一個臨時檔案系統,它在啟動階段被Linux核心呼叫。 - initrd主要用於當「根」檔案系統被掛載之前,進行準備工作。 - 會先在記憶體中載入一個暫時的根目錄系統 - 裡面包含能真正的/掛載的模組(Module) - 真正的跟目錄系統掛載(mount)前的準備工作 - 這個不是必要存在,有了他開機快很多 - 因為不用重新編譯 kernel :::info This root file-system can contain user-space helpers which do the hardware detection, module loading and device discovery necessary to get the real root file-system mounted. [**in Wikipedia**](https://en.wikipedia.org/wiki/Initial_ramdisk#cite_note-landley2-2) ::: - **dev** - device - 放置各種硬體設備的檔案 - 在Linux中**所有東西**都是檔案 - 所以對這些硬體檔案做操作就是對硬體做操作 - ex:硬體、資料夾、CPU > `/dev/random`: 亂數產生器 > 用軟體模擬或者使用亂數產生晶片 - **media** - 放置可移除的裝置**掛載**上來的目錄 - 如果無安裝此裝置,不會有子目錄 ::: info **掛載** - 由作業系統使一個儲存裝置(諸如硬碟、CD-ROM或共享資源)上的電腦檔案和目錄可供使用者通過電腦的檔案系統存取的一個過程。 - 一個儲存裝置安裝後,要告訴他檔案存在哪裡 - ex:本機裝一個光碟機,這台光碟機的檔案就會掛載在`/dev/cdom`裡面,光碟機的檔案會放在`media` - 簡單來說,就是將檔案連接到系統的某個位置 ::: - e.g 光碟、DVD、硬碟 - **mnt** = mount(掛載) - 放置臨時掛載的filesystem - 古早時候,這個目錄的用途與`/media`相同 - e.g 外接硬碟 - 這樣才看的到那個硬碟存放的目錄與檔案 - **etc** - 放置系統的主要設定檔,但凡是設定檔案都在etc里 - e.g - user的帳號密碼檔 `/etc/passwd` - vim的設定檔 `/etc/vim/vimrc` > 查看帳號密碼檔 `cat /etc/passwd` 需要用 `sudo cat /etc/passwd` - 真正放密碼的地方:`/etc/shadow` - **opt** - 放置第三方軟體的目錄 - 怕這個檔案玷汙系統的話,可以把東西放在這裡(雜七雜八的東東) > 但它不是電腦的垃圾桶,[name=BT] :::info **第三方軟體** - 自己額外安裝到 linux 中的軟體 - 只要不是 `apt install` 的軟體,都裝到 `/opt` - e.g. Chrome - 下載安裝檔 - `wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb` - 安裝 - `sudo dpkg -i google-chrome-stable_current_amd64.deb` ::: ### 操作 >指令: 指令 -選項 - 開啟 terminal - `ctrl` + `alt` + `T`:開啟terminal - 搜尋 application: `terminal` - `ctrl` + `shift` + `=` : 放大視窗跟文字 - `pwd`:顯示目前所在的位置 - `ls -l`:顯示目前位置下所有的檔案 - `sudo`:權限很高的指令,很方便但不能濫用 > root vs sudo <br> > root: 神 <br> > sudo: 神的代理人、超級使用者,動作會留下紀錄 - tab 可以補全指令 - `cat`: 將該檔案內容印在終端機上 - 文字顏色 - 藍:目錄 - 綠:可執行檔 - 白:一般檔案 - 黃:設備檔 - 紅:不存在或壓縮檔 #### 指令 - 安裝 net-tools ```terminal= sudo apt install net-tools ``` - 列出現在的系統中,有哪些設備被掛載 - sda1 會被掛載到root - sda1的掛載雖然在安裝時看不到,但是這個指令就可以清楚看到 ```terminal= df -h ``` - 看這個捷徑下的所有檔案 ```terminal= # -l: link ls -l <檔案路徑> ``` - 找這個群組的使用者和權限 ```teminal= less <群組> ``` ## QA - 版本是14 前年裝的 建議載20.4嗎 還是14也可以堪用 > 14.04 已經 EOL 了,超過官方支援時間,建議裝 20.04 或至少 18.04 [name=BT] - @BlueT 可以教如何繞過Windows的密碼嗎(原理)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully