apt install Linux Command
Installs one or more packages from the repository.
What does apt install do?
Installs one or more packages from the repository.
Syntax
apt install package_namePractical example
sudo apt install htop vim gitQuestions about apt install
How do I install a package with apt?
Use `sudo apt install package_name` to install a package. Always run `sudo apt update` first to get the latest package list.
How do I install multiple packages at once?
Use `sudo apt install package1 package2 package3` to install multiple packages in a single command.
How do I install a specific version?
Use `sudo apt install package_name=version` like `sudo apt install nginx=1.18.0-0ubuntu1`.
How do I install a .deb file with apt?
Use `sudo apt install ./package.deb` and apt will handle dependencies automatically. This is better than dpkg -i.
How do I reinstall a package?
Use `sudo apt install --reinstall package_name` to reinstall a package, useful when files are corrupted.
How do I install without upgrading other packages?
Use `sudo apt install --no-upgrade package_name` to install without upgrading already installed packages.
How do I see what will be installed before confirming?
apt shows the list of packages to be installed and asks for confirmation before proceeding. Use `-y` to skip the prompt.
How do I install packages from a different release?
Edit /etc/apt/sources.list to add the desired release repository, then run `sudo apt update && sudo apt install package`.
Related Package Management
apt upgradeUpgrades all installed packages to their latest available versions.
apt removeRemoves a package but keeps its configuration files.
apt updateUpdates the local package index with the latest information from repositories.
apt purgeRemoves a package along with all its configuration files.
pip installInstalls Python packages from the Python Package Index (PyPI).
apt autoremoveRemoves packages that were automatically installed as dependencies and are no longer needed.