---
title: "Linux Systems"
author: "Colin Rundel"
date: "2019-01-15"
output:
  xaringan::moon_reader:
    css: "slides.css"
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false

---
exclude: true

```{setup r, message=FALSE, warning=FALSE, include=FALSE}
options(crayon.enabled = TRUE)
```

---
background-image: url(imgs/Lec01/linux_tree.png)
background-size: contain
background-position: center
background-repeat: no-repeat

---
class: center, middle
count: false

# Duke Virtual Computing Manager

---
class: center, middle

![](imgs/Lec01/vcm1.png)

<br/><br/>

### https://vcm.duke.edu/

---
class: center, middle

![](imgs/Lec01/vcm2.png)

---
class: center, middle

![](imgs/Lec01/vcm3.png)

---
class: center, middle

![](imgs/Lec01/vcm4.png)

---
class: center, middle
count: false

# Getting Started

---

## Connecting

.small[
```shell
rundel@tbBook [~]$ ssh cr173@vcm-8122.vm.duke.edu
```
]

--

.small[
```shell
The authenticity of host 'vcm-8122.vm.duke.edu (67.159.94.235)' can't be established.
ECDSA key fingerprint is SHA256:V16KiDDRyVXXhrPCscMrlLbF1fu4sU4CMXEyGDJ5OTw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'vcm-8122.vm.duke.edu,67.159.94.235' (ECDSA) to the list of known hosts.
cr173@vcm-8122.vm.duke.edu's password:
```
]

--

.small[
```shell
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-20-generic x86_64)

...
...
...

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

cr173@vcm-8122:~$
```
]


---

## Determining Distribution

This does not work 100% of the time but is generally pretty reliable,

```shell
cat /etc/*-release
```

--

.tiny[ .columns[

.ubuntu[
```
*cr173@vcm-8122:~$ ls -l /etc/*-release
-rw-r--r-- 1 root root 105 Aug 19 19:43 /etc/lsb-release
lrwxrwxrwx 1 root root  21 Aug 19 19:44 /etc/os-release -> ../usr/lib/os-release
```

```
*cr173@vcm-8122:~$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
```
]

.fedora[
```
*cr173@saxon [~]$ ls -l /etc/*-release
-rw-r--r--. 1 root root 33 Oct 24  2017 /etc/fedora-release
lrwxrwxrwx. 1 root root 21 Oct 24  2017 /etc/os-release -> ../usr/lib/os-release
lrwxrwxrwx. 1 root root 14 Oct 24  2017 /etc/redhat-release -> fedora-release
lrwxrwxrwx. 1 root root 14 Oct 24  2017 /etc/system-release -> fedora-release
```

```
*cr173@saxon [~]$ ssh cr173@saxon.stat.duke.edu cat /etc/*-release
Fedora release 27 (Twenty Seven)
NAME=Fedora
VERSION="27 (Twenty Seven)"
ID=fedora
VERSION_ID=27
PRETTY_NAME="Fedora 27 (Twenty Seven)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:27"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=27
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=27
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
Fedora release 27 (Twenty Seven)
Fedora release 27 (Twenty Seven)
```
]
] ]

---
background-image: url(imgs/Lec01/unixpermissions.png)
background-size: contain
background-position: center
background-repeat: no-repeat

---
class: middle center
count: false

# System Details

---

## Filesystem Hierarchy Standard - `/`

.small[ .columns[

.ubuntu[ 
```
cr173@vcm-8122:~$ tree -d -L 1 /
/
├── bin
├── boot
├── dev
*├── etc
├── home
├── lib
├── lib64
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin
├── srv
├── sys
├── tmp
*├── usr
*└── var
```
]

.fedora[
```
cr173@saxon [~]$ tree -d -L 1 /
/
├── bin -> usr/bin
├── boot
├── data
├── dev
*├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib64
├── lost+found
├── media
├── mnt
├── net
├── opt
├── proc
├── proj -> /net/jane/volumes/vol1/proj
├── root
├── run
├── sbin -> usr/sbin
├── srv
├── sys
├── tmp
*├── usr
*├── var
└── web
```
]
] ]

.footnote[https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard]

---

## Secondary, Tertiarty, etc.


.tiny[ .columns[

.fedora[
```
*cr173@saxon [~]$ tree -d -L 1 /usr
/usr
├── bin
├── etc
├── games
├── include
├── lib
├── lib64
├── libexec
├── local
├── sbin
├── share
├── src
└── tmp -> ../var/tmp
```
]

.fedora[
```
*cr173@saxon [~]$ tree -d -L 1 /usr/local
/usr/local
├── bin
├── cuda -> cuda-10.0
├── cuda-10.0
├── etc
├── games
├── include
├── lib
├── lib64
├── libexec
├── sbin
├── share
└── src
```
]
] ]

--

.tiny[ .columns[

.fedora[
```
*cr173@saxon [~]$ tree -d -L 1 /usr/local/cuda
/usr/local/cuda
├── bin
├── doc
├── extras
├── include -> targets/x86_64-linux/include
├── lib64 -> targets/x86_64-linux/lib
├── libnsight
├── libnvvp
├── NsightCompute-1.0
├── nsightee_plugins
├── nvml
├── nvvm
├── samples
├── share
├── src
├── targets
└── tools
```
] 
] ]

---
class: middle center

# Using `apt`

---

## Installing R

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ apt install r-base
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
```
] ]

--

<br/>

.center[
![](https://imgs.xkcd.com/comics/sandwich.png) <br/>
[xkcd 149 - Sandwich](https://xkcd.com/149/)
]

---

## Installing R

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ sudo apt install r-base
*[sudo] password for cr173:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  autoconf automake autopoint autotools-dev build-essential bzip2-doc cdbs cpp cpp-7 debhelper dh-autoreconf dh-strip-nondeterminism dh-translations dpkg-dev fakeroot fontconfig fontconfig-config fonts-dejavu-core g++ g++-7 gcc gcc-7 gcc-7-base gettext gfortran gfortran-7 gir1.2-harfbuzz-0.0 icu-devtools intltool intltool-debian jq libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libarchive-cpio-perl libarchive-zip-perl libasan4 libatomic1 libauthen-sasl-perl libblas-dev libblas3 libbz2-dev libcairo2 libcc1-0 libcilkrts5 libcroco3 libdata-dump-perl libdatrie1 libdpkg-perl libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libencode-locale-perl libfakeroot libfile-basedir-perl
  libfile-desktopentry-perl libfile-fcntllock-perl libfile-listing-perl libfile-mimeinfo-perl libfile-stripnondeterminism-perl libfile-which-perl libfont-afm-perl libfontconfig1 libfontenc1 libgcc-7-dev libgfortran-7-dev libgfortran4 libgl1 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libglvnd0 libglx-mesa0
  libglx0 libgomp1 libgraphite2-3 libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libice6 libicu-dev libicu-le-hb-dev
  libicu-le-hb0 libiculx60 libio-html-perl libio-socket-ssl-perl libipc-system-simple-perl libisl19 libitm1 libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjq1 liblapack-dev liblapack3 libllvm6.0 liblsan0 libltdl-dev libltdl7 liblwp-mediatypes-perl liblwp-protocol-https-perl liblzma-dev libmail-sendmail-perl libmailtools-perl
  libmpc3 libmpfr6 libmpx2 libncurses5-dev libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libonig4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1 libpciaccess0 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpixman-1-0 libpng-dev libpng-tools libquadmath0 libreadline-dev libsensors4 libsigsegv2
  libsm6 libstdc++-7-dev libsys-hostname-long-perl libtcl8.6 libthai-data libthai0 libtie-ixhash-perl libtiff5 libtimedate-perl libtinfo-dev libtk8.6 libtool libtry-tiny-perl libtsan0 libubsan0 liburi-perl libwww-perl libwww-robotrules-perl libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 m4 make perl-openssl-defaults pkg-config po-debconf python3-distutils
  python3-lib2to3 python3-scour r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-doc-html r-recommended scour unzip x11-common x11-utils x11-xserver-utils
  xdg-utils zip zlib1g-dev
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc devscripts cpp-doc gcc-7-locales dh-make dwz debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg
  gettext-doc libasprintf-dev libgettextpo-dev gfortran-multilib gfortran-doc gfortran-7-multilib gfortran-7-doc libgfortran4-dbg libcoarrays-dev libdigest-hmac-perl libgssapi-perl liblapack-doc bzr libglib2.0-doc libgraphite2-utils icu-doc libtool-doc libcrypt-ssleay-perl liblzma-doc ncurses-doc readline-doc lm-sensors libstdc++-7-doc tcl8.6 tk8.6 gcj-jdk
  libauthen-ntlm-perl libunicode-map8-perl libunicode-string-perl xml-twig-tools m4-doc make-doc libmail-box-perl ess r-doc-info | r-doc-pdf r-mathlib texlive-base texlive-latex-base texlive-generic-recommended texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils texlive-latex-recommended texlive-latex-extra texinfo mozilla | www-browser
  gir1.2-rsvg-2.0 python3-gi-cairo mesa-utils nickle cairo-5c xorg-docs-core
The following NEW packages will be installed:
  autoconf automake autopoint autotools-dev build-essential bzip2-doc cdbs cpp cpp-7 debhelper dh-autoreconf dh-strip-nondeterminism dh-translations dpkg-dev fakeroot fontconfig fontconfig-config fonts-dejavu-core g++ g++-7 gcc gcc-7 gcc-7-base gettext gfortran gfortran-7 gir1.2-harfbuzz-0.0 icu-devtools intltool intltool-debian jq libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libarchive-cpio-perl libarchive-zip-perl libasan4 libatomic1 libauthen-sasl-perl libblas-dev libblas3 libbz2-dev libcairo2 libcc1-0 libcilkrts5 libcroco3 libdata-dump-perl libdatrie1 libdpkg-perl libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libencode-locale-perl libfakeroot libfile-basedir-perl
  libfile-desktopentry-perl libfile-fcntllock-perl libfile-listing-perl libfile-mimeinfo-perl libfile-stripnondeterminism-perl libfile-which-perl libfont-afm-perl libfontconfig1 libfontenc1 libgcc-7-dev libgfortran-7-dev libgfortran4 libgl1 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libglvnd0 libglx-mesa0
  libglx0 libgomp1 libgraphite2-3 libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libice6 libicu-dev libicu-le-hb-dev
  libicu-le-hb0 libiculx60 libio-html-perl libio-socket-ssl-perl libipc-system-simple-perl libisl19 libitm1 libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjq1 liblapack-dev liblapack3 libllvm6.0 liblsan0 libltdl-dev libltdl7 liblwp-mediatypes-perl liblwp-protocol-https-perl liblzma-dev libmail-sendmail-perl libmailtools-perl
  libmpc3 libmpfr6 libmpx2 libncurses5-dev libnet-dbus-perl libnet-http-perl libnet-smtp-ssl-perl libnet-ssleay-perl libonig4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1 libpciaccess0 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpixman-1-0 libpng-dev libpng-tools libquadmath0 libreadline-dev libsensors4 libsigsegv2
  libsm6 libstdc++-7-dev libsys-hostname-long-perl libtcl8.6 libthai-data libthai0 libtie-ixhash-perl libtiff5 libtimedate-perl libtinfo-dev libtk8.6 libtool libtry-tiny-perl libtsan0 libubsan0 liburi-perl libwww-perl libwww-robotrules-perl libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 m4 make perl-openssl-defaults pkg-config po-debconf python3-distutils
  python3-lib2to3 python3-scour r-base r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-doc-html r-recommended scour unzip x11-common x11-utils x11-xserver-utils
  xdg-utils zip zlib1g-dev
0 upgraded, 236 newly installed, 0 to remove and 9 not upgraded.
Need to get 130 MB of archives.
After this operation, 543 MB of additional disk space will be used.
*Do you want to continue? [Y/n]
```
]]

---

## Removing R

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ sudo apt remove r-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  cdbs debhelper dh-autoreconf dh-strip-nondeterminism dh-translations fontconfig fontconfig-config fonts-dejavu-core gir1.2-harfbuzz-0.0 icu-devtools intltool intltool-debian jq libarchive-cpio-perl libarchive-zip-perl libblas-dev libblas3 libbz2-dev libcairo2 libdatrie1 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfile-basedir-perl
  libfile-desktopentry-perl libfile-mimeinfo-perl libfile-stripnondeterminism-perl libfile-which-perl libfontconfig1 libfontenc1 libgl1 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b
  libice6 libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libipc-system-simple-perl libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjq1 liblapack-dev liblapack3 libllvm6.0 liblzma-dev libmail-sendmail-perl libncurses5-dev libnet-dbus-perl libonig4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1
  libpciaccess0 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpixman-1-0 libpng-dev libpng-tools libreadline-dev libsensors4 libsm6 libsys-hostname-long-perl libtcl8.6 libthai-data libthai0 libtie-ixhash-perl libtiff5 libtinfo-dev libtk8.6 libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 pkg-config po-debconf python3-distutils python3-lib2to3 python3-scour
  r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-doc-html r-recommended scour unzip x11-common x11-utils x11-xserver-utils xdg-utils zip zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  r-base
*0 upgraded, 0 newly installed, 1 to remove and 9 not upgraded.
*After this operation, 60.4 kB disk space will be freed.
Do you want to continue? [Y/n]
```
] ]

--

.small[ and all of its dependencies, ]

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'r-base' is not installed, so not removed
The following packages will be REMOVED:
  cdbs debhelper dh-autoreconf dh-strip-nondeterminism dh-translations fontconfig fontconfig-config fonts-dejavu-core gir1.2-harfbuzz-0.0 icu-devtools intltool intltool-debian jq libarchive-cpio-perl libarchive-zip-perl libblas-dev libblas3 libbz2-dev libcairo2 libdatrie1 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libfile-basedir-perl
  libfile-desktopentry-perl libfile-mimeinfo-perl libfile-stripnondeterminism-perl libfile-which-perl libfontconfig1 libfontenc1 libgl1 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b
  libice6 libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libipc-system-simple-perl libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjq1 liblapack-dev liblapack3 libllvm6.0 liblzma-dev libmail-sendmail-perl libncurses5-dev libnet-dbus-perl libonig4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1
  libpciaccess0 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpixman-1-0 libpng-dev libpng-tools libreadline-dev libsensors4 libsm6 libsys-hostname-long-perl libtcl8.6 libthai-data libthai0 libtie-ixhash-perl libtiff5 libtinfo-dev libtk8.6 libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
  libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxpm4 libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 pkg-config po-debconf python3-distutils python3-lib2to3 python3-scour
  r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-doc-html r-recommended scour unzip x11-common x11-utils x11-xserver-utils xdg-utils zip zlib1g-dev
*0 upgraded, 0 newly installed, 157 to remove and 9 not upgraded.
*After this operation, 379 MB disk space will be freed.
Do you want to continue? [Y/n]
```
] ]

---

## Updating & Upgrading

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Fetched 247 kB in 1s (277 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
*9 packages can be upgraded. Run 'apt list --upgradable' to see them.
```
] ] 

--

<br/>

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  amd64-microcode intel-microcode iucode-tool linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-43-generic python3-netifaces
The following packages will be upgraded:
  initramfs-tools initramfs-tools-bin initramfs-tools-core kmod libkmod2 linux-generic linux-headers-generic linux-image-generic netplan.io
*9 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 67.2 MB/67.4 MB of archives.
After this operation, 336 MB of additional disk space will be used.
Do you want to continue? [Y/n]
```
] ]

---

## Aside - Conflicts

.small[ .ubuntu[
```
...

update-initramfs: deferring update (trigger activated)
amd64-microcode: microcode will be updated at next boot
Setting up intel-microcode (3.20180807a.0ubuntu0.18.04.1) ...
update-initramfs: deferring update (trigger activated)
intel-microcode: microcode will be updated at next boot
Setting up kmod (24-1ubuntu3.1) ...

*Configuration file '/etc/modprobe.d/blacklist.conf'
* ==> Modified (by you or by a script) since installation.
* ==> Package distributor has shipped an updated version.
*   What would you like to do about it ?  Your options are:
*    Y or I  : install the package maintainer's version
*    N or O  : keep your currently-installed version
*      D     : show the differences between the versions
*      Z     : start a shell to examine the situation
* The default action is to keep your current version.
**** blacklist.conf (Y/I/N/O/D/Z) [default=N] ?
Setting up initramfs-tools-core (0.130ubuntu3.6) ...
Setting up linux-headers-4.15.0-43-generic (4.15.0-43.46) ...
Setting up initramfs-tools (0.130ubuntu3.6) ...

...
```
] ]

---

## Package Contents & Details

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ dpkg -L r-base
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/r-base
/usr/share/doc/r-base/README.Debian
/usr/share/doc/r-base/copyright
/usr/share/doc/r-base/changelog.Debian.gz
```
] ]

--

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ apt show r-base
Package: r-base
Version: 3.4.4-1ubuntu1
Priority: optional
Section: universe/math
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Dirk Eddelbuettel <edd@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 60.4 kB
*Depends: r-base-core (>= 3.4.4-1ubuntu1), r-recommended (= 3.4.4-1ubuntu1)
Recommends: r-base-html, r-doc-html
Suggests: ess, r-doc-info | r-doc-pdf
Homepage: http://www.r-project.org/
Download-Size: 9,312 B
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Description: GNU R statistical computation and graphics system
 R is a system for statistical computation and graphics.  It consists
 of a language plus a run-time environment with graphics, a debugger,
 access to certain system functions, and the ability to run programs
 stored in script files.
...
```
] ]

---

## File -> Package

.tiny[ .ubuntu[

```
*cr173@vcm-8122:~$ dpkg -S /usr/bin/R
r-base-core: /usr/bin/R
```
] ]

--

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ dpkg -L r-base-core
/.
/etc
/etc/R
/etc/R/Makeconf
/etc/R/Renviron.site
/etc/R/Rprofile.site
/etc/R/ldpaths
/etc/R/repositories
/etc/ld.so.conf.d
/usr
/usr/bin
/usr/bin/R
/usr/bin/Rscript
/usr/lib
/usr/lib/R
/usr/lib/R/SVN-REVISION
/usr/lib/R/bin
/usr/lib/R/bin/BATCH
/usr/lib/R/bin/COMPILE
/usr/lib/R/bin/INSTALL
/usr/lib/R/bin/LINK
/usr/lib/R/bin/R
/usr/lib/R/bin/REMOVE
/usr/lib/R/bin/Rcmd
/usr/lib/R/bin/Rd2pdf
/usr/lib/R/bin/Rdconv
/usr/lib/R/bin/Rdiff
/usr/lib/R/bin/Rprof
/usr/lib/R/bin/Rscript
/usr/lib/R/bin/SHLIB
/usr/lib/R/bin/Stangle
...
```
] ]


---

## Package Manager Comparison

.small[ 

|                       | Ubuntu / Debian                        | RHEL                  | Fedora                                | Requires root  |
|:----------------------|:---------------------------------------|:----------------------|:--------------------------------------|:--------------:|
| Install Package       | `apt install`                          | `yum install`         | `dnf install`                         | Yes            |
| Install Local Package | `dpkg -i pkg.deb`                      | `yum install pkg.rpm` | `dnf install pkg.rpm`                 | Yes            |
| Remove Package        | `apt remove`                           | `yum remove`          | `dnf remove`                          | Yes            |
| Update Package List   | `apt update`                           | `yum check-update`    | `dnf check-update`                    | Yes            |
| Upgrade Packages      | `apt upgrade` <br/> `apt full-upgrade` | `yum upgrade`         | `dnf upgrade`                         | Yes            |
| Clean Dependencies    | `apt autoremove`                       | `yum autoremove`      | `dnf autoremove`                      | Yes            |
| Reinstall Package     | `apt install --reinstall`              | `yum reinstall`       | `dnf reinstall`                       | Yes            |
| Package Details       | `apt show`                             | `yum info`            | `dnf info`                            | No             |
| Package Dependencies  | `apt show`                             | `yum deplist`         | `dnf repoquery` <br/> `--requires`    | No             |
| Package -> Files      | `dpkg -L`                              | `rpm -qf`             | `rpm -qf`                             | No             |
| Files -> Package      | `dpkg -S`                              | `rpm -ql`             | `rpm -ql` or <br/> `dnf repoquery -l` | No             |

]

---

## Installiong R

.tiny[ .rhel[
```
[cr173@vcm-8152 ~]$ sudo yum install R
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package R.x86_64 0:3.5.1-1.el7 will be installed
--> Processing Dependency: R-java = 3.5.1-1.el7 for package: R-3.5.1-1.el7.x86_64
--> Processing Dependency: R-devel = 3.5.1-1.el7 for package: R-3.5.1-1.el7.x86_64
...
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                               Arch   Version                             Repository                                 Size
==================================================================================================================================
Installing:
 R                                     x86_64 3.5.1-1.el7                         patchmonkey-epel-el7                       30 k
Installing for dependencies:
 R-core                                x86_64 3.5.1-1.el7                         patchmonkey-epel-el7                       55 M
 R-core-devel                          x86_64 3.5.1-1.el7                         patchmonkey-epel-el7                      108 k
 R-devel                               x86_64 3.5.1-1.el7                         patchmonkey-epel-el7                       29 k
 R-java                                x86_64 3.5.1-1.el7                         patchmonkey-epel-el7                       30 k
 R-java-devel                          x86_64 3.5.1-1.el7                         patchmonkey-epel-el7                       30 k
 avahi-glib                            x86_64 0.6.31-19.el7                       patchmonkey-rhel-7-server-rpms             25 k
 bzip2-devel                           x86_64 1.0.6-13.el7                        patchmonkey-rhel-7-server-rpms            218 k
 cairo                                 x86_64 1.15.12-3.el7                       patchmonkey-rhel-7-server-rpms            741 k
 dwz                                   x86_64 0.11-3.el7                          patchmonkey-rhel-7-server-rpms             99 k
 expat-devel                           x86_64 2.1.0-10.el7_3                      patchmonkey-rhel-7-server-rpms             57 k
 fontconfig-devel                      x86_64 2.13.0-4.3.el7                      patchmonkey-rhel-7-server-rpms            138 k
 fribidi                               x86_64 1.0.2-1.el7                         patchmonkey-rhel-7-server-rpms             79 k
 gcc                                   x86_64 4.8.5-36.el7                        patchmonkey-rhel-7-server-rpms             16 M
 gcc-c++                               x86_64 4.8.5-36.el7                        patchmonkey-rhel-7-server-rpms            7.2 M
 gcc-gfortran                          x86_64 4.8.5-36.el7                        patchmonkey-rhel-7-server-rpms            6.7 M
...

Transaction Summary
==================================================================================================================================
Install  1 Package (+217 Dependent packages)

Total size: 374 M
Installed size: 712 M
Is this ok [y/d/N]:
```
] ]


---
class: middle, center

# Example: R package `curl`

---

.small[

.ubuntu[
```
cr173@vcm-8122:~$ R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

...

> install.packages("curl")
  Installing package into ‘/usr/local/lib/R/site-library’
  (as ‘lib’ is unspecified)
  Warning in install.packages("curl") :
    'lib = "/usr/local/lib/R/site-library"' is not writable
  Would you like to use a personal library instead?  (y/n) y
  Would you like to create a personal library
  ~/R/x86_64-pc-linux-gnu-library/3.4
  to install packages into?  (y/n) y
  trying URL 'https://cloud.r-project.org/src/contrib/curl_3.3.tar.gz'
  Content type 'application/x-gzip' length 371740 bytes (363 KB)
  ==================================================
  downloaded 363 KB
  
  * installing *source* package ‘curl’ ...
  ** package ‘curl’ successfully unpacked and MD5 sums checked
  Package libcurl was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libcurl.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libcurl' found
  Package libcurl was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libcurl.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libcurl' found
  Using PKG_CFLAGS=
  Using PKG_LIBS=-lcurl
  
  ...
  ```
  ] ]
  
---
  
.small[

.ubuntu[
  
```
...

*  ------------------------- ANTICONF ERROR ---------------------------
*  Configuration failed because libcurl was not found. Try installing:
*   * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
*   * rpm: libcurl-devel (Fedora, CentOS, RHEL)
*   * csw: libcurl_dev (Solaris)
*  If libcurl is already installed, check that 'pkg-config' is in your
*  PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
*  is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
*  R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
*  --------------------------------------------------------------------
  ERROR: configuration failed for package ‘curl’
  * removing ‘/home/cr173/R/x86_64-pc-linux-gnu-library/3.4/curl’
  
  The downloaded source packages are in
  	‘/tmp/RtmpjJOxhq/downloaded_packages’
  Warning message:
  In install.packages("curl") :
    installation of package ‘curl’ had non-zero exit status
>
```
]

]

---

## Installing libcurl4-devel

.small[ 

.ubuntu[
```
*cr173@vcm-8122:~$ sudo apt install libcurl4-openssl-dev
[sudo] password for cr173:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  libcurl4-doc libidn11-dev libkrb5-dev libldap2-dev librtmp-dev libssh2-1-dev libssl-dev
*The following NEW packages will be installed:
*  libcurl4-openssl-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 294 kB of archives.
After this operation, 1,397 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4-openssl-dev amd64 7.58.0-2ubuntu3.5 [294 kB]
Fetched 294 kB in 1s (455 kB/s)
Selecting previously unselected package libcurl4-openssl-dev:amd64.
(Reading database ... 119757 files and directories currently installed.)
Preparing to unpack .../libcurl4-openssl-dev_7.58.0-2ubuntu3.5_amd64.deb ...
Unpacking libcurl4-openssl-dev:amd64 (7.58.0-2ubuntu3.5) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up libcurl4-openssl-dev:amd64 (7.58.0-2ubuntu3.5) ...
```
]

]

---

.tiny[ .ubuntu[
```
cr173@vcm-8122:~$ R
...
*> install.packages("curl")
  Installing package into ‘/home/cr173/R/x86_64-pc-linux-gnu-library/3.4’
  (as ‘lib’ is unspecified)
  trying URL 'https://cloud.r-project.org/src/contrib/curl_3.3.tar.gz'
  Content type 'application/x-gzip' length 371740 bytes (363 KB)
  ==================================================
  downloaded 363 KB
  
  * installing *source* package ‘curl’ ...
  ** package ‘curl’ successfully unpacked and MD5 sums checked
  Found pkg-config cflags and libs!
  Using PKG_CFLAGS=-I/usr/include/x86_64-linux-gnu
  Using PKG_LIBS=-lcurl
  ** libs
  rm -f curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o split.o ssl.o   utils.o version.o winidn.o writer.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c callbacks.c   -o callbacks.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c curl.c -o   curl.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c download.c -o   download.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c escape.c -o   escape.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c fetch.c -o   fetch.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c form.c -o   form.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c getdate.c -o   getdate.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c handle.c -o   handle.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ieproxy.c -o   ieproxy.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o   init.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c interrupt.c   -o interrupt.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c multi.c -o   multi.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c nslookup.c -o   nslookup.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c reflist.c -o   reflist.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c split.c -o   split.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c ssl.c -o   ssl.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c utils.c -o   utils.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c version.c -o   version.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c winidn.c -o   winidn.o
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/x86_64-linux-gnu -DSTRICT_R_HEADERS -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c writer.c -o   writer.o
  g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o   init.o interrupt.o multi.o nslookup.o reflist.o split.o ssl.o utils.o version.o winidn.o writer.o -lcurl -L/usr/lib/R/lib -lR
  installing to /home/cr173/R/x86_64-pc-linux-gnu-library/3.4/curl/libs
  ** R
  ** data
  *** moving datasets to lazyload DB
  ** inst
  ** preparing package for lazy loading
  ** help
  *** installing help indices
  ** building package indices
  ** installing vignettes
  ** testing if installed package can be loaded
  * DONE (curl)
  
  The downloaded source packages are in
  	‘/tmp/RtmpHWlEad/downloaded_packages’
  >
```
] ]

---

## What is `libcurl4-openssl-dev`?

.tiny[ .ubuntu[ 
```
*cr173@vcm-8122:~$ apt show libcurl4-openssl-dev
*Package: libcurl4-openssl-dev
Version: 7.58.0-2ubuntu3.5
Priority: optional
Section: libdevel
Source: curl
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Alessandro Ghedini <ghedo@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1,397 kB
*Provides: libcurl-dev, libcurl-ssl-dev, libcurl3-dev, libcurl3-openssl-dev, libcurl4-dev
*Depends: libcurl4 (= 7.58.0-2ubuntu3.5)
Suggests: libcurl4-doc, libidn11-dev, libkrb5-dev, libldap2-dev, librtmp-dev, libssh2-1-dev, libssl-dev (>= 1.1), pkg-config, zlib1g-dev
*Conflicts: libcurl4-gnutls-dev, libcurl4-nss-dev, libssl-dev (<< 1.1), libssl1.0-dev
Homepage: http://curl.haxx.se
Supported: 5y
Download-Size: 294 kB
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
*Description: development files and documentation for libcurl (OpenSSL flavour)
* libcurl is an easy-to-use client-side URL transfer library, supporting DICT,
* FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S,
* RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP.
 .
 libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
 form based upload, proxies, cookies, user+password authentication (Basic,
 Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling
 and more!
 .
 libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported,
 fast, thoroughly documented and is already used by many known, big and
 successful companies and numerous applications.
 .
 This package provides the development files (ie. includes, static library,
 manual pages) that allow one to build software which uses libcurl.
 .
 SSL support is provided by OpenSSL.

N: There is 1 additional record. Please use the '-a' switch to see it
```
] ]

---

## What is in `libcurl4-openssl-dev`?

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ dpkg -L libcurl4-openssl-dev
/.
/usr
/usr/bin
/usr/bin/curl-config
/usr/include
/usr/include/x86_64-linux-gnu
/usr/include/x86_64-linux-gnu/curl
*/usr/include/x86_64-linux-gnu/curl/curl.h
*/usr/include/x86_64-linux-gnu/curl/curlver.h
*/usr/include/x86_64-linux-gnu/curl/easy.h
*/usr/include/x86_64-linux-gnu/curl/mprintf.h
*/usr/include/x86_64-linux-gnu/curl/multi.h
*/usr/include/x86_64-linux-gnu/curl/stdcheaders.h
*/usr/include/x86_64-linux-gnu/curl/system.h
*/usr/include/x86_64-linux-gnu/curl/typecheck-gcc.h
/usr/lib
/usr/lib/x86_64-linux-gnu
*/usr/lib/x86_64-linux-gnu/libcurl.a
/usr/lib/x86_64-linux-gnu/libcurl.la
/usr/lib/x86_64-linux-gnu/pkgconfig
*/usr/lib/x86_64-linux-gnu/pkgconfig/libcurl.pc
/usr/share
/usr/share/aclocal
/usr/share/aclocal/libcurl.m4
/usr/share/doc
/usr/share/doc/libcurl4-openssl-dev
/usr/share/doc/libcurl4-openssl-dev/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/curl-config.1.gz
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/share/doc/libcurl4-openssl-dev/NEWS.Debian.gz
/usr/share/doc/libcurl4-openssl-dev/changelog.Debian.gz
```
] ]

---

## What about `libcurl4`?

.tiny[ .columns[

.ubuntu[
```
cr173@vcm-8122:~$ apt show libcurl4
Package: libcurl4
Version: 7.58.0-2ubuntu3.5
Priority: optional
Section: libs
Source: curl
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Alessandro Ghedini <ghedo@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 641 kB
Depends: libc6 (>= 2.17), libgssapi-krb5-2 (>= 1.14+dfsg), libidn2-0 (>= 0.6), libldap-2.4-2 (>= 2.4.7), libnghttp2-14 (>= 1.12.0), libpsl5 (>= 0.13.0), librtmp1 (>= 2.4+20131018.git79459a2-3~), libssl1.1 (>= 1.1.0), zlib1g (>= 1:1.1.4)
Recommends: ca-certificates
Conflicts: libcurl3
Replaces: libcurl3
Homepage: http://curl.haxx.se
Task: cloud-image, server, kubuntu-desktop, kubuntu-full, xubuntu-live, 
  lubuntu-live-share, lubuntu-live, lubuntu-live-qt, lubuntu-live-gtk, 
  ubuntustudio-publishing, ubuntustudio-photography, 
  ubuntustudio-graphics, ubuntu-budgie-desktop
Supported: 5y
Download-Size: 214 kB
APT-Manual-Installed: no
APT-Sources: http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
Description: easy-to-use client-side URL transfer library (OpenSSL flavour)
 libcurl is an easy-to-use client-side URL transfer library, supporting DICT,
 FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S,
 RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP.
 .
 libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
 form based upload, proxies, cookies, user+password authentication (Basic,
 Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling
 and more!
 .
 libcurl is free, thread-safe, IPv6 compatible, feature rich, well supported,
 fast, thoroughly documented and is already used by many known, big and
 successful companies and numerous applications.
 .
 SSL support is provided by OpenSSL.

N: There is 1 additional record. Please use the '-a' switch to see it
```
]

.ubuntu[
```
cr173@vcm-8122:~$ dpkg -L libcurl4
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
*/usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0
/usr/share
/usr/share/doc
/usr/share/doc/libcurl4
/usr/share/doc/libcurl4/NEWS.Debian.gz
/usr/share/doc/libcurl4/changelog.Debian.gz
/usr/share/doc/libcurl4/copyright
/usr/lib/x86_64-linux-gnu/libcurl.so.4
```
]
] ]


---
class: middle center

# Installing `curl` on RHEL

---

.tiny[ .columns[
.rhel[
```
[cr173@vcm-8157 ~]$ R

*R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

...

*> install.packages("curl")
  Installing package into ‘/usr/lib64/R/library’
  (as ‘lib’ is unspecified)
  Warning in install.packages("curl") :
    'lib = "/usr/lib64/R/library"' is not writable
  Would you like to use a personal library instead? (yes/No/cancel) yes
  Would you like to create a personal library
  ‘~/R/x86_64-redhat-linux-gnu-library/3.5’
  to install packages into? (yes/No/cancel) yes
* --- Please select a CRAN mirror for use in this session ---
  Secure CRAN mirrors
  
   1: 0-Cloud [https]                   2: Algeria [https]
   3: Australia (Canberra) [https]      4: Australia (Melbourne 1) [https]
   5: Australia (Melbourne 2) [https]   6: Australia (Perth) [https]
   7: Austria [https]                   8: Belgium (Ghent) [https]
   9: Brazil (PR) [https]              10: Brazil (RJ) [https]
  11: Brazil (SP 1) [https]            12: Brazil (SP 2) [https]
  13: Bulgaria [https]                 14: Chile 1 [https]
  15: Chile 2 [https]                  16: China (Hong Kong) [https]
  17: China (Guangzhou) [https]        18: China (Lanzhou) [https]
  19: China (Shanghai 1) [https]       20: China (Shanghai 2) [https]
  21: Colombia (Cali) [https]          22: Czech Republic [https]
  23: Denmark [https]                  24: East Asia [https]
  25: Ecuador (Cuenca) [https]         26: Ecuador (Quito) [https]
  27: Estonia [https]                  28: France (Lyon 1) [https]
  29: France (Lyon 2) [https]          30: France (Marseille) [https]
  31: France (Montpellier) [https]     32: France (Paris 2) [https]
  33: Germany (Erlangen) [https]       34: Germany (Göttingen) [https]
  35: Germany (Münster) [https]        36: Greece [https]
  37: Iceland [https]                  38: India [https]
  39: Indonesia (Jakarta) [https]      40: Ireland [https]
  41: Italy (Padua) [https]            42: Japan (Tokyo) [https]
  43: Japan (Yonezawa) [https]         44: Korea (Busan) [https]
  45: Korea (Gyeongsan-si) [https]     46: Korea (Seoul 1) [https]
  47: Korea (Ulsan) [https]            48: Malaysia [https]
  49: Mexico (Mexico City) [https]     50: Norway [https]
  51: Philippines [https]              52: Serbia [https]
  53: Spain (A Coruña) [https]         54: Spain (Madrid) [https]
  55: Sweden [https]                   56: Switzerland [https]
  57: Turkey (Denizli) [https]         58: Turkey (Mersin) [https]
  59: UK (Bristol) [https]             60: UK (London 1) [https]
  61: USA (CA 1) [https]               62: USA (IA) [https]
  63: USA (KS) [https]                 64: USA (MI 1) [https]
  65: USA (OR) [https]                 66: USA (TN) [https]
  67: USA (TX 1) [https]               68: Uruguay [https]
  69: (other mirrors)
  
  Selection: 1
```
]

.rhel[
```
  trying URL 'https://cloud.r-project.org/src/contrib/curl_3.3.tar.gz'
  Content type 'application/x-gzip' length 371740 bytes (363 KB)
  ==================================================
  downloaded 363 KB
  
  * installing *source* package ‘curl’ ...
  ** package ‘curl’ successfully unpacked and MD5 sums checked
  Package libcurl was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libcurl.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libcurl' found
  Package libcurl was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libcurl.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libcurl' found
  Using PKG_CFLAGS=
  Using PKG_LIBS=-lcurl
*  ------------------------- ANTICONF ERROR ---------------------------
*  Configuration failed because libcurl was not found. Try installing:
*   * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
*   * rpm: libcurl-devel (Fedora, CentOS, RHEL)
*   * csw: libcurl_dev (Solaris)
*  If libcurl is already installed, check that 'pkg-config' is in your
*  PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
*  is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
*  R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
*  --------------------------------------------------------------------
  ERROR: configuration failed for package ‘curl’
  * removing ‘/home/cr173/R/x86_64-redhat-linux-gnu-library/3.5/curl’
  
  The downloaded source packages are in
  	‘/tmp/RtmpbLV8ur/downloaded_packages’
  Warning message:
  In install.packages("curl") :
    installation of package ‘curl’ had non-zero exit status
>
```
]
] ]


---

.tiny[
.rhel[
```
*[cr173@vcm-8157 ~]$ sudo yum install libcurl-devel
Resolving Dependencies
--> Running transaction check
---> Package libcurl-devel.x86_64 0:7.29.0-51.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                          Arch                      Version                          Repository                                         Size
=====================================================================================================================================================
Installing:
 libcurl-devel                    x86_64                    7.29.0-51.el7                    patchmonkey-rhel-7-server-rpms                    302 k

Transaction Summary
=====================================================================================================================================================
Install  1 Package

Total download size: 302 k
Installed size: 623 k
Is this ok [y/d/N]: y
Downloading packages:
libcurl-devel-7.29.0-51.el7.x86_64.rpm                                                                                        | 302 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libcurl-devel-7.29.0-51.el7.x86_64                                                                                                1/1
  Verifying  : libcurl-devel-7.29.0-51.el7.x86_64                                                                                                1/1

Installed:
  libcurl-devel.x86_64 0:7.29.0-51.el7

Complete!
[cr173@vcm-8157 ~]$
```
] ]

---

.tiny[
.rhel[
```
*[cr173@vcm-8157 ~]$ R
...
*> install.packages("curl")
...
  trying URL 'https://cloud.r-project.org/src/contrib/curl_3.3.tar.gz'
  Content type 'application/x-gzip' length 371740 bytes (363 KB)
  ==================================================
  downloaded 363 KB
  
  * installing *source* package ‘curl’ ...
  ** package ‘curl’ successfully unpacked and MD5 sums checked
  Found pkg-config cflags and libs!
  Using PKG_CFLAGS=
  Using PKG_LIBS=-lcurl
  ** libs
  rm -f curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o   interrupt.o multi.o nslookup.o reflist.o split.o ssl.o utils.o version.o winidn.o writer.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c callbacks.c -o callbacks.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c curl.c -o curl.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c download.c -o download.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c escape.c -o escape.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c fetch.c -o fetch.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c form.c -o form.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c getdate.c -o getdate.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c handle.c -o handle.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c ieproxy.c -o ieproxy.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c init.c -o init.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c interrupt.c -o interrupt.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c multi.c -o multi.o
  multi.c: In function ‘R_multi_setopt’:
  multi.c:248:10: warning: unused variable ‘multi’ [-Wunused-variable]
     CURLM *multi = mref->m;
            ^
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c nslookup.c -o nslookup.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c reflist.c -o reflist.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c split.c -o split.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c ssl.c -o ssl.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c utils.c -o utils.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c version.c -o version.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c winidn.c -o winidn.o
  gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -DSTRICT_R_HEADERS  -I/usr/local/include    -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong   --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c writer.c -o writer.o
  gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o curl.so callbacks.o curl.o download.o   escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o split.o   ssl.o utils.o version.o winidn.o writer.o -lcurl -L/usr/lib64/R/lib -lR
  installing to /home/cr173/R/x86_64-redhat-linux-gnu-library/3.5/curl/libs
  ** R
  ** data
  *** moving datasets to lazyload DB
  ** inst
  ** byte-compile and prepare package for lazy loading
  ** help
  *** installing help indices
...
  ** building package indices
  ** installing vignettes
  ** testing if installed package can be loaded
  * DONE (curl)
  
  The downloaded source packages are in
  	‘/tmp/RtmpGgWRZx/downloaded_packages’
```
] ]

---

---
class: middle center

# A bit about libraries

---

## System libraries

These are shared common components that are used by a variety of software on a linux system. For the most part they are a collection of compiled code (typically C / C++) that are stored in a single file.

* Allows for code reuse

* Allows for multiple (concurrent) versions

* Avoids reinventing the wheel

* Installed in `/lib`, `/usr/lib`, `/usr/local/lib`, etc.

* Two flavors: static (`.a`) and dynamic (`.so`)

---

## `libcurl`

.small[ 
.ubuntu[
```
cr173@vcm-8122:~$ ls -la /usr/lib/x86_64-linux-gnu/libcurl*
-rw-r--r-- 1 root root 1057632 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl.a
lrwxrwxrwx 1 root root      19 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3 -> libcurl-gnutls.so.4
lrwxrwxrwx 1 root root      23 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 -> libcurl-gnutls.so.4.5.0
-rw-r--r-- 1 root root  510408 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.5.0
-rw-r--r-- 1 root root     951 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl.la
lrwxrwxrwx 1 root root      16 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl.so -> libcurl.so.4.5.0
lrwxrwxrwx 1 root root      16 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl.so.4 -> libcurl.so.4.5.0
-rw-r--r-- 1 root root  518600 Oct 29 08:10 /usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0
```
]

.rhel[
```
[cr173@vcm-8157 ~]$ ls -la /usr/lib64/libcurl*
lrwxrwxrwx. 1 root root     16 Jan 14 12:05 /usr/lib64/libcurl.so -> libcurl.so.4.3.0
lrwxrwxrwx. 1 root root     16 Jan 10 07:45 /usr/lib64/libcurl.so.4 -> libcurl.so.4.3.0
-rwxr-xr-x. 1 root root 435176 Aug  8 09:28 /usr/lib64/libcurl.so.4.3.0
```
]

]

---

## Getting what you want

The following is my understanding of the general system library package naming schemes for these distro families, there will definitely be exceptions and edge cases.

These are the names that would then be used with something like `apt install` or `yum install` respectively.

<br/>

|                       | Debian          | Redhat          |
|-----------------------|-----------------|-----------------|
| Dynamic library (.so) | `lib{name}`     | `{name}`        |
| Headers               | `lib{name}-dev` | `{name}-devel`  |
| Static library (.a)   | `lib{name}-dev` | `{name}-static` |
| Documentation         | `lib{name}-doc` | `{name}-devel`  | 

---

## Troubleshooting dynamic libraries

.tiny[ .ubuntu[
```
*cr173@vcm-8122:~$ ldd /usr/lib/x86_64-linux-gnu/libcurl.so
	linux-vdso.so.1 (0x00007ffd98176000)
	libnghttp2.so.14 => /usr/lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007f1e3dc60000)
	libidn2.so.0 => /usr/lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f1e3da43000)
	librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x00007f1e3d827000)
	libpsl.so.5 => /usr/lib/x86_64-linux-gnu/libpsl.so.5 (0x00007f1e3d619000)
	libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007f1e3d3af000)
	libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f1e3cf37000)
	libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f1e3ccec000)
	libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f1e3ca9a000)
	liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f1e3c88c000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1e3c66f000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1e3c450000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1e3c05f000)
	libunistring.so.2 => /usr/lib/x86_64-linux-gnu/libunistring.so.2 (0x00007f1e3bce1000)
	libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f1e3b97c000)
	libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f1e3b748000)
	libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f1e3b512000)
	libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f1e3b291000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1e3b08d000)
	libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f1e3adb7000)
	libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f1e3ab85000)
	libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f1e3a981000)
	libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f1e3a776000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f1e3a55b000)
	libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f1e3a340000)
	libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f1e3a0ff000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1e3e104000)
	libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f1e39dd0000)
	libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f1e39bbd000)
	libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f1e399b9000)
	libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f1e397b0000)
	libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f1e39523000)
	libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f1e39281000)
	libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f1e3904b000)
	libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f1e38e35000)
	libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f1e38c2d000)
	libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f1e38a04000)
	libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f1e387f5000)
	libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f1e385ab000)
	libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f1e382a2000)
	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f1e3806a000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1e37ccc000)
```
] ]
