Rstudio Linux Server Installation Configuration detailed description

Source: Internet
Author: User
Tags auth sessions touch

Rstudio Download Address:

http://rstudio.org/download/

Before installing the Rstudio tool, you need to install R, shut down and install the R under Linux, for reference:

R Language Linux Environment installation instructions

http://blog.csdn.net/tianlesoftware/article/details/7317725

Install Rstudioserver version:

[Root@rac1 r_language]# rpm-uvhrstudio-server-0.95.262-x86_64.rpm

Preparing ... ###########################################[100%]

1:rstudio-server ########################################### [100%]

Rsession:no process killed

Starting rstudio-server: [OK]

You have new mail in/var/spool/mail/root

Two. Manage Configuration Rstudio Server
2.1 Web Access Address
After you install and start Rstudioserver, you can access it through the Web, and by default the port of Rstudio Server is 8787, so we can access it using the following address:

http://<server-ip>:8787


Here we need to enter a username and password. There are 2 things to note about the username:

(1) User login with system user is not allowed, that is, users with IDs less than 100.

Example:

[Root@rac1 r_language]# ID

Uid=0 (Root) gid=0 (root) groups=0 (root), 1 (BIN), 2 (daemon), 3 (SYS), 4 (ADM), 6 (disk), (wheel) Context=unconfined_u: unconfined_r:unconfined_t:s0-s0:c0.c1023

--The UID of the root user here is 0.

[Root@rac1 r_language]# Su-oracle
Rac1:/home/oracle> ID

uid=500 (Oracle) gid=501 (oinstall) groups=501 (Oinstall), 502 (DBA), 503 (Asmadmin), 504 (oper) Context=unconfined_u: unconfined_r:unconfined_t:s0-s0:c0.c1023

The UID of the--oracle user is 50.

(2) The user's authentication can use RSA.

The following is a screenshot of my login with Oracle users:


If we cannot do it through the Web, you can use the following command to verify the installation of the Rstudio server:

[Root@rac1 r_language]# Rstudio-server verify-installation

stopping rstudio-server: [OK]

Starting rstudio-server: [OK]

2.2 Configuring Rstudio Server
Rstudio has 2 profiles, but by default, these 2 files are not created, and if we want to modify this configuration, we need to create these 2 files first:

[Root@rac1 rstudio]# touch/etc/rstudio/rserver.conf

[Root@rac1 rstudio]# touch/etc/rstudio/rsession.conf

[Root@rac1 rstudio]# ls

Installed rserver.conf rsession.conf Secure-cookie-key

After you create a configuration file, you can modify it, and you can use the command to verify the validity of the modification after you modify it:

[Root@rac1 rstudio]# Rstudio-server Test-config

Attention:

This command is also performed automatically when the Rstudio server is started and closed. This validation also complains when the configuration is not valid.

2.2.1 Configure network ports and addresses
The default port is 8787, and if we want to change to another port, we can add and modify the parameters in the/etc/rstudio/rserver.conf file:

Www-port=80

--Here we change the port to 80.

By default, Rstudio binds IP addresses to 0.0.0.0 so that any client address can be accessed. We can change to another address, add and modify parameters:

www-address=127.0.0.1

After the modification is completed, verify the parameter validity and restart the rstudio-server.

[Root@rac1 rstudio]# Rstudio-server Test-config

[Root@rac1 rstudio]# rstudio-server Restart

stopping rstudio-server: [OK]

Starting rstudio-server: [OK]

2.2.2 Settings Extension Library
If we add other libraries to the default Ld_library_path specify the library, you can add external to the/etc/rstudio/rserver.conf file through the Rsession-ld-library-path parameter The location of the library can be as follows:

Rsession-ld-library-path=/opt/local/lib:/opt/local/someapp/lib

2.2.3 Specify R version
By default, the R used by the Rstudio server runtime is the r specified in the system path, which can be determined using which r, and if there are multiple versions of R on our system, then the RSESSION-WHICH-R parameter can be used to specify Rstudio Which version of R is used. Such as:

Rsession-which-r=/usr/local/bin/r

After you add this parameter to the/etc/rstudio/rserver.conf file, you must restart the Rstudio server to take effect.

2.2.4 Set User Restrictions
If a large number of users use, it will consume a lot of resources, you can limit the use of some users of resources.

To add a auth-required-user-group parameter to the/etc/rstudio/rserver.conf file, you can specify the user who accesses the Rstudio:

Auth-required-user-group=rstudio_users

Verify that:

[Root@rac1 rstudio]# Useradd Dave

You have new mail in/var/spool/mail/root

[Root@rac1 rstudio]# passwd Dave

Changing password for user Dave.

New Password:

Bad password:it are too short

Bad Password:is too simple

Retype new Password:

Passwd:all Authentication tokens updatedsuccessfully.

[Root@rac1 rstudio]# Cat/etc/passwd|grepdave

Dave:x:502:506::/home/dave:/bin/bash

--Create a group to add a Dave user to the group:

[Root@rac1 rstudio]# Groupadd rstudio_users

[Root@rac1 rstudio]# usermod-g rstudio_users-g rstudio_users Dave

Specify the user group in the/etc/rstudio/rserver.conf file, and only users who belong to the reorganization can use Rstudio.

Auth-required-user-group=rstudio_users

[Root@rac1 rstudio]# Rstudio-server Test-config

[Root@rac1 rstudio]# rstudio-server Restart

stopping rstudio-server: [OK]

Starting rstudio-server: [OK]

Now only Dave users can access it, and Oracle users cannot access it.

Of course, you can add some other resource constraints, such as total memory, stack size, and number of processes, such as:

rsession-memory-limit-mb=4000

rsession-stack-limit-mb=10

rsession-process-limit=100

You need to restart the service after adding to/etc/rstudio/rserver.conf to take effect.

2.2.5 Other Settings
All of the above are/etc/rstudio/rserver.conf configuration, and the other configuration file is/etc/rstudio/rsession.conf, which can configure information related to r session. This parameter is useful when r users are many, and can display session information.

The following configuration is written in the/etc/rstudio/rsession.conf file.

By default, when a user does not execute a command for 2 hours, Rstudio suspend the user's r session and writes the information to disk, thereby reducing resource consumption and the session being restored the next time the user uses it.

You can specify when the session expires by using the Session-timeout-minutes parameter, such as:

Session-timeout-minutes=30

If this is set to 0, this feature is disabled. The user session will not be suspend and run all the time.

Other restrictions include the LIMIT-FILE-UPLOAD-SIZE-MB parameter, which can display the maximum upload size, such as:

limit-file-upload-size-mb=100

You can also specify a default Cran repository service address, such as:

r-cran-repos=http://cran.case.edu/

2.3 Managing Rstudio Server
The management of Rstudio server is done through the Rstudio-server command, which enables, stops, restarts, and so on.

[Root@rac1 rstudio]# Rstudio-server

usage:rstudio-server{start|stop|restart|test-config|verify-installation|suspend-session|suspend-all| Force-suspend-session|force-suspend-all|offline|online|active-sessions|version}

2.3.1 Stopping and starting
If you use a package to install the Rstudio, the Rstudio is automatically registered to the system and will start automatically when the system starts.

On the Ubuntu system, the startup script is:

/etc/init/rstudio-server.conf

On other systems, the startup script is:

/etc/init.d/rstudio-server

The manual operation commands are as follows:

$ rstudio-server Stop

$ rstudio-server Start

$ rstudio-server Restart

2.3.2 Managing Active Sessions
You can view the session of an activity using the following command:

[Root@rac1 init.d]# Rstudio-server active-sessions

PID Time Command

496900:00:09/usr/lib/rstudio-server/bin/rsession-u Oracle

838900:00:04/usr/lib/rstudio-server/bin/rsession-u Dave.

You have new mail in/var/spool/mail/root

[Root@rac1 init.d]#

Here are 2 active sessions.

--suspend a session:

$ rstudio-server suspend-session<pid>

[Root@rac1 init.d]# rstudio-serversuspend-session 4969

--suspend All Sessions:

$ sudo rstudio-server suspend-all

[Root@rac1 init.d]# sudo rstudio-serversuspend-all

The Suspend command also has a force variable that interrupts any of the r operations of the session:

$ sudo rstudio-server force-suspend-session<pid>

$ sudo rstudio-server force-suspend-all

Before the system reboot, the Force-suspend-all is executed to ensure that the activity R sessions data is written to disk in time.

2.3.3 Taking the Server Offline
If you want to perform system maintenance, let the user receive a friendly message, you can perform a serveroffline operation, which will display the server temporary offline on the user Web.

[Root@rac1 init.d]# rstudio-server offline

stopping rstudio-server: [OK]

Starting rstudio-server: [OK]

You have new mail in/var/spool/mail/root

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.