Make apt-get (or aptitude) run with -y but not prompt for replacement of configuration files?


You may use:

sudo apt-get update sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

For only specific packages, e.g. mypackage1 mypackage2:

sudo apt-get update sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install mypackage1 mypackage2


Avoiding the conffile prompt Every time that dpkg must install a new conffile that you have modified (and a removed file is only a particular case of a modified file in dpkg’s eyes), it will stop the upgrade and wait your answer. This can be particularly annoying for major upgrades. That’s why you can give predefined answers to dpkg with the help of multiple --force-conf* options: --force-confold: do not modify the current configuration file, the new version is installed with a .dpkg-dist suffix. With this option alone, even configuration files...
0 0

When running apt-get -y install on Ubuntu 10.04 I would like apt-get (or aptitude if that makes it easier) to not prompt me when installing additional dependencies (behavior of -y as I understand it) and but not prompt me about overwriting configuration files, instead assume to keep the existing ones always (which is usually the default). Unfortunately --trivial-only seems to be the inverse of -y and not affect the prompt that is shown, according to the man page.

In particular packages auch as samba, nullmailer, localepurge and lighttpd have forced me to interact with the terminal, even though the whole procedure was scripted and meant to be non-interactive.

You may use:

sudo apt-get update sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

For only specific packages, e.g. mypackage1 mypackage2:

sudo apt-get update sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install...
0 0
0 0

When installing CouchDB 2.1 on Ubuntu using the the apt-get package manager, like so:

echo "deb xenial main" | sudo tee -a /etc/apt/sources.list curl -L | sudo apt-key add - apt-get update apt-get install couchdb -y

I get a prompt screen asking if I would like to install in single node mode, or clustered mode, or if I would like to configure Couch myself. (Not a command prompt, but a pink background with a button that I have to press).

I would like to configure Couch myself, though I need to be able to programmatically skip the review screen (since I'm not running the command myself - the command is part of a script).

How can I specify to automatically specify this option when installing CouchDB 2.1 using apt-get install couchdb -y?

Alternatively, would I be forced to install CouchDB from the source if I don't want to manually press the ok...

0 0

This article applies to all supported versions of Ubuntu

Package management via apt-get runs hand-in-hand with the /etc/apt/sources.list file. For information on editing or updating your sources list see SourcesList.


This page describes how to handle the packages on your system using apt-get and related commands. For example, you can install a new package, remove an installed package, or update all installed packages to the latest versions.


Installation commands

apt-get install This command installs a new package.apt-get build-dep

This command searches the repositories and installs the build dependencies for . If the package is not in the repositories it will return an error.

aptitude install

Aptitude is an Ncurses viewer of packages installed or available. Aptitude can be used from the command line in a similar way to apt-get. Enter man aptitude for more information.

APT and aptitude will accept...
0 0

In Debian Squeeze — at least —, we also can do it this way, after su — or sudo for Ubuntu —

aptitude install -o Dpkg::Options::=--force-confmiss mysql-server

This will care for the dependencies of mysql-server and reset all the missing conf files of the lot, including mysql-common. Conflicting (remaining) files will be prompted out to be kept or reset.

Unfortunately, there is a bug in aptitude, and

aptitude purge -o Dpkg::Options::=--force-all mysql-server

will not work. So we have to do it one by one with

dpkg --force-all --purge mysql-common mysql-server mysql-client …

This will remove any config file, original or modified, but custom files will be preserved, with an onscreen message. Note, by the way, that dpkg also recognizes --force-confnew and --force-confold options.

To get mysql-server dependencies' list print on screen :

aptitude --simulate remove...
0 0

ow do I run custom command after ‘

apt-get upgrade

‘ or ‘

apt-get dist-upgrade

‘ on a Debian or Ubuntu Linux based system? How do I hook a script to apt-get command on my Ubuntu Linux server?

You can configure the

apt-get command

using /etc/apt/apt.conf file or place configuration in a special directory at /etc/apt/apt.conf.d/. The following two options allows you to run shell commands or script before/after invoking dpkg/apt-get tools:


The syntax is:

# This is a list of shell commands to run after invoking dpkg/apt-get # DPkg::Post-Invoke {"command";}; DPkg::Post-Invoke {"/path/to/sbin/command";}; DPkg::Post-Invoke {"/path/to/script";};


The syntax is:

# This is a list of shell commands to run before invoking dpkg/apt-get # DPkg::Pre-Invoke {"command";}; DPkg::Pre-Invoke {"/path/to/sbin/command";}; DPkg::Pre-Invoke {"/path/to/script";};

Like options this must be...

0 0

Package sources are listed in /etc/apt/sources.list and /etc/apt/sources.list.d/*.list. Usually you would list official sources in the main file /etc/apt/sources.list and add third-party repositories in /etc/apt/sources.list.d/indicative_name.list.

If you installed from CD-ROM, there'll be a line with

deb cdrom:[some name]/ stable main

Remove it or comment it out (by adding a # at the beginning of the line). If you ever want to install from CD-ROM again, pop the CD in and run apt-cdrom to create a sources.list entry from that CD-ROM.

To install packages over the Internet, you would typically list a Debian mirror as a source. The system installation does this if you have an Internet connection. A typical set of entries look like this:

## Debian stable proper deb squeeze main non-free contrib deb-src squeeze main non-free contrib ## Security updates deb squeeze/updates...
0 0

Yesterday while re-purposing a server I was removing packages with apt-get and stumbled upon an interesting problem. After I removed the package and all of it's configurations, the subsequent installation did not re-deploy the configuration files.

After a bit of digging I found out that there are two methods for removing packages with apt-get. One of those method should be used if you want to remove binaries, and the other should be used if you want to remove both binaries and configuration files.

What I did

Since the method I originally used caused at least 10 minutes of head scratching; I thought it would be useful to share what I did and how to resolve it.

On my system the package I wanted to remove was supervisor which is pretty awesome btw. To remove the package I simply removed it with apt-get remove just like I've done many times before.

# apt-get remove supervisor Reading package lists... Done Building dependency tree Reading state...
0 0


apt-get - APT package handling utility - command-line interface


apt-get [options] [-o config=string] [-c=cfgfile] command [pkg]



is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library. Several "front-end" interfaces exist, such as synaptic and aptitude.


Unless the


, or


option is given, one of the commands below must be present.

update Used to re-synchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list(5). An update should always be performed before an upgrade or dist-upgrade. upgrade Used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list(5). Packages currently installed with new versions available are retrieved and...
0 0
APT HOWTO (Obsolete Documentation) - Managing packages

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ next ]

3.1 Updating the list of available packages

The packaging system uses a private database to keep track of which packages are installed, which are not installed and which are available for installation. The apt-get program uses this database to find out how to install packages requested by the user and to find out which additional packages are needed in order for a selected package to work properly.

To update this list, you would use the command apt-get update. This command looks for the package lists in the archives found in /etc/apt/sources.list; see The /etc/apt/sources.list file, Section 2.1 for more information about this file.

It's a good idea to run this command regularly to keep yourself and your system informed about possible package updates, particularly security updates.


0 0

What is Apt-Get?

Apt is a command line frontend for the dpkg packaging system and is the preferred way of managing software from the command line for many distributions. It is the main package management system in Debian and Debian-based Linux distributions like Ubuntu.

While a tool called "dpkg" forms the underlying packaging layer, apt-get and apt-cache provide user-friendly interfaces and implement dependency handling. This allows users to efficiently manage large amounts of software easily.

In this guide, we will discuss the basic usage of apt-get and apt-cache and how they can manage your software. We will be practicing on an Ubuntu 12.04 cloud server, but the same steps and techniques should apply on any Debian-based distribution.

How To Update the Package Database with Apt-Get

Apt-get operates on a database of known, available software. It performs installations, package searches, and many other operations by referencing this...

0 0

APT (the Advanced Packaging Tool) is an evolution of the Debian .deb software packaging system. It is a rapid, practical, and efficient way to install packages on your system. Dependencies are managed automatically, configuration files are maintained, and upgrades and downgrades are handled carefully to ensure system stability.


resynchronizes the local index of packages files, updating information about new and updated packages that are available. The indexes are fetched from the location(s) specified in /etc/apt/sources.list.

An update should always be performed before an upgrade or dist-upgrade.


installs the newest versions of all packages currently installed on the system, using the sources in /etc/apt/sources.list. If a package is currently installed and a new version is available, it is retrieved and upgraded. Under no circumstances are installed packages removed, or packages not already installed retrieved. New versions of...

0 0

First, I need to make sure that everybody knows the difference between apt-get remove and apt-get purge.

apt-get remove — will remove the binaries but will keep the files associated with the package. Also, the dependencies remain untouched.

apt-get purge — will remove the binaries and all the files associated with them, but will leave the dependencies untouched.

None of the two commands do not delete the configuration files of the package, stored in your ~/.* .

If you want to remove a package completelly, use apt-get purge (or apt-get remove –purge, they are synonyms), if you want to keep files associated to the program, in order to reinstall it later and use them use apt-get remove.

But if use apt-get remove to uninstall packages, how do you get rid of the remaining files, (as apt-get purge would have done) ?

Use locate / find and delete them by hand? No.

You can use this aptitude trick (if you don’t have aptitude installed do...

0 0

Brief: This beginner’s guide shows you what you can do with apt-get commands in Linux, how to use it to find new packages, install and upgrade new packages and clean your system.

If you have started using Ubuntu or any other Ubuntu based Linux distribution such as Linux Mint, elementary OS etc, you must have come across apt-get command by now.

In fact, first in the list of things to do after installing Ubuntu is to use apt-get update and apt-get upgrade. Now, you might be aware of a few commands and their usage but perhaps you might not be aware of other apt-get commands and their usage.

In this guide for beginners, I am going to explain various of apt-get commands with examples so that you can use them as an expert Linux user.

What is apt-get?

Ubuntu is derived from Debian Linux. And Debian uses dpkg packaging system. A packaging system is a way to provide programs and applications for installation. This way, you don’t have to build a program...

0 0

apt-get Package Manager

Managing packages with apt-get

"apt-get" is a command line driven utility for working with the APT (Advanced Package Tool). apt-get works only with package names unlike "dpkg" which works with ".deb" files. apt-get is a very flexible easy to use tool that maintains its own database of packages. This makes it very easy to upgrade packages and handle dependencies. apt-get is mainly used on Debian based systems such as Ubuntu and Mint.

In the following examples, we will cover some of the most frequently used options. The use of the "sudo" command is commonly used in conjunction with apt-get commands as it escalates your privileges on the system allowing you to make changes/update your system. (This of course is only true if you have been granted sudo privileges!) :

Update all package information

Basic Syntax: sudo apt-get update

landoflinux@ubuntu1510:~$ sudo apt-get update [sudo] password for landoflinux: Hit...
0 0

Debian and its forks, Ubuntu , Linux Mint , Bodhi Linux etc. are the most popular and newbie friendly GNU/Linux distributions. Their software packages are managed with the apt get command and dpkg command.

In this tutorial we are going to talk about few useful and time saving apt commands for beginners.

Apt is closely related to dpkg , if you are not familiar with dpkg , better to have a look on the dpkg tutorial for beginners.

A little about /etc/apt/sources.list file

This file contains a list of software package source, one of the most vital file for installing or updating anything with apt.

The sources.list file could have many active sources and a supports a wide range of of source media like a HTTP or FTP server, from a local filesystem, a CD/DVD ROM even from a SSH server.

The entries in sources.list file normally looks like bellow.

file type: Or archive type, the first word of each line , either deb or deb-src ,...

0 0



is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library. Several "front-end" interfaces exist, such as aptitude(8), synaptic(8) and wajig(1).

Unless the -h, or --help option is given, one of the commands below must be present.


update is used to resynchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available. An update should always be performed before an upgrade or dist-upgrade. Please be aware that the overall progress meter will be incorrect as the size of the package files cannot be known in advance.


upgrade is used to install the newest versions of all packages currently installed...
0 0

import psycopg2

def get_top_articles():
db = psycopg2.connect("dbname=news")
c = db.cursor()
c.execute("select title from articles")
return c.fetchall()

if name == "main":
and get this error
Traceback (most recent call last):
File "C:\Users\ATHE\Desktop\udacity\vagrant\", line 12, in
File "C:\Users\ATHE\Desktop\udacity\vagrant\", line 4, in get_top_articles
db = psycopg2.connect("dbname=news")
File "C:\Users\ATHE\AppData\Local\Programs\Python\Python36\lib\site-packages\", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory,
how to solve this...

0 0

APT, short for Advanced package Tool, is a package management system.

apt get allows you to quickly and easily install, update, and remove software from the command line. Aside from its simplicity, one of the best things about APT is the face that it automatically resolves dependency issues for you.

This means that if the package you are installing requires additional software, apt get will automatically locate and install the additional software.
This is a massive improvement over the old days of “ dependency hell” .

installing software with apt get is very straightforward.

For example, let us assume you want to install the classic network-mapping tool Cheops, Once you know the name of the package you want to install, from the command line you can run apt-get install followed by the name of the software you want to install.

It is always a good idea to run apt-get update before installing software.

This will insure that you...

0 0

Updated: July 15, 2009

If you're using a Debian-based Linux distribution, you must have come across APT. APT stands for Advanced Packaging Tool and it's probably the fastest, simplest, most robust software management utility for Linux. APT is so popular that it has been ported to Solaris and Mac and even some rather RPM-istic distributions like SUSE Enterprise use it.

If you've never heard of APT, you've come to the right place, for today we're going to talk about three children of APT, apt-cache, apt-get and aptitude. We will learn what each one is good for, how to use them and why you should use them.

Follow me.

Why APT?

APT has proven its worth over the years. It is fast, responsive and stable, but most importantly, it is reliable. Should you lose Internet connection while updating your system or break the current operating, APT will gracefully pick up where you left the next time. Quite a few...

0 0

Manage packages from the commandline

The more common way to manage packages or softwares is from Synaptic Package Manager. Its the easiest gui tool to install and remove software from your debian/ubuntu system.

However for those who prefer the console, there are plenty of tools to do the job as easily. In this tutorial we are going to look into apt, the package management tool used on ubuntu. Even I used to use the synaptic gui earlier, when I started with the commandline tools, I found the commandline tools easier and faster.

On ubuntu there are 3 main commands to manage packages. These are dpkg, apt-* and aptitude. So lets start experimenting with these one by one.

Dpkg command

List all installed packages

This command will list all the installed packages.

$ dpkg -l

Search installed packages

Search the installed packages for 'apache'

$ dpkg --get-selections | grep 'apache' apache2 install...
0 0
Apt-get :: Installing MAKE

I need to compile one of my own programs to run on the DSL box (which is the edge router at my business). I had no trouble installing gcc (and its requirements), but when I try to install *make*, it needs *fileutils*, and it fails with the following message:
Unpacking fileutils (from .../fileutils_4.1-10_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/fileutils_4.1-10_i386.deb (--unpack):
trying to overwrite `/bin/chgrp', which is also in package coreutils
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

What is the problem, and how do I get around it?

It looks like part of the problem is that /bin/chgrp is not the real debian chgrp, but the busybox substitute. I had hoped to bypass the problem by makeing it a COPY of busybox instead...

0 0

Debian based systems (including Ubuntu) uses apt-* commands for managing packages from the command line.

In this article, using Apache 2 installation as an example, let us review how to use apt-* commands to view, install, remove, or upgrade packages.

1. apt-cache search: Search Repository Using Package Name

If you are installing Apache 2, you may guess that the package name is apache2. To verify whether it is a valid package name, you may want to search the repository for that particular package name as shown below.

The following example shows how to search the repository for a specific package name.

$ apt-cache search ^apache2$ apache2 - Apache HTTP Server metapackage

2. apt-cache search: Search Repository Using Package Description

If you don’t know the exact name of the package, you can still search using the package description as shown below.

$ apt-cache search "Apache HTTP Server" apache2 - Apache HTTP Server metapackage...
0 0

This is just a quick tutorial I thought it would be good for people to know that there is hope if you are in the process of installing some *new* release of your favorite software that is not yet in the repository, has not ppa nor backport, and no complete package -- just bits of packages. This doesnt apply to source compiling, that is a whole other ball of wax, by the way. I will also try to sneak in my "3 golden rules of using linux for novice to intermediate users".

Okay, I have done this a many times in the last year, I'll be upgrading some software that I want to try the *new* version of. I'll go through and get the depdencies, and install them one by one. Along the way I realize I did something wrong because I get a message from my package manager that 700+ packages need to be removed due to a package failing. This is where my first rule comes in:

rule #1, ALWAYS (and I mean ALWAYS) keep a log, snapshot, or text history (even if you dont get the actual state,...

0 0


I run Ubuntu 16.04 as a Dovecot mailserver and to keep the system
patched am religiously using ssh to sign into the machine and run both
of the following commands:
$ sudo apt-get update
$ sudo apt-get upgrade with an occasional $ sudo apt autoremove

On both previous incidents where I was told after signing in that there
were updates available, I ran the above commands.
Afterwards I reboot the machine using sudo and then sign-in again via
SSH to check if more updates are available.

Below is a screen paste
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-121-generic x86_64)

* Documentation:
* Management:
* Support:

System information as of Mon Apr 30 16:00:41 SAST 2018

System load: 0.44 Processes: 173
Usage of /: 35.6% of 46.64GB Users logged in: 0...

0 0
apt-get Man Page - Bash -

Search for and install software packages (Debian/Ubuntu).

Syntax apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] update apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] upgrade apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] dselect-upgrade apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] dist-upgrade apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] install pkg [ { =pkg_version_number | /target_release_name | /target_release_codename } ] ... apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] remove pkg... apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] purge pkg... apt-get [-sqdyfmubV] [-o= config_string ] [-c= config_file ] [-t= target] source pkg [ { =pkg_version_number | /target_release_name |...
0 0

There are a countless number of commands in Linux. We are bound to use a number of them on a daily routine or numerous times to perform common tasks than others. It is important to note that certain commands are “distro-based” – they can only be found in specific distros. While others are generic Unix/Linux commands that you’ll find in all if not most mainstream distros.

In this article, we will introduce you a list of most frequently used Linux commands with their examples for easy learning. You can find the actual description of each Linux command in their manual page which you can access like this:

$ man command-name

adduser/addgroup Command

The adduser and addgroup commands are used to add a user and group to the system respectively according to the default configuration specified in /etc/adduser.conf file.

$ sudo adduser tecmint

For more adduser and addgroup commands: 15 Practical Examples on adduser Command in Linux


0 0