Skip to content

Commit 1fc40d5

Browse files
authored
Merge pull request #207 from carpentries/linux-install
Update Linux install instructions
2 parents e1160ec + 028e6eb commit 1fc40d5

File tree

1 file changed

+46
-53
lines changed

1 file changed

+46
-53
lines changed

learners/setup.md

Lines changed: 46 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ its website at <https://pandoc.org/installing.html>
167167

168168
#### Test your installation
169169

170-
We will wait to test the pandoc installation after we install the
170+
We will wait to test the pandoc installation after we have installed the
171171
infrastructure packages, to make sure it's discoverable by R.
172172

173173
### Infrastructure R packages
@@ -289,7 +289,7 @@ follow the instructions to install pandoc on your computer.
289289

290290
#### Test your installation
291291

292-
We will wait to test the pandoc installation after we install the
292+
We will wait to test the pandoc installation after we have installed the
293293
infrastructure packages, to make sure it's discoverable by R.
294294

295295
### Infrastructure R packages
@@ -311,20 +311,18 @@ install.packages(c("sandpaper", "varnish", "pegboard"))
311311

312312
## Installing on Linux {#linux}
313313

314-
A lot of the documentation for Linux is nuanced because it assumes that if you
315-
use Linux, then you automatically know how to install things by the command
316-
line. I will be providing instructions as best I can for Ubuntu Linux and point
317-
to resourced for other distributions. For Ubuntu/Debian, the default `apt`
318-
repository is often out of date, so you will need to use a
314+
Instructions for installing on Linux are nuanced due to the variety and availability of
315+
libraries and dependencies for each distribution, e.g. Ubuntu is Debian based whereas
316+
Fedora is Red Hat based. These instructions will use Ubuntu as the preferred distribution.
317+
The default `apt` repository is often out of date, so you will need to use a
319318
[Personal Package Archive aka PPA](https://itsfoss.com/ppa-guide/) to install
320-
the latest version of a particular software, which I will include in these
319+
the latest version of a particular software, which will be included in these
321320
instructions.
322321

323322
### Git
324323

325-
You should have git pre-installed on your computer, but it will likely be
326-
outdated. It's okay if this is the case, but if you want to update via `apt`,
327-
you can add the git-core ppa:
324+
Many distributions include git by default, but it is often outdated.
325+
It is useful to try to update in case a newer version is available:
328326

329327
```bash
330328
sudo add-apt-repository ppa:git-core/ppa
@@ -345,9 +343,9 @@ git version 2.31.1
345343

346344
### R
347345

348-
To install R, you can visit <https://cran.r-project.org/bin/linux/> to check if
349-
your platform is supported. For Ubuntu, there are detailed instructions at:
350-
<https://cran.r-project.org/bin/linux/ubuntu/>. Here are the commands to register
346+
To install R, you can visit [CRAN's Linux page](https://cran.r-project.org/bin/linux/) to check if
347+
your platform is supported. Detailed instructions exist [for Ubuntu](https://cran.r-project.org/bin/linux/ubuntu/).
348+
Here are the commands to register
351349
the PPA on your machine and then install R:
352350

353351
```bash
@@ -393,11 +391,11 @@ There are two ways to install pandoc:
393391

394392
#### Via RStudio (recommended)
395393

396-
Since pandoc comes bundled with RStudio, you can install it by installing the
397-
latest version of RStudio. You can [download the installer from the RStudio
394+
Pandoc comes bundled with RStudio. You can [download the installer from the RStudio
398395
website][RStudio]. When installing RStudio for Linux, your distribution may not
399-
be shown on the landing page (e.g. Ubuntu 20.04). In this case, choose the most
400-
recent version and download it to your Downloads folder or install it directly.
396+
be shown on the landing page. If your Ubuntu version is not listed, check the
397+
[RStudio Previous Versions](https://docs.posit.co/previous-versions/rstudio.html) page
398+
to see if there are builds available.
401399

402400
::::::::::: callout
403401

@@ -411,45 +409,42 @@ instructions at <https://posit.co/code-signing/>.
411409

412410
#### Via the pandoc website
413411

414-
If are more comfortable using R from the command line, then you can install
415-
pandoc by clicking the "Download the latest installer" button at
416-
<https://pandoc.org/installing.html>. This will bring you to the release page
417-
on GitHub with a list of installers, and you should choose one of the ones that
418-
says "linux" according to what chip architecture you have (AMD vs ARM).
412+
If you are more comfortable using R from the command line, then you can install
413+
pandoc from the [releases page](https://pandoc.org/installing.html). From the list on the GitHub page,
414+
for Ubuntu, choose the appropriate `.deb` file for your chip architecture (i.e. AMD64 or ARM64).
419415

420416
#### Test your installation
421417

422-
We will wait to test the pandoc installation after we install the
418+
We will wait to test the pandoc installation after we have installed the
423419
infrastructure packages, to make sure it's discoverable by R.
424420

425421
### Infrastructure R packages
426422

427-
Linux packages normally need to be compiled by your system, which can take a
423+
Linux packages normally need to be compiled into binaries by your system, which can take a
428424
long time the first time it happens. RStudio provides a package manager that
429425
pre-compiles Linux binaries. Note that you do not have to be using RStudio to
430426
take advantage of these binaries. The one we are using is set up for Ubuntu
431-
20.04 (focal).
427+
22.04 (jammy).
432428

433429
::::: callout
434430

435431
#### Dependencies of Dependencies
436432

437433
If you are not used to installing software on Linux, it can be frustrating
438-
sometimes because few things ever "just work" when you try to install them. The
434+
sometimes because things can go wrong and it’s not always immediately clear why. The
439435
same is true for some R packages with compiled code.
440436

441437
Some packages require underlying C libraries (e.g. the xml2 library), which are
442438
catalogued for Ubuntu in [The Carpentries R
443439
Universe](https://carpentries.r-universe.dev/ui#builds) and [available via the
444-
API](https://carpentries.r-universe.dev/ui#api). If you want to view the
445-
packages that are required (some of which may already be on your system), you
446-
can use `curl` and `jq` to produce a list:
440+
API](https://carpentries.r-universe.dev/apis). To produce a list
441+
(you may need to `sudo apt install jq` if it is not already on your system):
447442

448443
```bash
449444
curl https://carpentries.r-universe.dev/stats/sysdeps 2> /dev/null | jq -r '.headers[0] | select(. != null)'
450445
```
451446

452-
This list can be sent to `apt-get install` to install everything:
447+
This list can be sent to `apt install` to install everything:
453448

454449
```bash
455450
sudo apt-get install -y \
@@ -504,9 +499,8 @@ install.packages(c("sandpaper", "varnish", "pegboard"))
504499

505500
#### Saving these settings for later
506501

507-
Having binary packages for Linux was a game changer when they appeared and it's
508-
a good idea to have the above code run every time you start R so that you can
509-
take advantage of them. Add the code below to your `~/.Rprofile`.
502+
To not have to run this block of code every time you want to update,
503+
add the following code into your `~/.Rprofile` to run it every time you open your terminal:
510504

511505
::::::::::::::::::::::::
512506

@@ -567,6 +561,7 @@ compilation terminated.
567561

568562
Use the instructions in these logs to install the correct package from your
569563
terminal and then open R or RStudio and retry installing the packages.
564+
For example, for the error above, use `sudo apt install libxslt1-dev`.
570565

571566
:::::::::::::::::::::
572567

@@ -620,27 +615,14 @@ fs::dir_tree(tmp, recurse = 1)
620615
```
621616

622617
If the installation did not work, please [raise an issue on
623-
GitHub](https://github.com/carpentries/sandpaper-docs/issues/new) and I can help
624-
troubleshoot.
618+
GitHub](https://github.com/carpentries/sandpaper-docs/issues/new).
625619

626620
## Installation FAQ
627621

628622
### Why does it take 5 lines of code to install the infrastructure?
629623

630-
In the future, this will be ONE line of code!
631-
632-
Since we are currently in the alpha phase of testing, the infrastructure can
633-
update at any moment. Normally, packages will come from
634-
[CRAN](https://glosario.carpentries.org/en/#cran), but our development packages
635-
are not yet on CRAN, so the are stored in The Carpentries and rOpenSci
636-
development repositories.
637-
638-
### Do I really need to use RStudio?
639-
640-
No. We recommend using RStudio for [several reasons that pertain to ease of
641-
use and standardisation across systems](#recommend), but we do not absolutely
642-
require it. If you are able to get Git, R, and pandoc installed on your system,
643-
then you do not need to use RStudio.
624+
As the Workbench packages are in The Carpentries R-Universe and not CRAN,
625+
we need to tell R to get the packages from R-Universe.
644626

645627
### What is an R Library?
646628

@@ -653,17 +635,25 @@ Installing packages into ‘c:/Users/USER/Documents/R/win-library/4.0’
653635
(as ‘lib’ is unspecified)
654636
```
655637

638+
On Ubuntu, this may look like:
639+
640+
```
641+
Installing packages into ‘/home/<user>/R/x86_64-pc-linux-gnu-library/4.4’
642+
```
643+
656644
This folder is where all of the R packages you install via `install.packages()`
657645
will live. If you ever need to look this up, you can use the `.libPaths()`
658-
function.
646+
function.
647+
648+
### Using a personal library
659649

660650
Sometimes, your R session will issue a warning that says a folder is not
661651
writeable and asks if you would like to use a personal library instead. In this
662652
case, select "yes".
663653

664-
## Using the lesson engine
654+
## Opening your R environment
665655

666-
Throughout the lesson, I will ask you to **open R or RStudio**. If you are using
656+
If you are using
667657
RStudio, you can open it by double-clicking on the RStudio icon in your
668658
application launcher; you do not have to open R separately to use RStudio.
669659

@@ -712,6 +702,9 @@ If you do not have this set up, you should [choose a protocol
712702
](https://docs.github.com/en/github/getting-started-with-github/about-remote-repositories)
713703
and then set them up according to the instructions from GitHub.
714704

705+
It’s recommended to use the SSH protocol, unless you explicitly cannot,
706+
e.g. behind an institutional firewall or proxy.
707+
715708
:::::::::::::::: callout
716709

717710
### Is GitHub's Documentation Confusing?

0 commit comments

Comments
 (0)