0% found this document useful (0 votes)
67 views

How Do I Update Ubuntu Linux Software Using Command Line

This document provides instructions for updating software on an Ubuntu Linux server using command line commands. It details how to update package lists, upgrade installed packages, and install individual packages using apt-get or aptitude. It also covers installing kernel updates and applying updates over SSH.

Uploaded by

gaschoneweg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

How Do I Update Ubuntu Linux Software Using Command Line

This document provides instructions for updating software on an Ubuntu Linux server using command line commands. It details how to update package lists, upgrade installed packages, and install individual packages using apt-get or aptitude. It also covers installing kernel updates and applying updates over SSH.

Uploaded by

gaschoneweg
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

nixCraft

Linux and Unix tutorials for new and seasoned sysadmin

How Do I Update Ubuntu Linux Software


Using Command Line?
last updated April 28, 2020 in Debian / Ubuntu, Linux, Ubuntu Linux

I
have latest version of Ubuntu Linux LTS server. How do I update Ubuntu Linux for
security and application x/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 or apt command – apt-get command or apt command 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.

Update Ubuntu Linux Software Using Command Line

Let us see all commands and options.


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

The commands are as follows:

1. apt-get update : Update is used to resynchronize the package index les from their sources on Ubuntu
Linux via the Internet.
2. apt-get upgrade : Upgrade is used to install the newest versions of all packages currently installed on
the Ubuntu system.
3. 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 updated software list for Ubuntu, enter:

Type the following apt-get command:

$ sudo apt-get update

OR

$ sudo apt update

U P D A T E S O F T W A R E ( S ) I . E . A P P LY U P D A T E S A N D PA T C H E S O N U B U N T U
LINUX

Type the following apt-get command:

$ sudo apt-get upgrade

OR

$ sudo apt upgrade


Installing updates on Ubuntu Linux system

Please note that above two commands will fetch les from the Internets or local mirrors. The location of
update pages is speci ed in /etc/apt/sources.list (repositories). You need NOT to make any changes to
this le until and unless you need extra repositories for your setup.

I N S T A L L K E R N E L U P D A T E S O N A U B U N T U LT S S E R V E R

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 [email protected]

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”
con ict 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 le contains a list of locations from which to
retrieve desired package les.

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

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

This entry is 2 of 11 in the Debian/Ubuntu apt-get Tutorial series. Keep reading the rest of the series:
1. Ubuntu 18.04 update installed packages for security
2. How Do I Update Ubuntu Linux Softwares Using Command Line?
3. Ubuntu Linux: Upgrade Linux Kernel
4. Ubuntu Enable & Setup Automatic Unattended Security Updates
5. Linux: Update All Packages Command
6. How do I update Ubuntu using terminal command line
7. Debian upgrade or update a single package using apt-get
8. Ubuntu upgrade or update a single package using apt-get
9. How do I see what packages are installed on Ubuntu Linux?
10. What does sudo apt-get update command do on Ubuntu/Debian?
11. Ubuntu Linux – How Do I install .deb Packages?
This entry is 3 of 5 in the Upgrade On a Ubuntu Server Tutorial series. Keep reading the rest of the series:
1. How to upgrade Ubuntu 16.04 to 18.04 LTS using terminal
2. AWS Lightsail upgrade Ubuntu 16.04 LTS to 18.04 LTS
3. How Do I Update Ubuntu Linux Softwares Using Command Line?
4. HowTo: Upgrade To a Newer Version of Ubuntu 14.04 LTS
5. Upgrade Ubuntu 18.04 to 20.04 LTS using command line

SHARE ON Facebook Twitter

ADVERTISEMENTS

Posted by: Vivek Gite


The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux
operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics
via RSS/XML feed or weekly email newsletter.

Historical Comment Archive

40 comment

kingsly October 2, 2007 at 9:31 am

up date Ubuntu6.06 i have Ubuntu6.10iso le

Phan November 9, 2007 at 6:01 am

I installed ubuntu sofware in my laptop but I can changed the display of monitor (the evolution of screen
is only 1240×768). I want to change it into 1240×800 to t with the widescreen. So what do I do to change
it.
I want to have vietnamese font in ubunto? please let me know the way to get it!
thank you very much!

suman December 4, 2013 at 9:05 am

may i know ur processor plz

son March 3, 2008 at 6:12 pm

I installed the ubuntu 7.10 versiyon.At the beginning ı can not connect the internet then nd a way and
mozilla can connect the web.But there is a problem about updates ı have not a web connection for doing
updates.no problem about modem no problem about networking and mozilla work good but other
application like pidgin and updates do not connect web.What can ı do?

Silencedbear December 25, 2010 at 10:48 pm

Try updating your software sources. Go to linux ubuntu website and search for software sources. I had
this problem similar to this with my Pidgen. I had to change the server addresses for my Yahoo chat to
work. But you go to System>Administration>Software Sources. Hope This Helps You….

Matey December 15, 2008 at 4:48 pm

I cannot update my Feisty 7.04 and don’t have GUI on the server!
How can I do any updates at all?
apt-get update returns a lot of errors but downloads some things? I do not know what or where?
and apt-get install update does Not work and gives me E: error !
I know now that ubuntu has abandoned the 7.04 version and has changed the link/ulr so the server cant
nd the les it needs (to download). but when I try to put a correct link in my sources.list le the errors
continue!?
Does anyone know how to Manually install the updates???
Now if Microsoft had change the URL, we would never hear the end of it, that is only fair not to mess with
the con guration les on a fairly new operating system (feisty 7.04 is not that old at all, compared to NT is
a new born baby)!
I am new in linux and really like some of the features but it sucks when you have to spend all your time on
a dumb little simple matter as to an update,

Brian January 14, 2009 at 8:24 pm

Working Ubuntu server from the command-line, this help was very useful.
john March 25, 2009 at 3:15 am

I the speed of updating is so slowly,what should i do to update faster?

Chris Cummings June 11, 2010 at 5:44 pm

is that bad?

yannaing March 9, 2012 at 10:25 am

yes…..it was last updated for 113 days ago….fuck the update manager……check,check,check

Matey March 26, 2009 at 5:33 pm

if you update your network settings and if you are getting IP address from DHCP you can run dhclient
eth0 (or whatever NIC) and update the net info.
this will improve your speed.

james May 15, 2009 at 1:25 am

Hello,
I installed ubuntu linux 9.0 on my computer how can i install a program i bought from the store or add a
new graphics card. I have been trying to put new programs on my computer but the disc always comes
up as a le and doesn’t autorun the program for installation. need much help thank you

mehdi May 15, 2009 at 9:56 am

If you are in the Graphical mode (GUI) then you can browse the cdrom to see what program is executable
(usually install.sh or similar program).
If the CD is a linux program then a shortcut (link) to it will appear on your desktop.

If you are in the command line;


There are usually a link (or shortcut) to the CDROM in the root of your drive, if there isnt then you have to
cd /media then cd cdrom .
if you have the rights (login as root or type su ) then you can cd /cdrom
(after you load the cd in the drive) then you can do an ls to see any install.sh program or README le to
tell you how to install that program.

Dennis Quek June 11, 2009 at 6:37 am

Great stuff, but can you upgrade just a single package eg. phpmyadmin only?
SEanS July 13, 2009 at 2:49 pm

Very good if you have a working system! But mine is not working so I can’t up date cos my upgrade is not
completed until the desktop is updated and running.

So do I just re-load again or have I misses some thing?

Rgds SEanS

Boi October 5, 2009 at 9:48 am

How can you install a windows program on ubuntu?

zafer May 9, 2011 at 3:11 pm

rstly you must install wine. after you can install windows program together wine.

Mehdi October 6, 2009 at 12:01 pm

I am not an expert in Linux but I think you have to use the fdisk program in linux to create an NTFS or
FAT32 partition so you can install Windows on it.
fdisk in command prompt is easy to use really,
you can do an fdisk -l (L) to see what is available then do fdisk /dev/sda1 or whatever
press m for help. then l to see the list of partitions. (i.e 8e for LVM or virtual drives in Linux)…

OR if you already have an unused partition (empty) you can install Windows on it.
but take extra care not to format the linux partition.

IF your Linux system does not come up correctly you can type fsck to x it.

Fernando Luna October 12, 2009 at 6:54 pm

There may be a suitable alternative to your Windows program, depending on what it is. There are lots of
choices as far as open source software goes, you might get lucky.

You might also be able to use Wine, a Windows Emulator to install and run your Windows program, again,
depending on what program it is.

soulsinner November 19, 2009 at 4:20 pm


Hello all….
It’s been great with the Karmic. I’m using it almost anywhere. And it does work like charm after install..
And right now i’m learning the command so i can setup my own server box. Mehdi, you are a great guy,
always trying to help others… So i want to add a bit on what mehdi talk about.
If u want to run a windows program install WINE and then you can run a lot of windows program(not all..
go to winehq and read the list)
I can run my warcraft & Counter Strike that reside on my NTFS(windows) partition just like that. WINE is
really a great program.
2. U don’t need fdisk all the way to manage a partition. Use gParted instead. Shrink the partition. make a
new empty partition and boot up the windows cd and install windows. then con gure the GRUB loader
to boot your windows as well.
3. Always make time to read some tutorial and browse the forum. It will help you greatly. And try to always
use the terminal to make you more understand linux (although ubuntu have done a well done job on the
GUI side)

mike runner March 11, 2010 at 9:13 pm

after installing packages how can i see the list of the packages or les that were just install? I am talking
use terminal commands?

Rambang gedian October 23, 2010 at 9:44 am

I HAVE problem to activate ubuntu 10.6 in my compture,,,,

Sisay milkias April 29, 2011 at 3:53 pm

I’ve faced a problem in using ubuntu to update softweres of midia player ,video player,to running & to
compile fortran programming language & more help me

Kevin May 24, 2011 at 8:57 am

I am very new to ubuntu linux, I was wondering, if I have Ubuntu and I want to upgrade it to the next
version, will the drivers (and etc), get updated (or at least stay there) as well? Or do I need to install one
and each of them again manually?

Matey May 25, 2011 at 2:20 pm

I am new and still learning but here’s what I know:


If you have a computer which is running Windows then I suggest to use the Wubi which is a small le
but installs the latest version of Ubuntu for you (without making changes in your le allocation table
or boot sector and you will Not lose any of your Windows les, and it defaults into Windows with
Ubuntu as 2nd choice).
As for the updates and upgrades Ubuntu has a program which comes up automatically and asks you
to verify username/password and then it updates it regularly (You can turn that option off or set it in
longer intervals), Otherwise you can do it in terminal by sudo apt-get updates or upgrade.
I had a bit of problem with the Auto Updates (In GUI) with version 10.x, I have not had any trouble with
(the auto-updates) in this new (11.x ) version so far and I have been using it for few weeks now.
In the last version it would totally freeze the computer and the last time it froze I lost everything (of
course it was a learning machine and I didnt rely on it for anything) But then other people told me
they had same problem (in version 10.x).
So to be on the safe side, try to use the command line for updates and upgrades.

Also I think with updates you update the lib. les and some drivers but with upgrade you upgrade the
kernel le?!
good luck.

William July 26, 2011 at 4:37 am

I am having troubles updating my 7.04 Feisty. I am trying to update to 11.04, but am not successful. I have
the CD for it, and every time i run it, it takes forever, and doesnt seem to do anything. After a while, at the
bottom, a few numbers and le names appear. it counts up from 1, and just keeps going up every second.
It reached 8500 until i turned it off. Why will 11.04 get installed?

Matey July 26, 2011 at 10:05 pm

I used to have the same problem with updating, it was my hardware I think , I used different method of
installation (used all the different options) but nothing worked.
Have you taken different options to see if it works? Do you have enough Hard Drive space left for an
update?
Anyway now I do a partition-less install using Wubi but that is an exe le and only works in Windows. If
they have something like Wubi for Linux, it would be excellent cuz it works great. (May be you can use
Wine to run Wubi inside Ubuntu)? it is a 1.4 meg le but it picks up the latest version of Ubuntu for you
and installs it.
good luck.

Milon August 19, 2011 at 1:36 pm

I did a mistake when I was running some programs. By mistake I pressed the update button on the
software update page. Immediately I pressed the cancel button to cancel the update installation. But I
didn’t able to cancel it. Then I pressed the shut down button immediately. After that when I started the
computer, I didn’t able to open the computer anymore. it shows some spectral line on the screne.

Please give me some suggestion. Thank you.

Shivendra Mishra September 23, 2011 at 3:11 am


It’s writing command not found on my machine.

Carl September 28, 2011 at 5:35 pm

I can’t update my ubuntu drivers please someone help

naaree June 13, 2012 at 9:01 pm

i am intrested the program of ubuntu linux because i have learn about

Alain kat July 12, 2012 at 2:15 pm

I used to have the same problem with updating, and lose sound and other software by the way it was my
hardware, I used different method of installation with network connection and I used all the different
options and all worked.

eb4671 November 8, 2012 at 3:57 am

I’m VERY VERY new to ubuntu:

I installed 12.10 rebooted and ran the update and upgrade commands! after rebooting all I see is a dos
looking window with something like the below:

Last login: Wed Nov 7 21:24: CST 2012 on tty1


Welcome to unbuntu 12.10 (GNU/Linux 3.5.0-17-generic i686)

* Documentation: https://help.unbuntu.com/
~$

I was hoping to see some sort of a window GUI screen after installing and updating!

Any ideas?

Matey November 9, 2012 at 2:27 am

I’ve been away for so long…anyway


login as root or admin, the root is there but you probably have to change his password so rst do a su for
super uswer then see if it takes your login, if not do a passwd root and set a new password but never log in
as root bc it is dangerous and can wipe out your hard drive or do other damages without you meaning to
do so…

create a user by adduseror useradd and then passwd user (whatever name you gave it) enter password
2ice and then run X for xwindow
you ,might want to try holding the Alt key then pressing F7(or shift alt f7) to see if the windows already
loaded.
If not then reinstall the GUI or xwindows…(Hopefully you have netwirk connection because you will need
to use the command apt-get a lot to downoad and install programs).If you are using MS Windows then
you may want to install Wine(its a huge progrqam but you can run .exe and other les just like in
windows)
good luck!

sorry I have been away for so long that I have forgotten a lot of my linux. I ythink 7x was the latest when I
was running linux servers heh..been a while
hopefully someone else will reply.

Matey November 9, 2012 at 2:32 am

sorry about the typos..


adduser
or
useradd
both work but one is more elaborated

anyway it was network not netwirk…also it was supposed to be “I think version 7.x was the latest” not I
ythink…anyway:
hopefully one of these days I’ll get me a job then I can get back into working on linux….
:-)

Eduardo de Oliveira December 19, 2012 at 4:05 pm

apt-get upgrade tip was very useful! Thanks.

Gilbert July 4, 2014 at 6:33 am

I have tried all the commands i know and have seen, but none is working or my laptop, i keep getting
these same message in the terminal
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_raring-
security_restricted_i18n_Translation-en
E: The package lists or status le could not be parsed or opened.
E: _cache->open() failed, please report.
what should i do to upgrade my system?

prakash October 17, 2014 at 5:41 am

i want to use the c langauge to install that whta i have to do


Pamparthi santhosh September 30, 2015 at 6:05 am

I have installed Ubuntu 14.04LTS on my laptop everything is OK but when I open the terminal page it’s
working(keyboard) but when I going to write c program on page the keyboard is not working
Pls give tell me resoan why it’s not working on that time

Bob April 2, 2017 at 4:36 pm

The of cial ppas never have the latest software, is there a way to update all the applications i have
installed without having to go to each ppa site to download manually ?

    Still, have a question? Get help on our forum!

Tagged as: apt-get command, Easy

©2000-2020 nixCraft. All rights reserved.

PRIVACY

TERM OF SERVICE

CONTACT/EMAIL

DONATIONS

SEARCH

You might also like