-
Laurent Modolo authoredLaurent Modolo authored
Install system programs
Objective: Learn how to install programs in GNU/Linux
As we have seen in the 4 unix file system session, programs are files that contain instruction for the computer to do things. Those files can be in binary or text format (with a shebang). Any of those files, present in a folder of the PATH variable are executable anywhere by the user. For system wide installation, the program files are copied within shared folder path containained in the PATH variable.
Developers don’t want to reinvent the wheel each time they want to write complex instruction in their programs, this is why they use shared library of pre-written complex instruction. This allows for quicker development, fewer bugs (we only have to debug the library once and use it many times), and also better memory management (we only load the library once and it can be used by different programs).
Package Manager
However, interdependencies between programs and libraries can be a nightmare to handle manually this is why most of the time when you install a program you will use a package manager. Package manager are system tools that will handle automatically all the dependencies of a program. They rely on repositories of programs and library which contains all the information about the trees of dependence and the corresponding files (packages).
System-wide installation steps:
- The user asks the package manager to install a program
- The** package manager** queries its repository lists to search for the most recent package version of the program (or a specific version)
- The package manager construct the dependency tree of the program
- The package manager check that the new dependency tree is compatible with every other installed program
- The package manager install the program package and all it’s dependencies packages in their correct version
The main difference between GNU/Linux distribution is the package manager they use
- Debian / Ubuntu: apt
- CentOS / RedHat: yum
- ArchLinux: pacman
- SUSE / OpenSUSE: zypper
- Gentoo: portage
- Alpine: apk
Packages manager install the packages in root owned folders, you need root access to be able to use them.
Solution
```sh docker run -it --volume /:/root/chroot alpine sh -c "chroot /root/chroot /bin/bash -c 'usermod -a -G sudo etudiant'" && su etudiant ```
Installing R
R is a complex program that relies on loots of dependencies. Your current VM run on Ubuntu, so we are going to use the apt
tool (apt-get
is the older version of the apt
command, synaptic
is a graphical interface for apt-get
)
You can check the r-base package dependencies on the website packages.ubuntu.com. Not too much dependency ? Check the sub-package r-base-core.
You can check the manual of the apt
command to install r-base-core.
Solution
```sh sudo apt install r-base-core ```
What is the R version that you installed ? Is there a newer version of R ?