XK0-005 · Question #362
An administrator is logged on as an unprivileged user and needs to compile and installed an application from source. Which of the following BEST represents how to complete this task?
The correct answer is A. cd <source>; sudo ./configure $$ make $$ make install. When compiling and installing an application from source as an unprivileged user, the make install step requires sudo privileges to write to system directories.
Question
An administrator is logged on as an unprivileged user and needs to compile and installed an application from source. Which of the following BEST represents how to complete this task?
Options
- Acd <source>; sudo ./configure $$ make $$ make install
- Bcd <source>; ./configure $$ sudo make $$ make install
- Ccd <source>; ./configure $$ make $$ make install
- Dcd <source>; ./configure $$ make $$ make install
How the community answered
(56 responses)- A82% (46)
- B4% (2)
- C11% (6)
- D4% (2)
Why each option
When compiling and installing an application from source as an unprivileged user, the `make install` step requires `sudo` privileges to write to system directories.
The standard process for compiling from source involves `./configure` to prepare the build, `make` to compile the code, and `make install` to copy the compiled binaries and files to system-wide locations. While `./configure` and `make` typically run without elevated privileges, `make install` usually requires root permissions to write to privileged directories such as `/usr/local/bin` or `/usr/lib`, hence the necessity of `sudo make install`.
Placing `sudo` before `make` is generally unnecessary because the compilation step does not typically require root privileges.
Performing all steps as an unprivileged user will likely result in a permission denied error during the `make install` phase when attempting to write to system directories.
This option is identical to C, performing all steps as an unprivileged user, and will similarly fail during the `make install` phase due to insufficient permissions.
Concept tested: Compiling from source; sudo for installation
Source: https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libs.html
Topics
Community Discussion
No community discussion yet for this question.