Wednesday 14 December 2016

How Do I Update Ubuntu Linux Softwares Using Command Line?


 I have latest version of Ubuntu Linux LTS server. How do I update Ubuntu Linux for security and application fix/upgrades using ssh command line? How can I install updates via command line option?

Ubuntu Linux can be upgraded using GUI tools or using traditional command line tools such as:

  1. apt-get command – apt-get is the command-line tool for handling packages.
  2. aptitude command – aptitude is a text-based interface to the Debian GNU/Linux package system including Ubuntu Linux.

Ubuntu Linux server – Install updates via apt-get command line (option #1)

The commands are as follows:
=> apt-get update : Update is used to resynchronize the package index files from their sources via Internet.
=> apt-get upgrade : Upgrade is used to install the newest versions of all packages currently installed on the system
=> apt-get install package-name : Install is followed by one or more packages desired for installation. If package is already installed it will try to update to latest version.
First, open the Terminal application and type following two commands (Application > Accessories > Terminal).

Get update software list, enter:

Type the following apt-get command:
$ sudo apt-get update

Update software(s) i.e. apply updates and patches on Ubuntu Linux

Type the following apt-get command:
$ sudo apt-get upgrade
Please note that above two commands will fetch files from the Internets or local mirrors. The location of update pages is specified in /etc/apt/sources.list (repositories). You need NOT to make any changes to this file until and unless you need extra repositories for your setup.

Install kernel updates on a Ubuntu LTS server

Type the following apt-get command:
$ sudo apt-get dist-upgrade
If a new kernel installed, reboot the server:
$ sudo reboot

To upgrade individual software called foo type command:

$ sudo apt-get install foo
OR
$ sudo apt-get install apache php5 mysql-server

Ubuntu Linux server – Install updates via aptitude command line (option #2)

The syntax is as follows to Update the packages list:
$ sudo aptitude update
To actually upgrade the packages, type:
$ sudo aptitude safe-upgrade

Apply Ubuntu server updates over ssh based command line session

First, login to the remote Ubuntu server using ssh client:
$ ssh user@server-name-here
$ ssh vivek@server1.cyberciti.biz

Once your log into your server, run the following two commands:
$ sudo apt-get update
$ sudo apt-get upgrade

OR
$ sudo aptitude update
$ sudo aptitude safe-upgrade

OR
$ sudo apt-get update
$ sudo apt-get dist-upgrade

From the apt-get(8) page:
The dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a “smart” conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. So, dist-upgrade command may remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files.

Using Ubuntu Update Manager GUI tool

Ubuntu Update Manage the GUI tool. It works like Microsoft or Red Hat update manager i.e. you will see a little icon in the kicker bar/taskbar when there are updates. It will only appear when new upgrades are available. All you have to do is click on it and follow the online instructions. You can also start the GUI tool by Clicking System > Administration > Update Manager

A note about the latest version of Ubuntu Linux

Press the Superkey (Windows key) > Type updater:
Fig.01: Ubuntu Launch the Software Updater
Fig.01: Ubuntu Launch the Software Updater

You will see the box as follows. Click on the Install now button
Fig.02: Installing updates on a Ubuntu Linux

No comments:

Post a Comment