台大經濟統計資料研究中心 NTU Econ Stat Data Research Center
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me 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
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • 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 Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me 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
    # User Guide - NTU BDSRC EDU System (中文版) :::info - 如果你遇到任何問題,請聯繫 ntubdsrc@ntu.edu.tw - 登入系統後請立即修改你的密碼。(請參考「使用者設定」章節) ::: :::danger 除非是在你的資料夾內,否則不要修改任何其他檔案。 ::: ## Overview ### 什麼是終端機(terminal)? 終端機是一種基於文字的介面,讓我們能與作業系統互動。我們可以不透過圖形介面(你平常看到的彩色桌面)完成各種任務。不同的作業系統給它不同的名字,例如: - **macOS**: terminal.app - **windows**: PowerShell, CMD - **Linux**: Terminal (如果你使用桌面環境,可以用滑鼠右鍵打開) ### 如何存取運算資源? 總共有 3 台伺服器可使用(目前 node01 無法使用)。你可以透過 IP 位址 140.112.176.246 連線到 EDU 伺服器,這會預設連到 master 節點。若要進入其他節點,必須另外指定連線的 port。 :::info - **本地端(Local machine)**: 你手邊自己的電腦 - **遠端 (Remote machine)**:你透過網路存取的伺服器 ::: ![image](https://hackmd.io/_uploads/SyJv83rjgx.png) ## SSH 連線 SSH 是一種遠端存取協定,允許你透過終端機連上任何遠端設備。不過,它不像 Windows 桌面那樣提供圖形化介面。 ```shell # 在終端機輸入: ## SSH 語法(連線 master) ssh <username>@140.112.176.246 -p 2211 ## 如果出現一些奇怪的錯誤訊息但其實能連上 ssh -o LogLevel=ERROR <username>@140.112.176.246 -p 2211 ``` :::info **當你連上 master 之後**,如果發現有太多人使用同一個節點(可能讓程式變慢),你可以再從 master 進一步連線到其他節點: ```shell # 在終端機輸入:(必須先連上 master) ## 連到 node02 ssh node02 ## 連到 node03 ssh node03 ``` ::: 要結束 SSH 連線,可以輸入 exit,或是使用 ctrl-D、ctrl-C。 ## 使用者設定 ### 修改密碼 在 master 上輸入以下指令,並輸入目前密碼,就可以修改密碼。 (其中 <KEYWORD> 會提供給你課程的老師, <username>是你的帳號名稱(一般為你的學號)) ``` ldappasswd -x -H ldap://192.168.0.11:389 -D "uid=<username>,ou=Student,ou=<KEYWORD>,ou=Courses,dc=BDSRC,dc=edu" -W -S ``` :::danger ***只能在 master 節點修改密碼*** ::: ### 常用工具 伺服器的終端機內有幾個軟體可以啟動: ```shell # Stata17 /homes/source/stata/stata #Stata19 (新版) /homes/source/stata19/stata #Stata19 (新版,可容納變數量較多) /homes/source/stata19/stata-se # Python python3 <filename>.py # Julia julia #R R ``` 如果要啟動 GUI(圖形介面)版本,請先在你的電腦安裝 X server: * Linux: 通常已經內建 * Mac: 安裝 XQuartz * 安裝:https://www.xquartz.org/ * 在該版本頁面按「XQuartz-2.x.x.pkg」即可下載 * Windows: 建議安裝 Mobaxterm(內建 X server 與遠端檔案系統) (mobaXterm 教學: https://blog.csdn.net/qq_44074697/article/details/118544904) 設定範例 ![image](https://hackmd.io/_uploads/r1zE12Pixe.png) , 或另外安裝 [VcXsrv](https://blog.csdn.net/luohaitao/article/details/147120849) ```shell # before using the gui version use "-X" to activate X server at local side ssh -X <username>@140.112.176.246 -p 2211 ssh -X node02 # Stata17/IC 2GB memory limited /homes/source/stata/xstata # Stata19/IC 2GB memory limited (新版) /homes/source/stata19/xstata # Stata19 (新版,可處理較大數據) /homes/source/stata19/xstata-se ``` ### 檔案存取控制 :::danger 你的檔案可能對其他人看到。若要避免這種情況,必須設定存取權限。不過如果資料不敏感,可以忽略。 ::: 檔案權限有三種:r (讀取)、w (寫入)、x (執行) #### 檢查檔案權限 ```shell # Example ls -l test.txt # Output -rw-rw-r-- 1 ryan ryan 0 九 2 14:58 test.txt # or you can use `getfacl` getfacl <filename> ``` 範例:權限 -rw-rw-r-- 可解讀為: - 是否為資料夾:-(若是資料夾會顯示 d) - 擁有者:rw-(可讀寫) - 群組:rw-(群組內的人可讀寫) - 其他人:r--(只能讀取) :::info rw- 對應二進位 110,十進位就是 6。所以 -rw-rw-r-- 可以表示為 660。 如果要設定權限成 rwxr-x---,可以輸入: ```shell chmod 750 <filename> ``` ::: #### 修改檔案權限 ```shell # Syntax chmod <setting> <target name> # Example: add execute permission for yourself. chmod u+x <filename> # Example: Take away other's rwx permission chmod o-rwx <filename> ``` #### 修改資料夾權限 ```shell # Syntax chmod -R <your setting> <dir name> ``` :::info u:自己 o:其他人 g:群組內成員 +:增加 -:移除 =:直接指定 ::: #### Further info on File Permission - https://www.redhat.com/sysadmin/linux-file-permissions-explained - https://www.geeksforgeeks.org/how-to-set-file-permissions-in-linux/ ## VS Code 遠端編輯 你可能不想每次修改程式碼都要傳檔案到伺服器。這時候可以直接用 VS Code 編輯遠端檔案,比較方便,同時也可以使用jupyter notebook編輯。 可至[VScode官網](https://code.visualstudio.com/download)下載符合自己作業系統的安裝檔 1. 安裝 Remote Development、Remote - SSH、Remote Explorer 擴充套件 ![Screenshot 2024-09-02 at 15.54.29](https://hackmd.io/_uploads/S1gLygX2R.png) 2. 開啟遠端視窗 ![Screenshot 2024-09-02 at 15.56.02](https://hackmd.io/_uploads/HJMbxlXhC.png) 3. 連線到 Host ![Screenshot 2024-09-02 at 15.58.27](https://hackmd.io/_uploads/rknwgg7nC.png) 4. 新增 SSH host > Configure SSH Hosts ![Screenshot 2024-09-02 at 16.05.54](https://hackmd.io/_uploads/HyxNGxQhC.png) 5. 選擇要存放設定的檔案(通常選第一個即可) ![Screenshot 2024-09-02 at 16.02.31](https://hackmd.io/_uploads/HyTufgXh0.png) 6. 編輯設定: ```shell # Format for master Host <master name (Whatever you like)> HostName 140.112.176.246 User <your user name> Port 2211 # Format for other nodes Host <node name (Whatever you like)> HostName node02 User <your user name> ProxyJump <master name> ``` ![image](https://hackmd.io/_uploads/rkxZ0hHige.png) 7. 建立連線 ![Screenshot 2024-09-02 at 16.15.00](https://hackmd.io/_uploads/rkd6EeQ3R.png) 8. 第一次連線時選擇 Linux ![image](https://hackmd.io/_uploads/HyLXkpSsgx.png) 9. 輸入密碼 ![image](https://hackmd.io/_uploads/B1nLkarsll.png) 10. 打開檔案系統 ![image](https://hackmd.io/_uploads/SJQqyTHolg.png) 11. When you are using jupyter notebook (.ipynb file), make sure you select correct kernel to compile your code. ![image](https://hackmd.io/_uploads/rJhegTSogg.png) :::info 如果是 Jupyter notebook (.ipynb),請確認你選擇正確的 kernel 來執行程式碼。 (第一次需要安裝擴充套件,Python / Julia / R 依需求安裝) ![image](https://hackmd.io/_uploads/HkZjl6riel.png) ![image](https://hackmd.io/_uploads/H11AlTBile.png) or ![image](https://hackmd.io/_uploads/S1keL2Dsxl.png) 安裝 python 擴充套件 ![image](https://hackmd.io/_uploads/rkFG8hvixl.png) Julia 用戶需先在終端機上(terminal)執行: ``` /opt/julia-1.10.5/bin/julia -e 'using Pkg; Pkg.add("IJulia")' ``` ::: ![image](https://hackmd.io/_uploads/BJSXgpBjgl.png) ![image](https://hackmd.io/_uploads/HkEGl6rixe.png) 12. happy coding! ![image](https://hackmd.io/_uploads/SkPHg6roll.png) :::info 在 Jupyter notebook 裡也可以直接安裝套件: - Python:!pip install <套件名稱> - Julia:using Pkg; Pkg.add("<套件名稱>") - R:install.packages("<套件名稱>") ::: ## 基礎 Linux 教學 https://www.geeksforgeeks.org/linux-tutorial/

    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