laitimes

Linux native RStudio tool installation & remote access

author:Cpolar pole cloud

preface

RStudio Server brings the power and productivity of RStudio IDE to a centralized, server-based environment by enabling you to run the RStudio IDE you know and love on a Linux server and access it through a web browser.

The following introduces the installation of RStudio Server in Linux docker and combined with cpolar intranet penetration tool to achieve remote access, docker installation can avoid many problems, one-click installation, if the device is not installed docker, you need to install docker in advance

1. Install RStudio Server

Execute the docker one-click startup command, where -e PASSWORD= set your own login password, port default 8787, other parameters default

docker run -itd -p 8787:8787 --name rstudio -e PASSWORD=自己设置密码 --privileged=true -v /srv/shinyapps/:/home/rstudio/shinyapps -v /srv/shinylog/:/home/rstudio/shinylogs rocker/rstudio            

After execution, the image will be automatically downloaded, and then the container will be started, after completion, enter docker ps to see the running RStudio container, the port of running and mounting is: 8787, docker installation is completed, very simple and fast, and saves cumbersome environment configuration

Linux native RStudio tool installation & remote access

2. Local access

After the above installation is completed, access the Linux 8787 port, such as LAN access, you need to check the firewall, here use Linux internal browser access, you can see the successful access

Linux native RStudio tool installation & remote access

Enter the user name: rstudio and the password you set, you can log in successfully, so that the Linux RStudio Server installation and normal access are completed, install the cpolar tool below, and RStudio can also be accessed in any device browser

Linux native RStudio tool installation & remote access

3. Linux installation cpolar

Above we successfully installed RStudio server, and LAN access ok, below we install cpolar intranet penetration tool in Linux, through cpolar forwarding the HTTP public address mapped by local port, we can easily achieve remote access without registering a domain name to buy a cloud server. Here are the steps to install cpolar

Cpolar's official website address: https://www.cpolar.com
  • Use one-click script installation commands
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash           
  • Add a service to the system
sudo systemctl enable cpolar           
  • Start the cpolar service
sudo systemctl start cpolar           

After cpolar is successfully installed, access the Linux port 9200 on an external browser, that is: [http:// LAN IP: 9200], log in with the cpolar account, and after logging in, you can see the cpolar web configuration interface, and then configure it in the web management interface

Linux native RStudio tool installation & remote access

4. Configure the RStudio server public network access address

Click Tunnel Management on the left dashboard - Create Tunnel and create an RStudio cpolar public address tunnel!

  • Tunnel Name: You can customize the name, be careful not to duplicate the existing tunnel name
  • Protocol: Select HTTP
  • Local address: 8787 (docker-mounted port)
  • Domain name type: Choose a random domain name for free
  • Region: Select China VIP

Click Create

Linux native RStudio tool installation & remote access

After the tunnel is successfully created, click Status - Online Tunnel List on the left to view the generated public network access address, there are two access methods, one is http and https

Linux native RStudio tool installation & remote access

5. Public network remote access RStudio

Use the above https public address to access the browser of any device, you can successfully see our RStudio interface, such a public network address and remote access is created, new address access, you may need to log in again

Linux native RStudio tool installation & remote access

Enter the account password, you can log in successfully, such a remote address is created, in cpolar, the default is a random address, below we set a fixed address

Linux native RStudio tool installation & remote access

6. Fixed RStudio public network address

Since the tunnel created by using cpolar above uses a random public network address, it will change randomly within 24 hours, which is not conducive to long-term remote access. Therefore, we can configure a second-level subdomain for it, which is a fixed address and will not change randomly [ps:cpolar.cn has been filed]

Note that you need to upgrade the cpolar plan to the basic plan or above, and the bandwidth corresponding to each plan is different. 【cpolar.cn Recorded】

Log in to the official website of cpolar, click Reservation on the left, select Reserve Second-level Subdomain, set a second-level subdomain name, click Reserve, and copy the reserved second-level subdomain name after the reservation is successful

Linux native RStudio tool installation & remote access

Copy the name of the second-level subdomain name after the reservation is successful

Linux native RStudio tool installation & remote access

Return to the cpolar web UI management interface, click Tunnel Management - Tunnel List in the dashboard on the left, find the tunnel to be configured, and click Edit on the right

Linux native RStudio tool installation & remote access

Modify the tunnel information to configure the second-level subdomain name that retains the successful second-level subdomain name into the tunnel

  • Domain type: Select a second-level subdomain
  • Sub Domain: Enter the second-level subdomain name that has been successfully reserved

Click Update (note that clicking Update once is sufficient, no need to submit repeatedly)

Linux native RStudio tool installation & remote access

After the update is complete, open the online tunnel list, and you can see that the public network address has changed, and the address name has changed to the domain name of the fixed second-level subdomain name

Linux native RStudio tool installation & remote access

Finally, we use a fixed public address to access the RStudio tool, you can see that the access is successful, such a fixed and permanent public address is set, the new address access, you may need to log in again!

Linux native RStudio tool installation & remote access
Reprinted from the cpolar Pole Cloud article: Linux Local RStudio Tool Installation & Remote Access

Read on