Difference between revisions of "Debian - handbook for apt-get"

From Blue-IT.org Wiki

(apt-miror)
(Dselect)
 
(20 intermediate revisions by the same user not shown)
Line 36: Line 36:
 
  locate *.doc | grep tax
 
  locate *.doc | grep tax
 
  locate *.txt
 
  locate *.txt
 +
 +
== Dselect ==
 +
Dselect is a tool for dpkg and the debian package mangement. It is handy, if you like to make a list of all installed packages of a machine and replay it on a new machine.
 +
 +
Install it:
 +
sudo apt install dselect
 +
 +
On the old machine, which you want to create the list. No root priviledges required.
 +
 +
'''NOTE: the list represents the status of the OLD machine. Probably you want to remove packages you don't like to install on the new machine (old kernels, special versions for the distribution, etc. Just edit the file.'''
 +
 +
dpkg --get-selections > selections_${HOSTNAME}_$(date +%F}
 +
 +
On another machine, which you want to add  this list:
 +
 +
available_package_list=`mktemp`
 +
apt-cache dumpavail > "$available_package_list"
 +
dpkg --merge-avail "$available_package_list"
 +
rm -f "$available_package_list"
 +
 +
The systems database of apt will now be updated via the dpkg selections list you created:
 +
 +
dpkg --set-selections < selections_${HOSTNAME}_$(date +%F}
 +
 +
Upgrade the system via apt-get (apt ist _not_ working here):
 +
 +
apt-get dselect-upgrade
  
 
==APT==
 
==APT==
=== apt-miror ===
+
=== apt-mirror ===
 +
Apt-mirror will download you own package repository. You can put it on any computer, which will be able to share the mirror directory via apache or any other webserver.
 +
 
 +
Cleanup all cache an lists, that apt- created as root and recreate them:
 +
 
 +
rm -rf /var/lib/apt/lists/*; rm -rf /var/cache/apt/*
 +
apt-get update
 +
 
 +
=== Configuration ===
 +
apt-get install apache2 apt-mirror
 +
 
 +
Set the base path:
  
My mirror list:
+
vim /etc/apt/mirror.list  
 +
cd /var/www/html
 +
ln -s /path-to-apt-mirror apt-mirror
  
  ############# config ##################
+
The last line make "apt-mirror" accessible in a link like: http://your_ip_or_host/apt-mirror
 +
You have to use exactely this URL in your local apt-mirror sources list !!!
 +
 
 +
==== Server preferences list ====
 +
sudo vim /etc/apt/preferences.d/myAptPrefs
 +
 
 +
Package: virtualbox-5.2
 +
Pin: version 5.2.*
 +
Pin-Priority: 1000
 +
 +
Package: synergy
 +
Pin: version 1.4.12*
 +
Pin-Priority: 1000
 +
 
 +
==== Server mirror list ====
 +
[Update: 17.11.2019] optimized for Ubuntu Eoan (19.10)
 +
 
 +
* Use y-ppa-manager (https://launchpad.net/~webupd8team/+archive/ubuntu/y-ppa-manager)  to reimport keys!
 +
* for virtualbox import the key like shown at instructions on virtualbox.org
 +
 
 +
vim /etc/apt/sources.list.d/third-party.list
 +
 +
  # THIRD PARTY
 
  #
 
  #
  set base_path    /local/apt-mirror
+
  # Google2Ubuntu
 
  #
 
  #
  # set mirror_path  $base_path/mirror
+
  # Docker
  # set skel_path    $base_path/skel
+
  # https://medium.com/devgorilla/how-to-install-docker-on-ubuntu-18-04-495216a16092
  # set var_path    $base_path/var
+
  # curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# set cleanscript $var_path/clean.sh
+
  # deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable edge # Bei Aktualisierung zu eoan deaktiviert
  # set defaultarch  <running host architecture>
 
# set postmirror_script $var_path/postmirror.sh
 
# set run_postmirror 0
 
set nthreads    20
 
set _tilde 0
 
#
 
############# end config ##############
 
 
   
 
   
  # DEBS
+
  # Ubuntu-Make
  deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
+
  # Official (Bionic only)
  deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
+
  # deb http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
+
  #  
  #deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
+
# Inofficial (EOAN) https://launchpad.net/~lyzardking/+archive/ubuntu/ubuntu-make
  #deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe mul
+
  deb http://ppa.launchpad.net/lyzardking/ubuntu-make/ubuntu eoan main
  deb http://archive.canonical.com/ubuntu trusty partner
+
  # deb-src http://ppa.launchpad.net/lyzardking/ubuntu-make/ubuntu eoan main
deb http://extras.ubuntu.com/ubuntu trusty main
 
 
   
 
   
 +
# Mythbuntu
 +
# deb http://ppa.launchpad.net/mythbuntu/0.28/ubuntu zesty main # Bei Aktualisierung zu zesty deaktiviert Bei Aktualisierung zu bionic deaktiviert
 +
# Google
 +
# deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # Bei Aktualisierung zu bionic deaktiviert
 
   
 
   
  # SOURCES
+
  # Gnome Encfs Manager
  #deb-src http://archive.uibuntu.com/ubuntu trusty main restricted universe multiverse
+
  deb http://ppa.launchpad.net/gencfsm/ppa/ubuntu disco main
#deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
+
  # deb-src http://ppa.launchpad.net/gencfsm/ppa/ubuntu disco main
#deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
 
  #deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
 
#deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
 
 
   
 
   
  # THIRD PARTY
+
  # Libreoffice stable
 +
# deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic main # Bei Aktualisierung zu bionic deaktiviert Bei Aktualisierung zu eoan deaktiviert
 
   
 
   
  # Openprinting
+
  # Multisystem
  deb http://www.openprinting.org/download/printdriver/debian/ lsb3.2 contrib
+
  deb http://liveusb.info/multisystem/depot all main
 
   
 
   
#Google2Ubuntu
 
deb http://ppa.launchpad.net/benoitfra/google2ubuntu/ubuntu trusty main
 
 
   
 
   
  # Docky
+
  # Macbuntu & Mbuntu - Noobslab Themes
  deb http://ppa.launchpad.net/docky-core/ppa/ubuntu trusty main
+
  deb http://ppa.launchpad.net/noobslab/themes/ubuntu artful main
 +
deb http://ppa.launchpad.net/noobslab/macbuntu/ubuntu artful main
 
   
 
   
  # Google
+
  # Y-PPA-Manager
  deb http://dl.google.com/linux/chrome/deb/ stable main
+
  deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu eoan main
 
   
 
   
  # Google Talk Plugin
+
  # Orbital Apps
  deb http://dl.google.com/linux/talkplugin/deb/ stable main
+
  # wget -qO- https://www.orbital-apps.com/public_key.asc | sudo apt-key add -
 +
# deb http://orbital-apps.com/repo/ stable main
 
   
 
   
  # Monodevelop 4
+
  # Owncloud
  deb http://ppa.launchpad.net/inizan-yannick/mono/ubuntu trusty main
+
  # deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_18.04/ / # Bei Aktualisierung zu bionic deaktiviert Bei Aktualisierung zu eoan deaktiviert
 
   
 
   
  # Libreoffice stable
+
  # RabbitVCS
  deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu trusty main
+
  # NOW IN OFFICIAL REPO OF 19.10*
 +
# sudo apt install rabbitvcs-nautilus rabbitvcs-gedit rabbitvcs-cli rabbitvcs-core
 +
# deb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu xenial main
 
   
 
   
  # Thinkpad
+
  # Handbrake Stable
  deb http://ppa.launchpad.net/linrunner/thinkpad-extras/ubuntu trusty main  
+
  deb http://ppa.launchpad.net/stebbins/handbrake-releases/ubuntu eoan main
  deb http://ppa.launchpad.net/linrunner/tlp/ubuntu trusty main
+
  # deb-src http://ppa.launchpad.net/stebbins/handbrake-releases/ubuntu eoan main
 
   
 
   
  # Simple Screen Recorder
+
  # Truecrypt und Indikator
  deb http://ppa.launchpad.net/maarten-baert/simplescreenrecorder/ubuntu trusty main
+
  deb http://ppa.launchpad.net/stefansundin/truecrypt/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/stefansundin/truecrypt/ubuntu eoan main
 
   
 
   
  # Multimedia, VLC, ffmpeg, libdvd ...
+
  # SVN
  deb http://ppa.launchpad.net/mc3man/trusty-media/ubuntu trusty main
+
# deb http://ppa.launchpad.net/svn/ppa/ubuntu xenial main
 +
#
 +
# Tuxboot
 +
# deb http://ppa.launchpad.net/thomas.tsai/ubuntu-tuxboot/ubuntu xenial main
 +
#
 +
# Equinox Theme
 +
  # deb http://ppa.launchpad.net/tiheum/equinox/ubuntu xenial main
 +
#
 +
# VirtualBox 5.2
 +
# deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian <mydist> contrib
 +
# wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
 +
deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian disco contrib
 
   
 
   
# Multisystem
 
deb http://liveusb.info/multisystem/depot all main
 
 
   
 
   
  # WebUpd8 nilarimogard: equalizer, audio-tools, multimedia
+
  #
  deb http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu trusty main  
+
# Java WebUpd8
 +
deb http://ppa.launchpad.net/webupd8team/java/ubuntu artful main
 +
#
 +
# Sublime Text 3 - WebUpd8
 +
deb http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu artful main
 +
#
 +
# Tor Browser Projekt
 +
# deb http://ppa.launchpad.net/webupd8team/tor-browser/ubuntu yakkety main
 +
#
 +
# Y-PPA Manager
 +
deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu artful main
 +
#
 +
# X2Go Stable
 +
  deb http://ppa.launchpad.net/x2go/stable/ubuntu eoan main
 
   
 
   
  # Mac Mbuntu - Noobslab Themes
+
  # Mono Develop from Xamarin official Repo
  deb http://ppa.launchpad.net/noobslab/themes/ubuntu trusty main
+
# http://www.mono-project.com/docs/getting-started/install/linux/
 +
  # deb http://download.mono-project.com/repo/debian wheezy main
 
   
 
   
  # Opera
+
  # Calibre - actual in xenial
  deb http://deb.opera.com/opera/ lenny non-free
+
  # deb http://ppa.launchpad.net/n-muench/calibre2/ubuntui bionic main
 
   
 
   
  # Kesselgulasch - gimp
+
  # Postgres
  deb http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu trusty main
+
# deb http://apt.postgresql.org/pub/repos/apt zesty-pgdg main
 +
  # deb http://apt.postgresql.org/pub/repos/apt zesty-pgdg main
 
   
 
   
  # Owncloud
+
  # XBMC
  deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_14.04/ /
+
  deb http://ppa.launchpad.net/team-xbmc/ppa/ubuntu eoan main
 
   
 
   
  # Pipelight (Flash, Silverlight)
+
  # PDF-ocr
  deb http://ppa.launchpad.net/pipelight/stable/ubuntu trusty main
+
  # deb http://ppa.launchpad.net/gezakovacs/pdfocr/ubuntu xenial main
 +
# deb-src http://ppa.launchpad.net/gezakovacs/pdfocr/ubuntu xenial main
 
   
 
   
  # Darktable
+
  # Yubico
  deb http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu trusty main  
+
  deb http://ppa.launchpad.net/yubico/stable/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/yubico/stable/ubuntu xenial main
 
   
 
   
  # RabbitVCS
+
  # Sound-Switcher-Indicator
  deb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu trusty main
+
  # http://www.webupd8.org/2014/02/sound-switcher-ubuntu-indicator.html
 +
deb http://ppa.launchpad.net/yktooo/ppa/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/yktooo/ppa/ubuntu zesty main
 
   
 
   
  # Humanity Colors Theme
+
  # Darktable
  deb http://ppa.launchpad.net/ravefinity-project/ppa/ubuntu trusty main
+
# https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release?field.series_filter=bionic
 +
  deb http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu disco main
 +
# deb-src http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu bionic main
 
   
 
   
  # Satyajit Happy Themes
+
  # Brightnesscontroller
  deb http://ppa.launchpad.net/satyajit-happy/themes/ubuntu trusty main
+
  deb http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu bionic main
 +
# deb-src http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu bionic main
 
   
 
   
  # Shutter
+
  # Dropbox
  deb http://ppa.launchpad.net/shutter/ppa/ubuntu trusty main
+
  deb [arch=i386,amd64] http://linux.dropbox.com/ubuntu trusty main
 
   
 
   
  # Skype
+
  # Astro: siril
  deb http://download.skype.com/linux/repos/debian/ stable non-free
+
  deb http://ppa.launchpad.net/lock042/siril/ubuntu bionic main
 +
# deb-src http://ppa.launchpad.net/lock042/siril/ubuntu bionic main
 
   
 
   
  # Handbrake Stable
+
  # Lyx
  deb http://ppa.launchpad.net/stebbins/handbrake-releases/ubuntu trusty main  
+
  deb http://ppa.launchpad.net/lyx-devel/release/ubuntu bionic main
 +
# deb-src http://ppa.launchpad.net/lyx-devel/release/ubuntu bionic main
 
   
 
   
  # Truecrypt und Indikator
+
  # Pulseeffects
  deb http://ppa.launchpad.net/stefansundin/truecrypt/ubuntu trusty main  
+
  # sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FE3AE55CF74041EAA3F0AD10D5B19A73A8ECB754
 +
# https://github.com/wwmm/pulseeffects/wiki/Package-Repositories
 +
deb http://ppa.launchpad.net/mikhailnov/pulseeffects/ubuntu bionic main
 +
# deb-src http://ppa.launchpad.net/mikhailnov/pulseeffects/ubuntu bionic main
 
   
 
   
  # SVN
+
  # Gphoto
  deb http://ppa.launchpad.net/svn/ppa/ubuntu trusty main
+
  deb http://ppa.launchpad.net/mutlaqja/libgphoto2/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/mutlaqja/libgphoto2/ubuntu bionic main
 
   
 
   
  # Tuxboot
+
  # Kstars und INDI
  deb http://ppa.launchpad.net/thomas.tsai/ubuntu-tuxboot/ubuntu trusty main
+
  deb http://ppa.launchpad.net/mutlaqja/ppa/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/mutlaqja/ppa/ubuntu artful main
 
   
 
   
  # Equinox Theme
+
  # Nextcloud
  deb http://ppa.launchpad.net/tiheum/equinox/ubuntu trusty main
+
  deb http://ppa.launchpad.net/nextcloud-devs/client/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/nextcloud-devs/client/ubuntu bionic main
 +
# This file makes sure that Opera Browser is kept up-to-date
 +
# as part of regular system upgrades
 
   
 
   
  # Ubuntu-Tweak
+
  # Opera
  deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu trusty main
+
deb http://deb.opera.com/opera/ stable non-free #Opera Browser (final releases)
 +
# The line above will make sure you get all final public releases.
 +
# Uncomment the following line if you want to get alpha and beta
 +
# releases, too.
 +
  # deb http://deb.opera.com/opera-beta/ stable non-free #Opera Browser (beta releases)
 
   
 
   
  # WINE
+
  # Gimp
  deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main  
+
  deb http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu eoan main
 +
# deb-src http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu bionic main
 
   
 
   
  # VirtualBox
+
  # Skype - skypeforlinux
  deb http://download.virtualbox.org/virtualbox/debian trusty contrib
+
# curl https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add -
 +
  deb [arch=amd64] https://repo.skype.com/deb stable main
 
   
 
   
  # Java WebUpd8
+
  ###  TeamViewer DEB repository list
  deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
+
  # Teamviewer
 +
### NOTE: Manual changes to this file
 +
###        - prevent it from being updated by TeamViewer package updates
 +
###        - will be lost after using the 'teamviewer repo' command
 +
###      The original file can be restored with this command:
 +
###      cp /opt/teamviewer/tv_bin/script/teamviewer.list /etc/apt/sources.list.d/teamviewer.list
 +
###      which has the same effect as 'teamviewer repo default'
 
   
 
   
  # Sublime Text 3 - WebUpd8
+
  ### NOTE: It is preferred to use the following commands to edit this file:
  deb http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu trusty main
+
###      teamviewer repo                - show current repository configuration
 +
###      teamviewer repo default        - restore default configuration
 +
###      teamviewer repo disable        - disable the repository
 +
###      teamviewer repo stable        - make all regular TeamViewer packages available (default)
 +
###      teamviewer repo preview        - additionally, make feature preview packages available
 +
###      teamviewer repo development    - additionally, make the latest development packages available
 +
deb http://linux.teamviewer.com/deb stable main
 +
  # deb http://linux.teamviewer.com/deb preview main
 +
# deb http://linux.teamviewer.com/deb development main
 
   
 
   
  # Tor Browser Projekt
+
  # Grub-customizer
  deb http://ppa.launchpad.net/webupd8team/tor-browser/ubuntu trusty main
+
  deb http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu bionic main
+
  # deb-src http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu bionic main
  # Y-PPA Manager
+
 
deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu trusty main  
+
==== Alter the achitecture ====
+
To change the mirror list do 'deb-i386'
  # X2Go Stable
+
  cat mirror.list | sed 's/^deb/deb-i386/' | sed 's/^#deb/#deb-i386/' > mirror.list.new
  deb http://ppa.launchpad.net/x2go/stable/ubuntu trusty main
+
 
+
Add another architecture (I am using >> here, so manually reorder the mirror list ist necessary):
# Mono Develop from Xamarin official Repo
+
  cat mirror.list | sed 's/^deb-i386/deb-amd64/' | sed 's/^#deb-i386/#deb-amd64/' >> mirror.list.new.amd64
  # http://www.mono-project.com/docs/getting-started/install/linux/
+
 
  deb http://download.mono-project.com/repo/debian wheezy main
+
==== Server clean list ====
 
+
Create a clean list according to the above mirror list:
Then you can create an apt-mirror-client list from this file:
+
 
 +
  cat mirror.list | grep -v ^# | grep -v  clean | grep -v set | \
 +
grep -v '^$' | cut -d " " -f2 | uniq | awk '{system("echo clean " $0)}' >> mirror.list
 +
 
 +
==== Client sources list ====
 +
 
 +
Then you can create an apt-mirror-client list from this file. Be aware, the the sed commands
 +
sed 's|^deb-amd64|deb|g' | sed 's|^deb-i386|deb|g' | uniq
 +
 
 +
will filter out different architectures. If you are not using different architectures, but clean "deb http://..." lines, you don't need thist. On the other hand, if you are using other architecture, like arm, you have to add corresponding sed commands!
 
  cat mirror.list | grep -v ^# | grep -v  clean | grep -v set | grep -v '^$' | \
 
  cat mirror.list | grep -v ^# | grep -v  clean | grep -v set | grep -v '^$' | \
  sed 's/ppa.launchpad.net/teneriffa/g' | sed  's/download.skype.com/teneriffa/g' | \
+
  sed 's|^deb-amd64|deb|g' | sed 's|^deb-i386|deb|g' | uniq | \
sed 's/download.virtualbox.org/teneriffa/g' | sed  's/download.opensuse.org/teneriffa/g' | \
+
  sed 's|//|//APT_MIRROR_IP_OR_HOST/apt-mirror/|g'
sed  's/deb.opera.com/teneriffa/g' | sed  's/dl.google.com/teneriffa/g' | \
 
  sed 's/archive.ubuntu.com/teneriffa/g' | sed  's/extras.ubuntu.com/teneriffa/g' | \
 
sed  's/archive.canonical.com/teneriffa/g' | sed  's/www.openprinting.org/teneriffa/g'| \
 
sed  's/liveusb.info/teneriffa/g
 
  
 
and save it on your client ;-)
 
and save it on your client ;-)
 +
 +
==== Third party ppa list ====
 +
This way you can create a ppa list, which will substitude all the single source.list.d entries. In my case i use the list, created by the following command as a base for such a list:
 +
 +
cat mirror.list | grep -v  clean | grep -v set | grep -v '^$' | \
 +
sed 's/^deb-i386/deb/' | sed 's/^#deb-i386/#deb/' | \
 +
sed 's/^deb-amd64/deb/' | sed 's/^#deb-amd64/#deb/' | uniq
 +
 +
Cleanup all cache an lists, that apt- created as root and recreate them:
 +
 +
rm -rf /var/lib/apt/lists/*; rm -rf /var/cache/apt/*
 +
apt-get update
  
 
=== GPG ===
 
=== GPG ===

Latest revision as of 11:11, 17 November 2019

Konsole öffnen, als Administrator anmelden. Open a console (terminal) and login as root.

Also see

Navigate

Navigieren in Verzeichnissen

Wo bin ich?

pwd

Verzeichnis anzeigen

ls

In Verzeichnis wechseln. (Tip: mit Tabulatortaste vervollständigen)

ls
cd Ve (Tabulatortaste drücken)
cd Verzeichnisname

Verzeichnis runter

cd ..

Locate

Datei suchen / Search for files

1. Suchdatenbank aktualisieren / actuate search database

updatedb

2. Suchen / search

locate dateiname | grep muster

Beispiel für Dateinamen / Examples for filenames

locate *.rpm | grep synaptic
locate *.doc | grep tax
locate *.txt

Dselect

Dselect is a tool for dpkg and the debian package mangement. It is handy, if you like to make a list of all installed packages of a machine and replay it on a new machine.

Install it:

sudo apt install dselect

On the old machine, which you want to create the list. No root priviledges required.

NOTE: the list represents the status of the OLD machine. Probably you want to remove packages you don't like to install on the new machine (old kernels, special versions for the distribution, etc. Just edit the file.

dpkg --get-selections > selections_${HOSTNAME}_$(date +%F}

On another machine, which you want to add this list:

available_package_list=`mktemp`
apt-cache dumpavail > "$available_package_list"
dpkg --merge-avail "$available_package_list"
rm -f "$available_package_list"

The systems database of apt will now be updated via the dpkg selections list you created:

dpkg --set-selections < selections_${HOSTNAME}_$(date +%F}

Upgrade the system via apt-get (apt ist _not_ working here):

apt-get dselect-upgrade

APT

apt-mirror

Apt-mirror will download you own package repository. You can put it on any computer, which will be able to share the mirror directory via apache or any other webserver.

Cleanup all cache an lists, that apt- created as root and recreate them:

rm -rf /var/lib/apt/lists/*; rm -rf /var/cache/apt/*
apt-get update

Configuration

apt-get install apache2 apt-mirror

Set the base path:

vim /etc/apt/mirror.list 
cd /var/www/html
ln -s /path-to-apt-mirror apt-mirror

The last line make "apt-mirror" accessible in a link like: http://your_ip_or_host/apt-mirror You have to use exactely this URL in your local apt-mirror sources list !!!

Server preferences list

sudo vim /etc/apt/preferences.d/myAptPrefs

Package: virtualbox-5.2
Pin: version 5.2.*
Pin-Priority: 1000

Package: synergy
Pin: version 1.4.12*
Pin-Priority: 1000

Server mirror list

[Update: 17.11.2019] optimized for Ubuntu Eoan (19.10)

vim /etc/apt/sources.list.d/third-party.list

# THIRD PARTY
#
# Google2Ubuntu
#
# Docker
# https://medium.com/devgorilla/how-to-install-docker-on-ubuntu-18-04-495216a16092
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable edge # Bei Aktualisierung zu eoan deaktiviert

# Ubuntu-Make
# Official (Bionic only)
# deb http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu bionic main
# 
# Inofficial (EOAN) https://launchpad.net/~lyzardking/+archive/ubuntu/ubuntu-make
deb http://ppa.launchpad.net/lyzardking/ubuntu-make/ubuntu eoan main
# deb-src http://ppa.launchpad.net/lyzardking/ubuntu-make/ubuntu eoan main

# Mythbuntu
# deb http://ppa.launchpad.net/mythbuntu/0.28/ubuntu zesty main # Bei Aktualisierung zu zesty deaktiviert Bei Aktualisierung zu bionic deaktiviert
# Google
# deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # Bei Aktualisierung zu bionic deaktiviert

# Gnome Encfs Manager 
deb http://ppa.launchpad.net/gencfsm/ppa/ubuntu disco main
# deb-src http://ppa.launchpad.net/gencfsm/ppa/ubuntu disco main

# Libreoffice stable
# deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic main # Bei Aktualisierung zu bionic deaktiviert Bei Aktualisierung zu eoan deaktiviert

# Multisystem
deb http://liveusb.info/multisystem/depot all main


# Macbuntu & Mbuntu - Noobslab Themes
deb http://ppa.launchpad.net/noobslab/themes/ubuntu artful main
deb http://ppa.launchpad.net/noobslab/macbuntu/ubuntu artful main

# Y-PPA-Manager
deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu eoan main
# deb-src http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu eoan main

# Orbital Apps
# wget -qO- https://www.orbital-apps.com/public_key.asc | sudo apt-key add -
# deb http://orbital-apps.com/repo/ stable main

# Owncloud
# deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_18.04/ / # Bei Aktualisierung zu bionic deaktiviert Bei Aktualisierung zu eoan deaktiviert

# RabbitVCS
# NOW IN OFFICIAL REPO OF 19.10*
# sudo apt install rabbitvcs-nautilus rabbitvcs-gedit rabbitvcs-cli rabbitvcs-core
# deb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu xenial main

# Handbrake Stable
deb http://ppa.launchpad.net/stebbins/handbrake-releases/ubuntu eoan main
# deb-src http://ppa.launchpad.net/stebbins/handbrake-releases/ubuntu eoan main

# Truecrypt und Indikator
deb http://ppa.launchpad.net/stefansundin/truecrypt/ubuntu eoan main
# deb-src http://ppa.launchpad.net/stefansundin/truecrypt/ubuntu eoan main

# SVN
# deb http://ppa.launchpad.net/svn/ppa/ubuntu xenial main
#
# Tuxboot
# deb http://ppa.launchpad.net/thomas.tsai/ubuntu-tuxboot/ubuntu xenial main
#
# Equinox Theme
# deb http://ppa.launchpad.net/tiheum/equinox/ubuntu xenial main
#
# VirtualBox 5.2
# deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian <mydist> contrib
# wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian disco contrib


#
# Java WebUpd8
deb http://ppa.launchpad.net/webupd8team/java/ubuntu artful main
#
# Sublime Text 3 - WebUpd8
deb http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu artful main
#
# Tor Browser Projekt
# deb http://ppa.launchpad.net/webupd8team/tor-browser/ubuntu yakkety main
#
# Y-PPA Manager
deb http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu artful main
#
# X2Go Stable
deb http://ppa.launchpad.net/x2go/stable/ubuntu eoan main

# Mono Develop from Xamarin official Repo
# http://www.mono-project.com/docs/getting-started/install/linux/
# deb http://download.mono-project.com/repo/debian wheezy main

# Calibre - actual in xenial
# deb http://ppa.launchpad.net/n-muench/calibre2/ubuntui bionic main

# Postgres
# deb http://apt.postgresql.org/pub/repos/apt zesty-pgdg main
# deb http://apt.postgresql.org/pub/repos/apt zesty-pgdg main

# XBMC
deb http://ppa.launchpad.net/team-xbmc/ppa/ubuntu eoan main

# PDF-ocr 
# deb http://ppa.launchpad.net/gezakovacs/pdfocr/ubuntu xenial main
# deb-src http://ppa.launchpad.net/gezakovacs/pdfocr/ubuntu xenial main

# Yubico
deb http://ppa.launchpad.net/yubico/stable/ubuntu eoan main
# deb-src http://ppa.launchpad.net/yubico/stable/ubuntu xenial main

# Sound-Switcher-Indicator
# http://www.webupd8.org/2014/02/sound-switcher-ubuntu-indicator.html
deb http://ppa.launchpad.net/yktooo/ppa/ubuntu eoan main
# deb-src http://ppa.launchpad.net/yktooo/ppa/ubuntu zesty main

# Darktable
# https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release?field.series_filter=bionic
deb http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu disco main
# deb-src http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu bionic main

# Brightnesscontroller
deb http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu bionic main
# deb-src http://ppa.launchpad.net/apandada1/brightness-controller/ubuntu bionic main

# Dropbox
deb [arch=i386,amd64] http://linux.dropbox.com/ubuntu trusty main

# Astro: siril
deb http://ppa.launchpad.net/lock042/siril/ubuntu bionic main
# deb-src http://ppa.launchpad.net/lock042/siril/ubuntu bionic main

# Lyx
deb http://ppa.launchpad.net/lyx-devel/release/ubuntu bionic main
# deb-src http://ppa.launchpad.net/lyx-devel/release/ubuntu bionic main

# Pulseeffects
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FE3AE55CF74041EAA3F0AD10D5B19A73A8ECB754 
# https://github.com/wwmm/pulseeffects/wiki/Package-Repositories
deb http://ppa.launchpad.net/mikhailnov/pulseeffects/ubuntu bionic main
# deb-src http://ppa.launchpad.net/mikhailnov/pulseeffects/ubuntu bionic main

# Gphoto
deb http://ppa.launchpad.net/mutlaqja/libgphoto2/ubuntu eoan main
# deb-src http://ppa.launchpad.net/mutlaqja/libgphoto2/ubuntu bionic main

# Kstars und INDI
deb http://ppa.launchpad.net/mutlaqja/ppa/ubuntu eoan main
# deb-src http://ppa.launchpad.net/mutlaqja/ppa/ubuntu artful main

# Nextcloud
deb http://ppa.launchpad.net/nextcloud-devs/client/ubuntu eoan main
# deb-src http://ppa.launchpad.net/nextcloud-devs/client/ubuntu bionic main
# This file makes sure that Opera Browser is kept up-to-date
# as part of regular system upgrades

# Opera
deb http://deb.opera.com/opera/ stable non-free #Opera Browser (final releases)
# The line above will make sure you get all final public releases.
# Uncomment the following line if you want to get alpha and beta
# releases, too.
# deb http://deb.opera.com/opera-beta/ stable non-free #Opera Browser (beta releases)

# Gimp
deb http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu eoan main
# deb-src http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu bionic main

# Skype - skypeforlinux
# curl https://repo.skype.com/data/SKYPE-GPG-KEY | sudo apt-key add - 
deb [arch=amd64] https://repo.skype.com/deb stable main

###   TeamViewer DEB repository list
# Teamviewer
### NOTE: Manual changes to this file
###        - prevent it from being updated by TeamViewer package updates
###        - will be lost after using the 'teamviewer repo' command
###       The original file can be restored with this command:
###       cp /opt/teamviewer/tv_bin/script/teamviewer.list /etc/apt/sources.list.d/teamviewer.list
###       which has the same effect as 'teamviewer repo default'

### NOTE: It is preferred to use the following commands to edit this file:
###       teamviewer repo                - show current repository configuration
###       teamviewer repo default        - restore default configuration
###       teamviewer repo disable        - disable the repository
###       teamviewer repo stable         - make all regular TeamViewer packages available (default)
###       teamviewer repo preview        - additionally, make feature preview packages available
###       teamviewer repo development    - additionally, make the latest development packages available
deb http://linux.teamviewer.com/deb stable main
# deb http://linux.teamviewer.com/deb preview main
# deb http://linux.teamviewer.com/deb development main

# Grub-customizer
deb http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu bionic main
# deb-src http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu bionic main

Alter the achitecture

To change the mirror list do 'deb-i386'

cat mirror.list  | sed 's/^deb/deb-i386/' | sed 's/^#deb/#deb-i386/' > mirror.list.new 

Add another architecture (I am using >> here, so manually reorder the mirror list ist necessary):

 cat mirror.list  | sed 's/^deb-i386/deb-amd64/' | sed 's/^#deb-i386/#deb-amd64/' >> mirror.list.new.amd64

Server clean list

Create a clean list according to the above mirror list:

cat mirror.list | grep -v ^# | grep -v  clean | grep -v set | \
grep -v '^$' | cut -d " " -f2 | uniq | awk '{system("echo clean " $0)}' >> mirror.list

Client sources list

Then you can create an apt-mirror-client list from this file. Be aware, the the sed commands

sed 's|^deb-amd64|deb|g' | sed 's|^deb-i386|deb|g' | uniq

will filter out different architectures. If you are not using different architectures, but clean "deb http://..." lines, you don't need thist. On the other hand, if you are using other architecture, like arm, you have to add corresponding sed commands!

cat mirror.list | grep -v ^# | grep -v  clean | grep -v set | grep -v '^$' | \
sed 's|^deb-amd64|deb|g' | sed 's|^deb-i386|deb|g' | uniq | \
sed 's|//|//APT_MIRROR_IP_OR_HOST/apt-mirror/|g'

and save it on your client ;-)

Third party ppa list

This way you can create a ppa list, which will substitude all the single source.list.d entries. In my case i use the list, created by the following command as a base for such a list:

cat mirror.list | grep -v  clean | grep -v set | grep -v '^$' | \
sed 's/^deb-i386/deb/' | sed 's/^#deb-i386/#deb/' | \
sed 's/^deb-amd64/deb/' | sed 's/^#deb-amd64/#deb/' | uniq

Cleanup all cache an lists, that apt- created as root and recreate them:

rm -rf /var/lib/apt/lists/*; rm -rf /var/cache/apt/*
apt-get update

GPG

If you get an error about a missing key, do:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <###################>

where <###################> is the key which was given in the error.

Otherwise, if you have a keyfile, do:

wget -qO - http://source.url/to/the.key | sudo apt-key add -

Updaten / update

apt-get update

Suchen / search

apt-cache search irgendein_name

Pakete installieren / install packages

apt-get install (--reinstall) irgendein_paket

Force dpkg options

apt-get install -o DPkg::Options::=--force-confold --yes --force-yes --no-install-recommends YOUR_PACKAGE_WONT_INSTALL YOUR_PACKAGE

Pakete deinstallieren (VOLLSTÄNDIG) / uninstall packages

apt-get remove (--purge) irgendein_paket

Distribution auf den neuesten Stand bringen / Distribution update

apt-get upgrade
apt-get dist-upgrade

Schiefgelaufene Installation wiederholen / Redo an installation

apt-get -f install

Komplettes Desaster korrigieren / Desaster recovery

dpkg --reconfigure -a

Get all deb entries in all sources-list (for apt-mirror)

find /etc/apt -name "*.list" | grep -v mirror.list | awk '{system("cat " $0 " | grep -v deb-src | egrep ^deb")}'

Paketliste erstellen und zurückspielen

dpkg --get-selections > selections.list

Replay:

dpkg --set-selections < selections.list
apt-get dselect-upgrade

Clear the selections cache:

dpkg --clear-selections