How to install R on Solaris on a VirtualBox virtual machine?

A more up-to-date version is available from csw: r_base. To install, see the example in Getting started where you replace vim with r_base:

pkgadd -d http://get.opencsw.org/now
/opt/csw/bin/pkgutil -U
/opt/csw/bin/pkgutil -a r_base
/opt/csw/bin/pkgutil -y -i r_base

To install a development environment, you might also want:

/opt/csw/bin/pkgutil -y -i gcc4g++
/opt/csw/bin/pkgutil -y -i texlive

Start by downloading and installing Oracle VM VirtualBox.

Then download and unzip the Oracle Solaris 11.1 VirtualBox Template. After you unzip the Oracle template you should see a file called OracleSolaris11_1.ova, that's what you'll open in VirtualBox.

Start VirtualBox, click on File, then Import Appliance, then navigate to chose the ova file you just extracted. It will take some time to import.

Start the Solaris virtual machine by clicking on the start button on VirtualBox. It will take some time to start up and you'll be prompted to add a root password, user name and user password. You'll then use those details to log in, wait for the system to load, choose gnome to ensure you get a desktop environment, and choose your time zone, keyboard layout and language (mine seems to highlight Chinese as the default choice, so be careful not to click through that one too quickly).

Eventually you'll get a desktop, right-click on the desktop and click open terminal, then in the terminal type (or paste):

sudo wget https://oss.oracle.com/ORD/ord-3.0.1-sol10-x86-64-sunstudio12u3.tar.gz && sudo wget https://oss.oracle.com/ORD/ord-3.0.1-supporting-sol10-x86-64-sunstudio12u3.tar.gz

That will connect to the internet and download two files you need. The next line will unpack those two archives:

sudo tar -xzvf ord-3.0.1-sol10-x86-64-sunstudio12u3.tar.gz && sudo tar -xzvf ord-3.0.1-supporting-sol10-x86-64-sunstudio12u3.tar.gz 

And then this next line installs R, watch for the prompts after you run the line:

sudo bash install.sh 

A lot will flash by in the terminal, concluding with Installation of <ORD> was successful

Now the next bit is where I deviate from the instructions here because I didn't understand them. You'll move all files beginning with lib from the archives that you unpacked into another directory where they are needed by R:

sudo mv lib* /usr/lib/64/R/lib/

That will return nothing in the terminal. Then we can run R simply by typing in the terminal like so

R

And now you should have a regular R session running in the terminal.