NTOU IND
      • 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
    • 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 Versions and GitHub Sync Note Insights 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: 講義 slideOptions: # 簡報相關的設定 theme: solarized # 顏色主題 transition: 'fade' # 換頁動畫 allottedMinutes: 120 # 預計簡報花幾分鐘 --- # <h2>Linux基本操作<br>架設麥塊Server</h2> [TOC] ---- 我是黃爾群 一個在很忙的時候還要抽出時間來準備講義的大三生QQ 也是IND的教學~ --- ## OS ---- - Windows 10 - Unix - Unix-like - BSD - Darwin - MacOS - ios - Linux distribution - Ubuntu - Arch - CentOS - android - ... - ... --- ## shell <img src="https://miro.medium.com/max/954/1*aMhiuzvKZAo94sy_wS-tCQ.png" width="50%"> ---- ### ssh <br>**s**ecure **sh**ell ---- 其實就是一種遠端連線 不過是文字介面的 相比以前的telnet、rsh更安全 用法 `ssh -p {port} {user}@{host}` ex. `ssh -p 2222 myuser@140.121.140.121` ---- 接下來請各位使用ssh到我們今天的練習機 可用軟體: - 若是Unix like的OS 直接下指令 - [Bitvise SSH](https://www.bitvise.com/) - ssh.exe - putty - pietty --- ## Commands ---- ### passwd 修改密碼 也可以修改別人的(請不要這麼做,尊重其他使用者,除非你知道自己在做什麼) ---- ### ls 列出目錄中的檔案與目錄列表 常用參數 `-l -h -a` ex. `ls -alh` ### cd 進入資料夾 ex. `cd Documents` ### pwd 顯示目前的目錄位置 ---- ### echo 輸出文字 ex. `echo "Hello World!!!"` 輸入檔案用法: ex. `echo "Hello World!!!" > hello` ### cat ~~叫貓貓去看一下檔案~~ 檢視檔案內容 ex. `cat hello` ---- ### head 檢視檔案前10行 常用參數 `-n` ex. `head -n 4 .bashrc` ### tail 檢視檔案最後10行 常用參數 `-n` ex. `tail -n 14 .bashrc` ---- ### vim 文字界面編輯器 不一定會有安裝 ---- 分成三種模式 - normal mode - edit mode - visual mode 一開始是normal mode 按i進入edit mode 按ESC回到normal mode ---- 在normal mode打冒號可以輸入指令 - `:w` - 儲存 - `:wq` - 儲存並退出 - `:q!` - 不儲存退出 ---- vim是個很強大的編輯器 在normal mode可以用的指令還有連技超多 如果想了解的可以看看 [這個](https://mropengate.blogspot.com/2015/07/vim-ch2.html) 推薦要學 只能用文字介面的時候非常好用 ---- ### cp 複製 ex. `cp hello hello-copy` ### mv 移動、更名 ex. `mv hello ../hello` ### mkdir 創建資料夾 ex. `mkdir my-dir` ---- 不一定有安裝 ### wget 下載檔案 ex. `wget www.google.com` ### curl 也是一種下載檔案 支援更多東西 ex. `curl www.google.com` ---- ### ifconfig 檢視網路卡資訊 ex. `ifconfig -a` ### arp 檢視arp table ex. `arp -a` ---- ### zip、unzip 壓縮、解壓縮 ex. `zip my.zip hello world` ex. `unzip my.zip` ex. `unzip -l my.zip` (只看不解壓縮) --- ## Linux 資料夾結構 ---- - 常用代號 - `~` - 自己的home - `/` - 根目錄 - 相對位置 - `./` - 當前目錄 - `../` - 上一層目錄 --- ## permission denied? ---- ### sudo means 'superuser do' ex. `sudo cat /.dockerenv` ex. `sudo chmod 777 hello` ex. `sudo chmod +x hello` --- ## 安裝套件 ---- - apt - dnf - rpm - pacman - yum - yay - ... ---- ### apt - sudo apt update - 更新套件來源 - sudo apt upgrade - 升級已安裝套件 - sudo apt install - 安裝套件 - ex. `sudo apt install vim` --- ## 終於可以架設伺服器ㄌ... ---- [Download Server File](https://www.minecraft.net/zh-hant/download/server) ![](https://i.imgur.com/bzaPWAL.png) ---- 有幾種方式可以把檔案弄到虛擬機裡 - 在虛擬機裡wget下載的網址 - 用bitvise ssh丟進去 - 底層是sftp - sftp.exe - scp.exe ---- 有可能出現錯誤 `-bash: java: command not found` 這個代表什麼? -> 沒有這個指令 就是沒有安裝java啦~ `sudo apt install openjdk-8-jdk` ---- 裝好後可以 `java -version` 看看有沒有東西 再來就可以依照官網的說明試看看了 ---- 第一次啟動的時候 會發現它一下子就結束了 讀了一下剛剛的輸出會發現他叫你去同意一個東西(EULA) 代表要同意EULA後才能繼續 請看一下現在資料夾裡面多的檔案並編輯EULA裡面的false為true 再次啟動之後就會真正地開好server了~ ---- 嗎? ---- 有一部分人會用同一個機器,所以有的port就會被佔用了 這時候再看看你的資料夾 會有一個server.properties 裡面是一些伺服器的設定 把`server.port` 改掉再重新啟動就可以了 port範圍 -> 1 - 65535 (請使用10000以上的port) [server.properties各設定作用](https://minecraft-zh.gamepedia.com/Server.properties) --- 今日作業: 請各位在自己的機器上裝"虛擬機" 並成功開好一個minecraft伺服器 要注意NAT (port forwarding)設定

    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