Questions tagged [apt-get]

GENERAL APT-GET SUPPORT IS OFF-TOPIC. Support questions may be asked on https://superuser.com. apt-get is a command-line tool used to work with Advanced Packaging Tool (APT) of Debian-based Linux distros and for performing actions such as installing or upgrading a package.

The apt-get command is a powerful command-line tool used to work with Debian's Advanced Packaging Tool (APT) performing such functions as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Debian system.

Being a simple command-line tool, apt-get has numerous advantages over other package management tools available in Debian for server administrators. Some of these advantages include ease of use over simple terminal connections (SSH) and the ability to be used in system administration scripts, which can in turn be automated by the cron scheduling utility.

Examples

  • Install a Package: Installation of packages using the apt-get tool is quite simple. For example, to install the network scanner nmap, type the following:

    sudo apt-get install nmap
    
  • Remove a Package: Removal of a package or packages is also a straightforward and simple process. To remove the nmap package installed in the previous example, type the following:

    sudo apt-get remove nmap
    

[Tip] Multiple Packages: You may specify multiple packages to be installed or removed, separated by spaces. Also, adding the --purge options to apt-get remove will remove the package configuration files as well. This may or may not be the desired effect so use with caution.

  • Update the Package Index: The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file. To update the local package index with the latest changes made in repositories, type the following:

    sudo apt-get update
    
  • Upgrade Packages: Over time, updated versions of packages currently installed on your computer may become available from the package repositories (for example security updates). To upgrade your system, first update your package index as outlined above, and then type:

    sudo apt-get upgrade
    

Further Reading

For further information about the use of APT, read the comprehensive Debian APT User Manual or type in command-line:

apt-get help  
1055 questions
305
votes
2 answers

How to install Maven 3 on Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04 by using apt-get?

Try: sudo apt-get install maven If it works for you ignore the rest of this post. Intro I started setting up my Ubuntu 12.10 on April 2013 and the normal sudo apt-get install maven was not working for maven 3 back then. The manual installation in…
AmirHd
  • 10,308
  • 11
  • 41
  • 60
295
votes
29 answers

How can I check if a package is installed and install it if not?

I'm working on a Ubuntu system and currently this is what I'm doing: if ! which command > /dev/null; then echo -e "Command not found! Install? (y/n) \c" read if "$REPLY" = "y"; then sudo apt-get install command fi fi Is this what…
John Jiang
  • 11,069
  • 12
  • 51
  • 60
249
votes
9 answers

How to thoroughly purge and reinstall postgresql on ubuntu?

Somehow I've managed to completely bugger the install of postgresql on Ubuntu karmic. I want to start over from scratch, but when I "purge" the package with apt-get it still leaves traces behind such that the reinstall configuration doesn't run…
John Mee
  • 50,179
  • 34
  • 152
  • 186
237
votes
11 answers

How can I check the version before installing a package using 'apt-get'?

I'm thinking to install hylafax+ version 5.5.4 which was released last month on my Debian PC. I checked dpkg -l | grep "hylafax" and found out that the current version is 5.5.3. Then I checked apt-cache search hylafax and saw the packages are…
Yasiru G
  • 6,886
  • 6
  • 23
  • 43
213
votes
8 answers

apt-get install tzdata noninteractive

When I try to apt-get install -y tzdata the command line option for picking timezone shows up. I am trying to use this in a script to do some setup, how can I make the apt-get run without user input? I know to reconfigure the tzdata I can do echo…
PYA
  • 8,096
  • 3
  • 21
  • 38
205
votes
4 answers

What is docker.io in relation to docker-ce and docker-ee (now called "Mirantis Kubernetes Engine")?

Previously, to install Docker, I would use apt-get install docker.io However, I have recently noticed the documentation for installing docker, and it uses docker-ce. I have tried to find the difference between the two, but I have come up empty.…
Will Parzybok
  • 2,764
  • 4
  • 12
  • 18
166
votes
9 answers

How to install Android SDK on Ubuntu?

For my Ubuntu machine, I downloaded the latest version of Android SDK from this page. After extracting the downloaded .tgz file, I was trying to search for installation instructions and found: To get started on Linux: Unpack the .zip file you've…
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
151
votes
18 answers

Docker Repository Does Not Have a Release File on Running apt-get update on Ubuntu

I am using Ubuntu 16.10 and recently installed Docker (v1.12.4) using the Xenial build by following the instructions found here. I haven't encountered any problems creating containers, ensuring they restart automatically, etc. However, now every…
Daniel Eagle
  • 2,205
  • 2
  • 18
  • 17
146
votes
7 answers

apt-get for Cygwin?

Is there any apt-get-like program for use with Cygwin? I already tried cyg-apt but when I try I get this error: cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.bz2 cyg-apt: downloading:…
Hyztname
  • 1,597
  • 2
  • 10
  • 7
135
votes
20 answers

Docker build "Could not resolve 'archive.ubuntu.com'" apt-get fails to install anything

I've been trying to run Docker build on various files which previously worked before, which are now no longer working. As soon as the Docker file included any line that was to install software it would fail with a message saying that the package was…
Matt Carrier
  • 5,602
  • 6
  • 26
  • 30
129
votes
10 answers

E: Unable to locate package npm

When I try to install npm with sudo apt-get install npm, I got following error: E: Unable to locate package npm Why can't apt find npm? I'm using Debian 9 and already did run sudo apt-get install nodejs
Jacs
  • 1,437
  • 4
  • 21
  • 31
128
votes
3 answers

How do I download a package from apt-get without installing it?

I have a computer without a NIC, and I want to install some programs in it via USB memory, but how can I download a program from apt-get without installing it?
Manuel de Leon
  • 2,623
  • 4
  • 19
  • 12
119
votes
3 answers

E: Repository 'http://dl.google.com/linux/chrome/deb stable Release' changed its 'Origin' value from 'Google, Inc.' to 'Google LLC'

When I apt-get update and apt-get upgrade my Ubuntu system, I get the following error message regarding fetching Google Chrome updates. This only started happening a few days ago. E: Repository 'http://dl.google.com/linux/chrome/deb stable Release'…
Sam
  • 11,799
  • 9
  • 49
  • 68
110
votes
3 answers

What are the differences between node.js and node?

I've installed node.js in my machine (linux mint 15), when I run node example.js, it says: The program 'node' can be found in the following packages: * node * nodejs-legacy Try: sudo apt-get install So what are the differences…
Blake
  • 7,367
  • 19
  • 54
  • 80
110
votes
13 answers

How to download all dependencies and packages to directory

I'm trying to install a package on a machine with no Internet connection. What I want to do is download all the packages and dependences on a machine WITH an Internet connection and then sneaker-net everything to the offline computer. I've been…
user583507
1
2 3
70 71