Adding RStudio to Anaconda Enterprise (AE) 5¶
This topic covers how to install RStudio and use it within AE5.
Note
Anaconda recommends installing RStudio during a scheduled maintenance interval to prevent users from creating new sessions during installation. Existing sessions or deployments do not need to be halted.
Prerequisites¶
These instructions are written for AE version 5.5.2 or later, and require the /tools
volume from managed persistence to be enabled. For more information, see Mounting an external file share.
Installing RStudio¶
Launch the RStudio installer project¶
Log in to AE5 as a user with read/write access to the
/tools
volume. Typically, this will be theanaconda-enterprise
user.Download the RStudio installer project and save it to your machine.
Open a new browser window and login to AE5.
Use the Create+ / Upload Project dialog to upload the RStudio installer project you just downloaded. Anaconda recommends using the JupyterLab editor for this project.
Open a session for the RStudio installer project.
Obtain the RStudio Server binaries¶
Now that your project is created, you need to obtain and install the Red hat Package Manager (RPM) files and pull them into the project session. There are multiple methods for accomplishing this.
Downloading RStudio directly from AE5¶
Anaconda recommends users with clusters that have internet access download RStudio directly through AE5.
From your RStudio project session, open a new terminal window.
If you need to set proxy variables manually to access the internet, do so now.
Run the command:
bash download_rstudio.sh
The output from the script will look something like this:
+------------------------+
| AE5 RStudio Downloader |
+------------------------+
- Target version: 2021.09.1-372
- Downloading into the data directory
- Downloading RHEL8/CentOS8 RPM file to data/rs-centos8.rpm
- URL: https://download2.rstudio.org/server/centos8/x86_64/rstudio-server-rhel-2021.09.1-372-x86_64.rpm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 58.3M 100 58.3M 0 0 250M 0 --:--:-- --:--:-- --:--:-- 249M
- Verifying data/rs-centos8.rpm
- Downloading RHEL7/CentOS7 RPM file to data/rs-centos7.rpm
- URL: https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-2021.09.1-372-x86_64.rpm
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 58.3M 100 58.3M 0 0 193M 0 --:--:-- --:--:-- --:--:-- 193M
- Verifying data/rs-centos7.rpm
+------------------------+
The RStudio binaries have been downloaded.
You may now proceed with the installation step.
See the README.md file for more details.
+------------------------+
Using the download script on another Unix server¶
If you need to download the binaries on a separate machine first, use the download_rstudio.sh
script.
Download the script file
download_rstudio.sh
from the project to your desktop.Move the script file to a machine that can run
bash
andcurl
and has connectivity todownload2.rstudio.org
.Run the command:
bash download_rstudio.sh
If necessary, transfer the binaries
rs-centos7.rpm
andrs-centos8.rpm
to the machine from which you access AE5.Use the JuptyerLab upload button to upload both binaries into the RStudio installer project.
Manually obtaining the files¶
If it is not possible for you to use the download_rstudio.sh
script, you must obtain the files manually.
The installation process requires two different RPM files that have identical filenames. For this reason, obtaining the files manually requires that each file is renamed after downloading.
Download the CentOS 8 RPM:
https://download2.rstudio.org/server/centos8/x86_64/rstudio-server-rhel-2021.09.0-351-x86_64.rpm
Rename this file
rs-centos8.rpm
.Download the CentOS 7 RPM:
https://download2.rstudio.org/server/centos7/x86_64/rstudio-server-rhel-2021.09.0-351-x86_64.rpm
Rename this file
rs-centos7.rpm
.If necessary, transfer the files to the machine you use to access AE5.
Use JuptyerLab’s upload button to upload both binaries into the RStudio installer project.
Run the installation script¶
Now that you have obtained the RStudio binaries and placed the rs-centos7.rpm
and rs-centos8.rpm
files in the correct locations:
Open a terminal window.
If you have previously installed content into
/tools/rstudio
, remove it now. Run the command:rm -r /tools/rstudio
Run the command:
bash install_rstudio.sh
Note
The script will verify that all prerequisites are met before performing any file modifications.
The output from the installer will look like this:
+-----------------------+
| AE5 RStudio Installer |
+-----------------------+
- Install prefix: /tools/rstudio
- Verifying data/rs-centos8.rpm
- Verifying data/rs-centos7.rpm
- Creating directory /tools/rstudio
- Staging full RHEL8/CentOS8 package
1069677 blocks
- Staging RHEL7/CentOS7 rsession binary
1069390 blocks
- Moving files into final position
- Installing support files
+-----------------------+
RStudio installation is complete.
Once you have verified the installation, feel free to
shut down this session and delete the project.
+-----------------------+
Enable RStudio as an editor¶
With installation complete, the next step is to add RStudio to the editor selection list within AE5s User Interface (UI).
Return to the
anaconda-platform
ConfigMap editor you left open earlier and search for therstudio:
section of the file. The default values in this section will look like this:rstudio: default: false hidden: true label: RStudio
Change the value
hidden: true
tohidden: false
.Once you have verified the correct formatting, click Save Changes.
Return to the kubectl terminal window you left open earlier and restart the UI pod:
kubectl get pods | grep 'ap-ui-' | cut -d' ' -f1 | xargs kubectl delete pods
Note
Minor disruptions in UI responsiveness may occur while the pod is stabilizing. If you have allowed users to continue working during this installation, they may need to refresh their browsers.
Once the UI pod stabilizes, the RStudio editor will be present in the Default Editor dropdown on the project’s Settings page.
With RStudio enabled as an editor, your Op-Center will typically look like this:
Verify your installation¶
If necessary, stop the session for your RStudio installer project.
Go to the project’s Settings page.
Select RStudio in the Default Editor dropdown, and click Save.
Start a new session and wait for the editor to launch.
If your installation is unsuccessful:
Click on the Logs tab.
Search the editor logs for a section titled AE5 R Session Manager and look for errors there and below.
Copy the full content of this log so it can be shared with Anaconda.
Stop the session completely.
Go to the project’s Settings page, and change the Default Editor back to JupyterLab.
If your errors are obvious to you and understand what corrective action is needed, open a new session to make those changes.
Please reach out to Anaconda support if this occurs. Make sure to include a copy of the editor logs you obtained above.
Disabling RStudio¶
To remove RStudio as an editor option for new projects:
Open your
anaconda-platform.yml
ConfigMap.Search for the
rstudio:
section of this file. The default values in this section will look like this:rstudio: default: false hidden: true label: RStudio
Once you have verified the correct formatting, click Save Changes.
Return to the
kubectl
terminal window you left open earlier and restart the UI pod:kubectl get pods | grep ap-ui | cut -d ' ' -f 1 | xargs kubectl delete pods
Existing projects that have RStudio installed will still have access to the editor. You can revert hidden: false
to hidden: true
at any time to re-enable RStudio as an editor option for new projects.
Uninstalling RStudio¶
Caution
If you need to permanently remove /tools/rstudio
, instruct all users to stop all sessions currently using RStudio and choose a different editor, such as JupyterLab, before continuing. If they do not, sessions will fail to fully start.
To permanently uninstall RStudio, you need to remove the /tools/rstudio
directory. Anaconda recommends removing the directory from outside AE5 if possible. If necessary, instructions are provided to remove RStudio using AE5.
Uninstalling RStudio using AE5¶
Log in to AE5 as a user with read/write access to the
/tools
volume. Typically, this will be theanaconda-enterprise
user.Remove
/tools/rstudio
from within an AE5 session. Run the command:
rm -r /tools/rstudio
Upgrading to a new version of AE5¶
Upgrading to a new version of AE5 will not affect your RStudio installation; however, the upgrade process will cause the editor to be hidden. Once the upgrade is complete, you’ll need to enable RStudio as an editor again.
Upgrading RStudio¶
Anaconda recommends performing a fresh installation when upgrading RStudio.
(Optional) Rename your existing RStudio directory. If your installation is unsuccessful for any reason, you can rename the existing RStudio directory back to its original state to avoid downtime. Run the command:
mv /tools/rstudio /tools/rstudio.old
Instruct all users to stop all sessions currently using RStudio.
If necessary, remove the old installation
/tools/rstudio.old
. Run the command:rm -r /tools/rstudio.old
Log out of AE5.
Installing RStudio on additional AE5 instances¶
Once you have successfully installed RStudio on one instance, you can copy and move the /tools/rstudio
directory to another instance, reducing the amount of work involved for a second install.
Create an archive of an existing installation¶
Log in to an instance of AE5 with a running RStudio installation.
Open a session using the JupyterLab editor.
Open a terminal window.
Create the archive. Run the command:
tar cfz rstudio.tar.gz -C /tools rstudio
Download this file to your desktop. Once you have done so, you can remove the file from your AE5 session.
Move the archive to a new instance¶
Open any session using the JupterLab editor.
Upload the archive
rstudio.tar.gz
into the project.Open a terminal window.
(Optional) Rename your existing RStudio directory. If your installation is unsuccessful for any reason, you can rename the existing RStudio directory back to its original state to avoid downtime. Run the command:
mv /tools/rstudio /tools/rstudio.old
Install the archive. Run the command:
tar xfz rstudio.tar.gz -C /tools
If necessary, remove the old installation
/tools/rstudio.old
. Run the commmand:rm -r /tools/rstudio.old
Log out of AE5.