Install nginx from the configured APT repositories.
Resolve and install its required dependencies.
Which command is appropriate?
apt-get install selects a candidate from the APT indexes, resolves dependencies, downloads archives, and installs them.
Detailed explanation
apt-get install nginxCorrect. apt-get install nginx installs nginx and resolves its dependencies.
Correct. apt-get install nginx installs nginx and resolves its dependencies.
apt-cache install nginxIncorrect. apt-cache is for querying indexes, not installing packages.
Incorrect. apt-cache is for querying indexes, not installing packages.
dpkg -S nginxIncorrect. dpkg -S searches file ownership.
Incorrect. dpkg -S searches file ownership.
dpkg -L nginxIncorrect. dpkg -L lists files for an installed package.
Incorrect. dpkg -L lists files for an installed package.
Try it yourself
An example you can run in a temporary verification environment.
apt-get --help | grep -E '^ install'Expected result
installサブコマンドの説明。実際の導入は行わないKey points
- APT resolves dependencies
- Repository indexes are used
- It is higher-level than dpkg
Notes
- Environment: Debian系 / APT 2.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.