Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid
  • ubuntu
  • linux
  • debian
# Add repository
sudo apt-add-repository universe

# APT download only
apt-get upgrade -y --download-only

# include kept back packages
apt -o APT::Get::Always-Include-Phased-Updates=true upgrade -y

# run update
export DEBIAN_FRONTEND=noninteractive
LANG=en_US.UTF-8 sudo apt-get update -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && sudo apt-get clean -y

# Add backports repository
sudo add-apt-repository  "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-backports main restricted universe multiverse"

# install all phased updates
sudo apt -o APT::Get::Always-Include-Phased-Updates=true upgrade

# allow unauthenticated repository
apt-get update --allow-unauthenticated

# list updatable packages
apt list --upgradable

# view avaiable package version
apt-cache show wget
apt-cache madison wget

# install specific version
apt-get install package name=version
apt-get install wget=1.6

# install from specific repository
apt-get install -t squeeze-backports wget

# view available versions
apt-cache policy chromium-browser

# autoupdate
http://www.panticz.de/debian-ubuntu-automatic-upgrades

# download package
apt-get download

# list deb package dependency
dpkg -I 

# test DIRECT download package by apt
#Acquire::HTTP::Proxy::packages.gitlab.com "DIRECT";
#Acquire::HTTP::Proxy::packages-gitlab-com.s3.amazonaws.com "DIRECT";
#Acquire::https::Proxy "false";
Acquire::http::Proxy {
    packages.gitlab.com DIRECT;
    *.amazonaws.com DIRECT;
};

# use apt proxy
APT_PROXIES=$(apt-config shell \
http_proxy Acquire::http::Proxy \
https_proxy Acquire::https::Proxy \
ftp_proxy Acquire::ftp::Proxy \
dl_direct Acquire::http::Proxy::download.oracle.com \
)

echo 'Acquire::HTTP::Proxy::packages.gitlab.com "DIRECT";' > /etc/apt/apt.conf.d/99_gitlab

Acquire::http::Proxy {
    packages.gitlab.com DIRECT;
};

# list keys
apt-key list

# test
# lxc enable apt proxy?
eval $(apt-config shell MIRROR Acquire::http::Proxy)

apt-cache showpkg  libapache2-mod-php5

# install package from older distro
apt-get install -t etch -y libdb4.4
apt-get install -t squeeze -y libldap-2.4-2 libssl0.9.8 squid-common squid-langpack logrotate

# show package informtion
apt-cache show

apt-add-repository

apt-add-repository 'deb http://myserver/path/to/repo stable myrepo'
apt-add-repository 'http://myserver/path/to/repo myrepo'
apt-add-repository 'https://packages.medibuntu.org free non-free'
apt-add-repository http://extras.ubuntu.com/ubuntu
apt-add-repository ppa:user/repository
apt-add-repository multiverse
# test
sudo apt-get --allow-unauthenticated upgrade
APT::Get::AllowUnauthenticated "true";

# fix "Release file expired, ignoring..."
echo "Acquire::Check-Valid-Until false;" > /etc/apt/apt.conf.d/10squeeze-lts-no-check-valid-until

# list installed keys
apt-key list

# force remove
dpkg --remove --force-remove-reinstreq  wget

# mark a package as hold
apt-mark hold wget
echo "sonar hold" | dpkg --set-selections

# show packages marked to hold
apt-mark showhold

# unhold all APT packages
apt-mark showhold | awk '{ print $1, "install" }' | dpkg --set-selections

# force remove
dpkg --purge --force-all 
rm /var/lib/dpkg/info/.postrm 

# download APT package with all recursive dependencies
PACKAGES="wget unzip"
apt-get download $(apt-cache depends \
    --recurse \
    --no-recommends \
    --no-suggests \
    --no-conflicts \
    --no-breaks \
    --no-replaces \
    --no-enhances \
    --no-pre-depends \
    ${PACKAGES} | grep "^\w")

Show installed version only

dpkg-query --showformat='${Version}\n' --show wget

diff installed packages between hosts

diff <(ssh host1.example.com dpkg -l | grep ii | cut -d" " -f3) <(ssh host2.example.com dpkg -l | grep ii | cut -d" " -f3)

APT proxy over SSH port forward

.ssh/config
RemoteForward 8080 proxy.example.com:8080

Check if package installed

[[ $(dpkg-query -l wget) ]] || echo "Not installed"

Fix keys

cp /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/

Links
http://superuser.com/questions/393681/how-to-find-out-which-versions-of-a-package-can-i-install-on-apt
http://www.cyberciti.biz/howto/question/linux/dpkg-cheat-sheet.php
http://wiki.ubuntuusers.de/apt/apt-get?redirect=no
http://wiki.grml.org/doku.php?id=debian - Package management commands

Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung