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
deb $mirror $guest-updates main contrib non-free
deb $mirror $guest-backports main contrib non-free
deb http://security.debian.org/debian-security $guest-security main contrib non-free

and for devuan (I am a bit tired of tracking down their release names)

deb http://pkgmaster.devuan.org/merged stable main contrib non-free
deb http://pkgmaster.devuan.org/merged stable-updates main contrib non-free
deb http://pkgmaster.devuan.org/merged stable-backports main contrib non-free
deb http://pkgmaster.devuan.org/merged stable-security main contrib non-free
# stable-proposed-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

Initial upgrade

Check for major release uprgade

do-release-upgrade

Proceed with patches

cat /etc/apt/apt.conf.d/02proxy
apt update
apt full-upgrade

and see Ubuntu Server Operations 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 \
    screen \
    sudo

    #xfsprogs \
    #xfsdump \

Server system

    openssh-server \
    openssh-client \

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

apt install \
    apt-utils locales tzdata \
    apt-transport-https \
    bash-completion \
    biff \
    bzip2 \
    colordiff \
    curl \
    dialog \
    dma \
    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 \
    ngrep \
    nmap \
    ntpdate \
    procps \
    pwgen \
    software-properties-common \
    sysstat \
    telnet \
    traceroute \
    unzip \
    uuid \
    uuid-runtime \
    wget \
    whois \
    xxd

apt purge iputils-tracepath

and in case this is really a workstation

apt install vim-nox
# nvi

define some defaults

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

moar packages

    # ifupdown2 \
    # inetutils-ping \
    # mc \
    # tcptraceroute
    # ntp ntpstat

note iputils-ping is preferred (PTR-capable)

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


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