I mainly use Windows but need to work on Linux for development. One way to use Linux on my Windows machine is using VirtualBox. I used to have CentOS destop distribution but it was too much as I didn’t need most of its desktop features. A Linux server is good for this purpose but it was quite out of hand until I found out a guest machine can be connected via SSH and RStudio Server. In this post, a quick way to connect to a Ubuntu guest via SSH using Putty and RStudio Server is illustrated. Also a way to transfer a file between the machines using WinSCP is demonstrated.
Once a VM is installed, it is necessary to set up two network adapters: Bridged Adapter and Host-only Adapter. My setup is shown below. (See further details here.)
Then OpenSSH Server should be installed in the guest machine and connection via port 22 should be allowed - it is the default SSH port. This job can easily be done as following.
The ip address of the guest can be checked by
ip addr and it can be used to set up a session in Putty (
Setting up a Putty session is as simple as the following.
Once the above steps work well, it is possible to connect to the guest via SSH.
Transferring a file to and from a guest can be done easily using WinSCP. The session login window is quite intuitive and mine is shown below.
Once logged on, a file can be dragged and dropped between the machines.
Putty Terminal may or may not be good to work on and it may be not if R is used interactively. In this case, RStudio server can be a good option.
As the lastest version of R is not included in Ubuntu LTS, it is good to install the latest version as recommended in the download page. I added the following line in
When I tried to update the package by
sudo apt-get update, however, GPG error was encountered, indicating NO_PUBKEY 51716619E084DAB9. After some search, I was able to resolve it by the following. (See this)
Then I was able to install R and the development packages.
If you need to install a package that requires curl and xml libraries (eg devtools), they should be installed.
Then Rstudio Server can be connected via a browser of the host machine. Type guest-ip-address:8787 in the address bar. The guest machine’s user name and password can be used to log on. Mine is shown below.