Article overview

Help article

Installing software in Ubuntu 16.04

In this article, we show you how to install software packages in Ubuntu 16.04 and how to find out in which repository the software can be found.

Follow the steps in this article from command-line as root user, or with sudo.


Installing a package

In Ubuntu, you install packages with the following commands:

apt -y install packagename
apt-get -y install packagename

Apt / apt-get is a meta package handler / package manager with which you can manage packages, for example, or create repositories.

By adding -y, you automatically give permission when you are asked for permission to install the relevant package.


 

Finding out in which package software is included

 

Do you want to use a command, but does Debian say that the command cannot be found? Then you can find out if you can install it by checking if it is part of a package that is included in a repository which you use in Debian. You do this with the command:

apt search commandname

If you want to use netstat, for example, you use the command:

apt search netstat

For example, the output looks like this:

Sorting... Done
Full Text Search... Done
bwm-ng/stable 0.6.1-2 amd64
  small and simple console-based bandwidth monitor

gnome-nettool/stable 3.8.1-1+b2 amd64
  network information tool for GNOME

golang-github-aelsabbahy-gonetstat-dev/stable 0.0~git20160428.0.edf89f7-2 all
  Netstat implementation in Go

libparse-netstat-perl/stable 0.12-1 all
  module to parse the output of the "netstat" command

net-tools/stable 1.60+git20161116.90da8a0-1 amd64
  NET-3 networking toolkit

etc. etc. 

Therefore, to use the netstat command, you install net-tools in this case:

apt install -y net-tools

You may wonder how you know that net-tools was the right search result. When you see a large number of search results, it is best to search the Debian package page under 'Search the contents of packages' on the relevant command/software.

As a rule, you will always need the top result on this page or at least the command which is in the /bin or /usr/bin directory. In this example, you will also see results such as dnetstat, snmpnetstat at netstat, which are clearly not the same.


 

Finding out in which repository software is included

 

It may happen that the software you want to install is not included in a repo that you are currently using. In that case, the relevant software cannot be installed.

You can exclude whether this is the case by seeing if the software is part of a package included in your current repositories. You use the following command for this: 

apt search packagenaam

When you see nothing more than 'Unable to locate package packagename' or ...

Sorting... Done
Full Text Search... Done

... this means that the required package does not exist or is part of another repository

For Ubuntu, it is best to look up the package at https://packages.ubuntu.com/. Set the distribution to 'Bionic' and enter the package name under 'Search package directories'. The search results state the repository of which the package is part of in bold between the brackets at the end, for example [universe].


Updating packages

 

You can easily update all installed software in Ubuntu with one of the commands:

apt update
apt-get update

Adding a repository

 

You can add repositories in two ways.

  • The first is from command-line. You first need the software-properties-common package:
    apt install -y software-properties-common
    Then, add a repository with the command:
    add-apt-repository deb http://site.example.com/ubuntu distribution component1
    See the explanation at the bottom of this section for an explanation of the code.
     
  • The available Debian repositories can be found in the /etc/apt/sources.list file and you can, for example, open them with:
    nano /etc/apt/sources.list
    Remove / uncomment the # in front of the line starting with # deb for the repository you want to add, or manually add a new repo with the syntax:
    add-apt-repository deb http://site.example.com/ubuntu distribution component1
    Then, save your changes (ctrl + x> y> enter) and update the available package list:
    apt-get -y update

The rules you see in this file are made up of:

  • deb: the repositories containing the binaries and precompiled packages.
  • deb-src: these repositories also contain the source code of packages and are only useful for developers.
  • http://acrhive.ubunu.com/debian: where the repository can be found.
  • distribution: the release name of the Ubuntu 16.04.
  • main & restricted: the section names of the repository.

 

This concludes this guide on installing software in Ubuntu 16.04. Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘ContactUs’ button at the bottom of this page.

If you want to discuss this article with other users, please leave a message under 'Comments'.

Has this article been helpful?

Create an account or log in to leave a rating.

Comments

Create an account or log in to be able to leave a comment.