After getting my Ubuntu virtual machine up and running, I'll need to install some software onto the machine that is not contained in the SOTU-db project repo. The two main programs I'll need are the web server Apache and the statistical analysis package R. I've decided to install R first.
Installing R is pretty straightforward once you know the fundamentals of installing software in Ubuntu. The command line installation guide provided by CRAN (the organization that distributes R) is pretty helpful. I'll walk through it here:
- add the CRAN repositories to sources.list
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/
and save, or CTRL+O for "WRITE OUT" just to remind me why I hate Linux text editors, then CTRL+X to exit, and we should be good on step 1!
STEP 2: Install the "Complete R System"
This step is really simple:
sudo apt-get update sudo apt-get install r-base
STEP 3: Go back a step, add security keys and another repo
This is where the R setup process always drives me crazy, and is an issue with countless Linux installation guides: running the apt-get update command from Step 2, above, results in a warning that the public key for the CRAN repo that we added in Step 1 is not available. If you scroll down the R installation guide, it tells you how to address this, and also mentions that "Installation and compilation of R or some of its packages may require Ubuntu packages from the “backports” repositories..." So:
STEP 3A: Add the Backports repo
I'm adding this to the same sources.list file as before, which now has two entries that look like this:
STEP 3B: Add public keys for R packages
Keep this step simple by just running
Now we can go back to Step 2 and run those commands again. I'm actually still getting a couple warnings on the update, but they seem ignorable (such as backports not having a "release" file, which seems to make sense to me). And install r-base ran without any errors.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
STEP 4: Install r-base-devFinally, we're going to install some additional developer packages. The guide says "Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package," and that's us, so here we go. This should be a simple matter of running
sudo apt-get install r-base-dev
STEP 5: Profit
Now I can run R (not r) and see that the program runs successfully. Next stop, Apache!