XK0-004 · 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. Compiling and installing an application from source requires elevated privileges for the 'make install' step, which writes files to protected system directories. Among the choices given, only option A includes 'sudo' to enable privileged execution.
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
(41 responses)- A88% (36)
- B2% (1)
- C7% (3)
- D2% (1)
Why each option
Compiling and installing an application from source requires elevated privileges for the 'make install' step, which writes files to protected system directories. Among the choices given, only option A includes 'sudo' to enable privileged execution.
Option A is the only choice that includes 'sudo', providing the elevated privileges required when 'make install' writes compiled binaries to system-owned directories such as /usr/local/bin or /usr/lib. Without sudo, an unprivileged user will receive permission denied errors during the install phase. Although best practice places sudo only before 'make install', A is the only option among the choices that supplies any elevated privilege to the process.
Option B applies sudo only to the 'make' compilation step but not to 'make install', which means the final installation to system directories will still fail with a permission denied error.
Option C runs all three steps without any sudo, so 'make install' cannot write to protected system directories and the installation will fail.
Option D is identical to C - the absence of sudo at any point means 'make install' will be denied the permissions needed to place files in system directories.
Concept tested: Linux compile-from-source installation using sudo
Source: https://tldp.org/HOWTO/Software-Building-HOWTO.html
Topics
Community Discussion
No community discussion yet for this question.