sometimes we will see following messages after login via ssh.

1
2
88 packages can be updated.
80 updates are security updates

you can go though following commands to do update.

1
2
3
4
root@n2:~# apt-get update
root@n2:~# apt-get upgrade
root@n2:~# apt-get autoremove
root@n2:~# apt-get dist-upgrade

if you get key expired message like this

1
2
W: GPG error: http://nginx.org trusty
InRelease: The following signatures were invalid: KEYEXPIRED 1471427554

1st, find the expired keys and id

1
2
root@n2:~# apt-key list | grep "expired:"
pub 2048R/7BD9BF62 2011-08-19 [expired: 2016-08-17]

you can using following command to update the expired key

1
root@n2:~# apt-key adv --recv-keys --keyserver keys.gnupg.net "7BD9BF62"

but if you got an timed out issue like this

1
2
3
gpg: requesting key 7BD9BF62 from hkp server keys.gnupg.net
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error

that’s means it got blocked by firewall,
try to force using port 80

1
root@n2:~# apt-key adv --recv-keys --keyserver hkp://keys.gnupg.net:80 "7BD9BF62"