How to update list of available packages on Ubuntu server
Commands to update Ubuntu package list
1. Log into your Ubuntu server
You can SSH into your Ubuntu server using softwares like ‘Putty’
2. Run ‘apt update’ to update the package list from the repository
apt update
OR
apt-get update
Example :
# apt update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [794 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [760 kB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [19.2 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [6783 B]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1056 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [32.7 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [10.5 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1321 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [2496 B]
Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [4244 B]
Fetched 17.4 MB in 26s (670 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
37 packages can be upgraded. Run 'apt list --upgradable' to see them.
Update software list using aptitude command
1. Log into Ubuntu server as user with sudo privilege or as ‘root’ user
2. Run ‘aptitude update’ command
Hit http://archive.ubuntu.com/ubuntu bionic InRelease
Get: 1 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get: 2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get: 3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Fetched 252 kB in 3s (99.3 kB/s)