This guide covers the steps to install R 4.4.1 and configure RStudio Server on Ubuntu 22.04 using the official CRAN repository. Network restrictions initially prevented direct CRAN access, so manual key installation and repository setup were necessary. It also covers compatibility notes between R versions and RStudio Server on this system.
- The SSH bastion blocked direct access to CRAN repositories.
- Download and add the CRAN public key:
curl -fsSL https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/cran-archive-keyring.gpg- Add the CRAN repository to your sources:
echo "deb [signed-by=/usr/share/keyrings/cran-archive-keyring.gpg] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | sudo tee /etc/apt/sources.list.d/cran.list- Update package lists:
sudo apt update- List available R versions:
apt-cache policy r-base- Install R 4.4.1 explicitly:
sudo apt install r-base-core=4.4.1-3.2204.0- Verify R version:
R --version- Remove old R 4.1.2 installation to avoid conflicts:
sudo apt remove r-base-core=4.1.2-1ubuntu2
sudo apt autoremove- Confirm removal:
dpkg -l | grep r-base- Install RStudio Server (replace
<version>with your downloaded package version):
sudo dpkg -i rstudio-server-<version>.deb- Start and enable the service:
sudo systemctl start rstudio-server
sudo systemctl enable rstudio-server- Check status:
sudo systemctl status rstudio-server- Access via browser:
http://<server-ip>:8787
- Or create SSH tunnel (replace hostnames as needed):
ssh -L 58787:c8pu01:8787 grathore@facbastp0008.campus.net.ucsf.edu- Then open:
http://localhost:58787
- Login with system user credentials.
- R 4.5.0 is not stable or compatible with current RStudio Server versions on Ubuntu 22.04.
- R 4.4.1 is stable and works well with RStudio Server.
- Recommendation: Use R 4.4.1 until official support for R 4.5 is available.
| Step | Command/Action |
|---|---|
| Add CRAN key | curl -fsSL https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/cran-archive-keyring.gpg |
| Add CRAN repo | echo "deb [signed-by=/usr/share/keyrings/cran-archive-keyring.gpg] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | sudo tee /etc/apt/sources.list.d/cran.list |
| Update package lists | sudo apt update |
| Remove old R 4.1 | sudo apt remove r-base-core=4.1.2-1ubuntu2 |
| Install R 4.4.1 core | sudo apt install r-base-core=4.4.1-3.2204.0 |
| Install RStudio Server | sudo dpkg -i rstudio-server-<version>.deb |
| Start RStudio Server | sudo systemctl start rstudio-server |
| Enable auto-start RStudio Server | sudo systemctl enable rstudio-server |
| Access RStudio Server | http://<server-ip>:8787 or SSH tunnel |
- Replace placeholders like
<version>and<server-ip>with actual values. - Make sure your network allows required ports or use SSH tunneling as shown.
- Always verify RStudio Server compatibility with your R version before upgrading.
Feel free to customize or extend this README as needed.