Dealing with Packages on Debian/Ubuntu

assuming you’ve set it up already

Packages

Clean-up the configuration file

    mv -i /etc/apt/sources.list /etc/apt/sources.list.dist
    grep -vE '^#|^$' /etc/apt/sources.list.dist > /etc/apt/sources.list

find about your nearest mirror

wget -qO - mirrors.ubuntu.com/mirrors.txt
mirror=...

and point the repositories against it e.g.

guest=jammy

cat > /etc/apt/sources.list <<EOF
deb $mirror $guest main restricted universe multiverse
deb $mirror $guest-updates main restricted universe multiverse
deb $mirror $guest-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu $guest-security main restricted universe multiverse

EOF

for debian it would rather look like this.

deb $mirror $guest main contrib non-free non-free-firmware
deb $mirror $guest-updates main contrib non-free non-free-firmware
deb $mirror $guest-backports main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security $guest-security main contrib non-free non-free-firmware
# buster/updates

Alternatively, you can build your own configuration with some helper

And in case you have an HTTP PROXY on your network for that purpose

nmap -p 3142 x.x.x.x
vi /etc/apt/apt.conf.d/02proxy

Acquire::http { Proxy "http://x.x.x.x:3142"; };

apt update

Minor upgrade

    export DEBIAN_FRONTEND=noninteractive

    apt update
    #apt full-upgrade
    apt dist-upgrade

    apt autoremove --purge
dpkg -l | grep ^rc

    updatedb
    locate .dpkg-dist
    locate .ucf-dist

Major upgrade

debian

vi /etc/apt/sources.list

apt update
apt dist-upgrade

ubuntu

check for major release uprgade

do-release-upgrade

proceed with patches

apt update
apt full-upgrade

and see ubuntu-ops for further maintenance

Additional packages

Install a few more packages.

export DEBIAN_FRONTEND=noninteractive

    vi /etc/apt/apt.conf.d/50disable-pipeline

    Acquire::http::Pipeline-Depth 0;

Bare-metal

apt install \
    ethtool \
    hwinfo

Server system

    openssh-server \
    openssh-client \

and even more for any kind of system incl. some container that you need to troubleshoot

apt install locales
dpkg-reconfigure locales
perl -e exit

apt install \
    apt-transport-https \
    apt-utils \
    bash-completion \
    biff \
    bzip2 \
    colordiff \
    curl \
    dialog \
    dnsutils \
    dos2unix \
    elvis-tiny \
    git \
    htop \
    iftop \
    ifupdown \
    iputils-ping \
    iotop \
    ksh \
    less \
    lftp \
    lsb-release \
    lynx \
    man-db \
    manpages \
    mlocate \
    mtr \
    net-tools \
    netcat-traditional \
    ngrep \
    nmap \
    ntpdate \
    procps \
    pwgen \
    screen \
    software-properties-common \
    sysstat \
    telnet \
    traceroute \
    tzdata \
    unzip \
    uuid \
    uuid-runtime \
    wget \
    whois

choose a mailing system

    msmtp
    dma

this one we try to avoid

    sudo
    ntp
    ntpstat

and those ones are redundant

ifupdown2

nvi # elvis-tiny preferred

ncat
netcat-openbsd

iputils-tracepath
inetutils-ping # iputils-ping is preferred (PTR-capable)

tcptraceroute

eventually additional tools

xfsprogs
xfsdump
xxd

and in case this is really a workstation

apt purge elvis-tiny
apt purge nvi
apt install vim-nox

define some defaults

    update-alternatives --config vi
    update-alternatives --config editor
git config pull.rebase false  # merge (the default strategy)

Additional notes

list packages from specific repo e.g. for mongodb

grep ^Package  /var/lib/apt/lists/repo.mongodb.org_apt_ubuntu_dists_xenial_mongodb-org_3.4_* | cut -f3 -d: | uniq

Resources

fastest mirror

How to select the fastest apt mirror on Ubuntu Linux https://linuxconfig.org/how-to-select-the-fastest-apt-mirror-on-ubuntu-linux

repos from

https://askubuntu.com/questions/8560/how-do-i-find-out-which-repository-a-package-comes-from

repo packages

https://serverfault.com/questions/252333/list-all-packages-from-a-repository-in-ubuntu-debian

https://superuser.com/questions/132346/find-packages-installed-from-a-certain-repository-with-aptitude

troubles

https://askubuntu.com/questions/786334/proxy-problems-after-upgrade-to-ubuntu-16-04-apt-1-2

debian-style

https://serverfault.com/questions/48724/100-non-interactive-debian-dist-upgrade

https://wiki.debian.org/SimplePackagingTutorial

https://unix.stackexchange.com/questions/305435/debian-dpkg-dist-files-after-apt-upgrade


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun