Join the open source coding forum

How to keep the server OS up to date

Many big companies got hacked the last week because of missing software updates. That's why I want to update all my software. Now I would begin with the installed server OS. In my case, it is Ubuntu 16.04.2 LTS. Can anybody describe how to update the OS and also the installed modules on the server? How can I see what needs to be updated?  

shah's picture

Two commands to keep system updated

Vote the answer: 
Average: 5 (1 vote)

To update at you have to log in with a sudo administrative privileged account and run two simple commands-

sudo apt-get update


sudo apt-get upgrade

sudo executes commands with superuser permission. That's why you need sudo privileged account to perform the execution. Now when you write the first command and hit enter, the prompt would request a password for the superuser. When you write the password, it won't be shown even in forms of stars or black dots. Don't get panicked. It's how Linux work. When you hit enter again giving the password, the system will check the installed packages against the available newer (if any) versions of software packages. If available, system package lists will be marked for update.


Now write the next command and hit enter. This upgrade command will now check for the packages requiring updates. Then it will download, remove, update available packages according to necessity.


The commands I mentioned are only applicable for Ubuntu and Debian OS. Other Linux distributions have their own way to handle such situations.

Rafsan's picture

See the packages available for upgrade

Vote the answer: 
Average: 5 (1 vote)

Concerning your question "How can I see what needs to be updated?", You just need to execute the following two commands -

sudo apt update
apt list --upgradable

If you want to know what any command will change to your system, then try --dry-run. The following example may give you some insight on how to execute this commands-

sudo apt-get upgrade --dry-run