How do i update the droplet? Confused with what command to use seeing the answers.

March 12, 2016 3.7k views
DigitalOcean Linux Commands PostgreSQL Nginx Apache Java Ubuntu

Hello,

I am using Ubuntu 14.04 x64. I have tomcat7, Java, nginx, postgres.
Every time i log into my droplet using terminal,i get this :
227 packages can be updated.
126 updates are security updates.

I searched for this question here and got a lot of answers, but i am confused with what command to proceed with. Listed all the questions pointing to the same and their answers :

  1. Link 1 gives this as an answer : There most likely will be a restart required for a few of them. Shutdown & snapshot then run this: sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo reboot Note: That command will automatically say yes to all updates and will restart one it completes updates. If something breaks or you are having issues, restore back to the snapshot.*
  2. Link 2 says to use : The most basic way of applying updates would be to use apt-get from the CLI. apt-get update apt-get upgrade Before running apt-get upgrade I would recommend backing up core configuration files though, if you've made changes (i.e. nginx.conf, php5-fpm.conf, php.ini etc) as there is potential for them to be overwritten.
  3. Link 3 gives this as answer : Updating packages normally does not overwrite config files and even if it did, they are usually coded to update your config file with your settings. But it is a good idea to take a snapshot of your droplet before doing any updates. And to update, you can run the following commands, sudo apt-get update sudo apt-get upgrade This is my question only. Im sorry for writing again. Today i was about to do any update and saw a few more answers regarding it, so got confused.
  4. Link 4 gives this as a answer : You can try the following cli to keep your droplet up-to-date, clean and secure: apt-get update && aptitude dist-upgrade -y && apt-get autoremove -y.

My questions are:

  1. Are the security updates required command different than the package update required commands?
  2. Will the commands override any of the config files?
  3. What commands should i use to update both packages and security updates? Should i use :
    • sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo reboot OR
    • apt-get update
      apt-get upgrade OR
    • apt-get update && aptitude dist-upgrade -y && apt-get autoremove -y.

I am sorry since i am a little nervous with this updates thing. But i know thats its important to have those updates.

Thanks in advance,
Kavisha.

5 Answers

I agree with Woet about not running commands you don't understand. Same goes with blindly copy/paste commands from the Internet.

With that said this will give what your are asking. Reading up about apt-get will hopefully help.

Update your apt cache

sudo apt-get update

I like use the "-s" (dash letter s; simulate) command switch see what will be installed, update and removed before applying the upgrade.

sudo apt-get -s upgrade

When ready to install the upgrades

sudo apt-get -y upgrade
  • I was a little nervous i think since i had to finish the task on saturday itself. But I paid heed to Woet's advice and read on it and finally executed the commands. Also i learnt how to take a snapshot. :)Thank you so much.

  1. No, they are just more important.
  2. Not unless you tell it to.
  3. You shouldn't be running commands you don't understand, run man apt-get to find out.

And you might be interested in https://help.ubuntu.com/community/AutomaticSecurityUpdates

I'm afraid this is the reason I wouldn't trust DO with critical or important data. They're fine for testing stuff yes, but otherwise. run 3

You discussed really valid and good points in your post and It really happened some person do not have the right idea. But with your awesome tips, one can easily identify it.
You should also check details of MS office setup for any query and problem

this answer is awesome, i really like this tips, thank you run 3 unblocked

Have another answer? Share your knowledge.