How to Install RStudio Server on NixOS latest

In this tutorial, we will guide you through the process of installing RStudio Server on NixOS latest operating system.

Step 1: Update the Operating System

The first step is to update the operating system packages to their latest version.

$ sudo nix-channel --update
$ sudo nixos-rebuild switch

Step 2: Install R

Next, you need to install R on your system. To do so, open the terminal and type in the following commands.

$ sudo su -
# nix-env -i R

This will install the latest R package on your system.

Step 3: Install the RStudio Server

You can download the latest version of the RStudio server from the official website of RStudio using the following command.

$ wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.4.1717-amd64.deb

Once the download is complete, run the command to install the RStudio server package:

$ sudo dpkg -i rstudio-server-1.4.1717-amd64.deb

Step 4: Configure the RStudio Server

After installing the RStudio server, you need to configure it.

Edit the following file to allow user login with Linux username:

$ sudo nano /etc/rstudio/rserver.conf

Add the following lines below the www-port line:

auth-minimum-user-id=1000
auth-validate-users=false

Save and close the file.

Step 5: Start the RStudio Server

Finally, you can start the RStudio server using the following command:

$ sudo systemctl start rstudio-server

To enable the server to start automatically after booting, run the command:

$ sudo systemctl enable rstudio-server

Conclusion

We have successfully installed and configured the RStudio server on NixOS latest operating system. You can now access the RStudio server by opening your web browser and entering the URL http://localhost:8787.