阿好伯
    • 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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
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
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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- disqus: ahb0222 GA : G-VF9ZT413CG --- # 使用Win10自架RStudio Server(Workbench) > [color=#40f1ef][name=LHB阿好伯, 2021/10/31][:earth_africa:](https://www.facebook.com/LHB0222/) ###### tags: `R` `Ubuntu` [TOC] ![](https://hackmd.io/_uploads/rJi2Y8oUF.png) Rstudio 有一個線上伺服器服務rstudio cloud非常的好用 但最近發現它的資源快被我用完了 剛好最近學習到了[Zerotier](/JUE-4pd2Te-TrHK7s42xtg)這個神器 可以讓我用宿舍的桌機組建自己的Rstudio Server 使用Zerotier可以讓我們其他不在同一網路環境的電腦也可以連上Rstudio Server 而不是用遠端操作的方式連線 其中於流暢度跟解析度差了很多 有興趣的可以參考下面步驟 # 安裝 WSL 首先Rstudio Server 目前只支援 Linux系統 好在Win10後面有支援WSL( Windows 子系統 Linux 版) ![](https://hackmd.io/_uploads/Byo6W8iIK.png) :::danger 您必須執行 Windows 10 2004 版和更高版本 (組建19041和更新版本) 或 Windows 11。 ::: 安裝上也非常簡單 開啟CMD(命令提示字元) ![](https://hackmd.io/_uploads/rJLruCqUK.png) 輸入`wsl --install` 安裝WSL ![](https://hackmd.io/_uploads/BkGPGUjIF.png) # 安裝Ubuntu 20 之後可以在微軟的應用商店找到Ubuntu 20的安裝 ![](https://hackmd.io/_uploads/By5WP0cIt.png) 安裝完成後就會是一個可以執行的軟體 ![](https://hackmd.io/_uploads/SkznfLjIY.png) 第一次開啟需要先設定使用者帳戶資訊 輸入密碼過程不會顯示就安心地打出想要的密碼 ![](https://hackmd.io/_uploads/rJWW6AqIY.png) # 安裝Rstudio Server ## R 在指令前加上sudo 就像是電腦的使用系統管理員進行安裝 所以需要輸入密碼 輸入過程不會顯示就安心地打出密碼 ``` sudo apt-get install r-base ``` ![](https://hackmd.io/_uploads/By6pTC9Lt.png) ## Rstudio server ``` sudo apt-get update sudo apt-get install gdebi-core wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.02.3-492-amd64.deb sudo gdebi rstudio-server-2022.02.3-492-amd64.deb ``` ## 啟動 前面安裝完成後我們只需要開啟服務節可享用Rstudio Server `sudo rstudio-server start` 開啟電腦瀏覽器輸入下方網址 :::success localhost:8787 ::: 連線成功後需要輸入Ubuntu的使用名稱與密碼 ![](https://hackmd.io/_uploads/rJsVV8jIt.png) 盡情地享用 ![](https://hackmd.io/_uploads/rJ09E8sUK.png) ### 問題排除 ![](https://hackmd.io/_uploads/H1SEfkj8Y.png) 查看問題 `sudo rstudio-server verify-installation` :::success Path to R not specified, and no module binary specified; Invalid R module () ::: 重新安裝R即可`sudo apt-get install r-base` #### Zerotier cli command giving error "missing port and zerotier-one.port not found" in ubuntu 問題可能是因為端口9993已被其他服務佔用而導致 ZeroTier One 無法啟動。您可以按照以下步驟來更改 ZeroTier One 的控制界面端口: 創建一個 /var/lib/zerotier-one/local.conf 文件,如果不存在的話,可以使用以下命令: ```bash= sudo nano /var/lib/zerotier-one/local.conf ``` 如果您不使用 nano 文本編輯器,可以替換為您喜歡的編輯器,例如 vim 或 gedit。 在打開的文件中,添加以下內容,將主端口更改為9994(或您希望使用的其他可用端口): ``` { "settings": { "primaryPort": 9994 } } ``` 保存文件並退出編輯器。 現在,嘗試重新啟動 ZeroTier One 服務: `sudo systemctl restart zerotier-one` 這應該允許 ZeroTier One 使用新的端口9994 ### Ubuntu套件安裝 安裝tidyverse套件時,由於缺少某些依賴包和系統庫,安裝失敗了。這通常發生在Linux系統上,特別是當系統中沒有安裝R包所需的一些底層庫文件時。以下是解決這個問題的步驟: 安裝系統依賴:根據錯誤信息,首先需要安裝libxml2-dev。這是一個Linux庫,用於處理XML和HTML內容。您可以使用Linux終端命令來安裝它。對於基於Debian的系統(如Ubuntu),請使用以下命令: ``` sudo apt-get install libxml2-dev sudo apt-get install libcurl4-openssl-dev sudo apt-get install libfontconfig1-dev ``` ### Ubuntu安裝 tidyverse `sudo apt install r-cran-tidyverse` ### 添加使用者 使用Rstudio Server的好處還有像是若有其他人想使用 可以設定新的使用者帳戶 每個人的環境都會是獨立的程式碼也不會被看到 `sudo adduser <user name>` # Zerotier 內網穿透(虛擬內網) 使用Zerotier可以讓我們其他不在同一網路環境的電腦也可以連上Rstudio Server 有興趣可以參考[用Zerotier內網穿透(虛擬內網)連線樹梅派Node-Red](/JUE-4pd2Te-TrHK7s42xtg) ![](https://hackmd.io/_uploads/SyHT-A5IY.png) ![](https://hackmd.io/_uploads/r1w7YLiLF.jpg) sudo zerotier-one -d sudo rstudio-server start [設定啟動執行](/bjzBi8IISL-OS7yCpsxt0Q) sudo systemctl enable zerotier-one.service sudo systemctl enable rstudio-server.service # 安裝R 4.0.X 安裝必要的依賴性,以便在 HTTPS 上新增儲存庫: `sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common` 將 CRAN 儲存庫新增到系統來源清單中: ``` sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/' ``` sudo apt install r-base R --version https://cran.r-project.org/bin/linux/ubuntu/ # 如何存取電腦 C: 磁碟機 本機電腦上的硬碟掛接點會自動建立 並可讓您輕鬆存取 Windows 檔案系統 /mnt/<磁碟機號>/ 範例用法是使用 cd /mnt/c 來存取 c:\**** # 如何存取WSL資料 \\wsl$ ![](https://hackmd.io/_uploads/BkXbp5NdY.png) # 資料控制 ```r= system("sudo -S mkdir /opt/shiny-server/samples/sample-apps/Wind-Rose/ ", input = rstudioapi::askForPassword("sudo password")) #建立資料夾 system("sudo -S cp ~/Wind-Rose/ui.R /opt/shiny-server/samples/sample-apps/Wind-Rose/", input = rstudioapi::askForPassword("sudo password")) #複製資料夾 system("sudo -S cp ~/Wind-Rose/ui.R /opt/shiny-server/samples/sample-apps/Wind-Rose/", input = rstudioapi::askForPassword("sudo password")) #複製資料夾 system("sudo -S cp /home/gtgrthrst/AHB.ttf /usr/share/fonts/", input = rstudioapi::askForPassword("sudo password")) #複製資料夾 ``` > 參考資料 >[Managing RStudio Workbench / RStudio Server](https://support.rstudio.com/hc/en-us/articles/200532327-Managing-the-Server) >https://docs.microsoft.com/zh-tw/windows/wsl/filesystems 🌟全文可以至下方連結觀看或是補充 全文分享至 https://www.facebook.com/LHB0222/ https://www.instagram.com/ahb0222/ 有疑問想討論的都歡迎於下方留言 喜歡的幫我分享給所有的朋友 \o/ 有所錯誤歡迎指教 # [:page_with_curl: 全部文章列表](https://hackmd.io/@LHB-0222/AllWritings) ![](https://i.imgur.com/nHEcVmm.jpg)

    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