Installing Software in Ubuntu
Ubuntu gives you four distinct methods for installing software, each with different trade-offs in terms of security, update management, and integration with the system. Knowing when to use each one is more important than just knowing the install commands.
The four ways to install software
| Method | Command | Best for | Security |
|---|---|---|---|
| apt (from repo) | sudo apt install nginx | Everything available in Ubuntu repos | Highest (Canonical signed) |
| dpkg (local .deb) | sudo dpkg -i package.deb | Vendor .deb files (Chrome, VS Code) | Medium (trust vendor) |
| snap | sudo snap install lxd | Apps distributed via Snap Store | Medium (sandboxed) |
| From source | make && make install | Custom versions, patches, not in repos | Lowest (no review) |
Installing with apt
# Always update the package index first
sudo apt update
# Install a package
sudo apt install nginx
# Install a specific version
sudo apt install nginx=1.24.0-2ubuntu7
# Install multiple packages at once
sudo apt install nginx mysql-server php8.3-fpm
# Install a package without recommended extras (minimal install)
sudo apt install --no-install-recommends nginx
# Install without confirmation prompt (for scripts)
sudo apt install -y nginx
Confirming what will be installed before proceeding
$ sudo apt install nginx
The following additional packages will be installed:
libnginx-mod-http-geoip2 libnginx-mod-http-image-filter nginx-common nginx-core
Suggested packages:
fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
nginx nginx-common nginx-core [...]
After this operation, 2,018 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Installing a .deb file directly
Some vendors distribute .deb files for direct download (Google Chrome, VS Code, Zoom). Download the file and install with dpkg:
# Download and install a .deb file
# Example: installing VS Code
curl -Lo vscode.deb "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64"
sudo dpkg -i vscode.deb
# dpkg does NOT resolve dependencies — fix any missing deps with:
sudo apt --fix-broken install
# Better: use apt to install the .deb (resolves deps automatically)
sudo apt install ./vscode.deb
💡 TIP: Use
sudo apt install ./package.debinstead ofsudo dpkg -i package.deb. Theaptmethod calls dpkg internally but also pulls in missing dependencies automatically, avoiding the manualdpkg --configure -astep.
Installing with snap
# Search for a snap
snap find lxd
snap find "code" # VS Code
# Install a snap
sudo snap install lxd
sudo snap install code --classic # --classic allows full system access
# Install a specific channel (stable, candidate, beta, edge)
sudo snap install microk8s --channel=1.30/stable
# List installed snaps
snap list
# Update a specific snap
sudo snap refresh lxd
# Update all snaps
sudo snap refresh
Installing from source
Installing from source is necessary when you need a version not in any repository, need to compile with custom flags, or are applying a patch. It is also the riskiest method: no automatic security updates, manual upgrade process, and files go to non-standard paths if you are not careful.
# General from-source install pattern
# 1. Install build dependencies
sudo apt install -y build-essential
# 2. Download the source
curl -LO https://example.com/software-1.2.3.tar.gz
tar -xzf software-1.2.3.tar.gz
cd software-1.2.3/
# 3. Configure (check for any missing dependencies here)
./configure --prefix=/usr/local
# 4. Compile
make -j$(nproc) # Use all CPU cores
# 5. Install to /usr/local (does not conflict with apt packages)
sudo make install
# 6. Verify
/usr/local/bin/software --version
⚠️ WARNING: Never install from source to
/usr/binor/usr/lib. These paths are managed by apt and will be overwritten during system upgrades. Always use--prefix=/usr/local. There are no automatic security updates for source installs — you must monitor CVEs and rebuild manually.
Verifying an installation
# Confirm the package is installed
dpkg -l nginx | grep "^ii"
# Find where the binary is
which nginx
whereis nginx
# Check the installed version
nginx -v
# or
dpkg -l nginx | grep "^ii" | awk '{print $3}'
# Find all files installed by a package
dpkg -L nginx | head -20
# Check the service is running
systemctl status nginx
Conclusion
Use apt install for everything available in Ubuntu repositories — it is the safest, most maintainable method. Use sudo apt install ./file.deb for vendor-distributed .deb files (not dpkg -i). Use snap for applications the vendor distributes that way. Reserve from-source builds for cases where no package exists, install to /usr/local, and understand you are responsible for security updates.
FAQ
Is Installing Software in Ubuntu important for Ubuntu administrators?+
Yes. It supports practical Ubuntu administration because it connects directly to server reliability, security, troubleshooting, or daily operations.
Should I practice this on a live server?+
Use a lab VM first. After you understand the command output and rollback path, apply the workflow carefully on real systems.
What should I do after reading this article?+
Run the practice commands, write down what each one shows, and continue to the next article in the Ubuntu roadmap.
Need help with Ubuntu administration?
Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.
Hire Me for Support