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

From Blue-IT.org Wiki

(Client sources list)
(apt-mirror)
Line 39: Line 39:
 
==APT==
 
==APT==
 
=== apt-mirror ===
 
=== 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 ===
 
=== Configuration ===
 
  apt-get install apache2 apt-mirror
 
  apt-get install apache2 apt-mirror

Revision as of 10:18, 8 March 2015

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

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 mirror list

My mirror list:

vim /etc/apt/mirror.list
############# config ##################
#
set base_path    /apt-mirror
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# 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
deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe mul
deb http://archive.canonical.com/ubuntu trusty partner
deb http://extras.ubuntu.com/ubuntu trusty main


# SOURCES
#deb-src http://archive.uibuntu.com/ubuntu trusty main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
#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

# Openprinting
deb http://www.openprinting.org/download/printdriver/debian/ lsb3.2 contrib

#Google2Ubuntu
deb http://ppa.launchpad.net/benoitfra/google2ubuntu/ubuntu trusty main

# Docky
deb http://ppa.launchpad.net/docky-core/ppa/ubuntu trusty main

# Google
deb http://dl.google.com/linux/chrome/deb/ stable main

# Google Talk Plugin
deb http://dl.google.com/linux/talkplugin/deb/ stable main

# Monodevelop 4
deb http://ppa.launchpad.net/inizan-yannick/mono/ubuntu trusty main

# Libreoffice stable
deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu trusty main

# Thinkpad
deb http://ppa.launchpad.net/linrunner/thinkpad-extras/ubuntu trusty main 
deb http://ppa.launchpad.net/linrunner/tlp/ubuntu trusty main

# Simple Screen Recorder
deb http://ppa.launchpad.net/maarten-baert/simplescreenrecorder/ubuntu trusty main

# Multimedia, VLC, ffmpeg, libdvd ...
deb http://ppa.launchpad.net/mc3man/trusty-media/ubuntu trusty main

# 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 

# Mac Mbuntu - Noobslab Themes
deb http://ppa.launchpad.net/noobslab/themes/ubuntu trusty main

# Opera
deb http://deb.opera.com/opera/ lenny non-free

# Kesselgulasch - gimp
deb http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu trusty main

# Owncloud
deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_14.04/ /

# Pipelight (Flash, Silverlight)
deb http://ppa.launchpad.net/pipelight/stable/ubuntu trusty main

# Darktable
deb http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu trusty main 

# RabbitVCS
deb http://ppa.launchpad.net/rabbitvcs/ppa/ubuntu trusty main

# Humanity Colors Theme
deb http://ppa.launchpad.net/ravefinity-project/ppa/ubuntu trusty main

# Satyajit Happy Themes
deb http://ppa.launchpad.net/satyajit-happy/themes/ubuntu trusty main

# Shutter
deb http://ppa.launchpad.net/shutter/ppa/ubuntu trusty main

# Skype
deb http://download.skype.com/linux/repos/debian/ stable non-free

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

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

# SVN
deb http://ppa.launchpad.net/svn/ppa/ubuntu trusty main

# Tuxboot
deb http://ppa.launchpad.net/thomas.tsai/ubuntu-tuxboot/ubuntu trusty main

# Equinox Theme
deb http://ppa.launchpad.net/tiheum/equinox/ubuntu trusty main

# Ubuntu-Tweak
deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu trusty main

# WINE
deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main 

# VirtualBox
deb http://download.virtualbox.org/virtualbox/debian trusty contrib

# Java WebUpd8
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main

# Sublime Text 3 - WebUpd8
deb http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu trusty main

# Tor Browser Projekt
deb http://ppa.launchpad.net/webupd8team/tor-browser/ubuntu trusty main

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

# X2Go Stable
deb http://ppa.launchpad.net/x2go/stable/ubuntu trusty 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

####################################################################
# CLEAN LIST:

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

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