Catatan Sistem Manajemen Paket Ubuntu dari Berbagai Sumber

Bismillahirrahmanirrahim.

1


 

With this suggestion, I’m assuming your old installation will still boot!

To replicate one set of packages on another machine:

On System A, run: dpkg --get-selections | grep -v deinstall > my-selections

Move the my-selections file over to System B.

On System B, run: dpkg --set-selections < my-selections

and then:

sudo apt-get dselect-upgrade

Important note: if you have installed packages from non-standard repositories and/or PPAs, you will also want to copy /etc/apt/sources.list and the contents of /etc/apt/sources.list.d/ from System A to System B before you run the upgrade.

You can use dpkg to see what you’ve removed as well (NB: this will also include packages that you manually installed and removed):

dpkg --get-selections | grep deinstall

You can see your results in the terminal, or, of course, redirect to a file.

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

2


 

This thread from superuser.com gives this solution:

aptitude search '?installed ?not(?automatic)'

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

3


 

If your apt logs are in /var/log/apt, something like this should work:

gunzip -c /var/log/apt/history.log.*.gz | grep "apt-get install"

Or if you want to get rid of some of the repetitive junk in the output:

gunzip -c /var/log/apt/history.log.*.gz | grep "apt-get install" \ | cut -f4- -d" " | sort | uniq

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

4


 

You could use apt-mark, but I recommend debfoster:

sudo apt-get install debfoster
sudo debfoster

This will inspect all installed packages and figure out which ones are keeping the others installed:

texlive-full is keeping the following 161 packages installed:
  cm-super cm-super-minimal context doc-base dvipng feynmf
  fonts-gfs-artemisia fonts-gfs-baskerville fonts-gfs-bodoni-classic
  ...
Keep texlive-full? [Ynpsiuqx?], [H]elp:

As you answer “y” to each question (just push Enter to move quickly), debfoster will collect the package list and write them line-by-line to a file. By default this is at /var/lib/debfoster/keepers. It looks like this:

gnome-do
texlive-full
...

I configure debfoster via /etc/debfoster.conf to put this list at /etc/debfoster-keepersand track the file with etckeeper to keep history and backups. The answer here shows how to install a list of packages from a newline-delimited text file:

sudo apt-mark manual $(cat debfoster-keepers)

Note a limitation here, packages you purged have a ‘-‘ in front of them. So you want to remove those lines before calling apt-mark.

Even though the debfoster’s website says that debfoster is deprecated in favor of aptitude, I prefer debfoster’s prompt and simple configuration. It puts you in the middle of your package database and lets you clean things up, making the auto and manual packages more obvious.

Type “h” at the debfoster prompt to explain your options. Type “?” to see the package description. The how-to here might be useful.

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

5


 

I finally got it now:

outfile="$(mktemp)" pattern='([INSTALLIEREN]|[INSTALL])' if [[ -f "/var/log/aptitude.1.gz" ]] then gunzip -c /var/log/aptitude.*.gz | grep -E "$pattern" | awk '{ print $2; }' > "$outfile" fi if [[ -f "/var/log/aptitude" ]] then grep -E "$pattern" "/var/log/aptitude" | awk '{ print $2; }' >> "$outfile" fi sort "$outfile" rm "$outfile"

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

6


 

comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)

Gives all manually installed packages (not system packages, not dependencies). For examples it shows build-essential but not gcc.

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

7


 

didn’t see any solutions here work for me, I have installed quite a few deb packages with dpkg and a few of the items I was particularly looking for were missing.

A rather lengthy one liner, but convenient to copy and paste would be:

export DPKG_INITIAL=$(mktemp) DPKG_INSTALLED=$(mktemp) DPKG_CUSTOM=$(mktemp) DPKG_DEPS=$(mktemp); zgrep -E '^Package' /var/log/installer/initial-status.gz | awk '{ print $2 }' | sort -u > $DPKG_INITIAL && awk '$3 !~ /install|remove|purge/ { next } { gsub(/remove|purge/, "uninstall", $3) ; gsub(/:.+/, "", $4) ; a[$4]=$3 } END { for (p in a) { if (a[p] == "install") { print p } } }' /var/log/dpkg.log | sort -u > $DPKG_INSTALLED && comm -23 $DPKG_INSTALLED $DPKG_INITIAL > $DPKG_CUSTOM && function rdep() { apt-cache rdepends $1 | tail -n +3 | sed -e 's/^ //' -e '/^ /d' | cut -d':' -f1 | sort -u; } ; echo "$(for i in $(cat $DPKG_CUSTOM) ; do rdep $i ; done)" | sort -u > $DPKG_DEPS && comm -23 $DPKG_CUSTOM $DPKG_DEPS > my-packages ; rm $DPKG_INITIAL $DPKG_INSTALLED $DPKG_CUSTOM $DPKG_DEPS

The above command saves a list of packages to a file in your current working directory named my-packages.

Explanation

I first built a list of packages that composed the baseline of packages selected during installation.

zgrep -E '^Package' /var/log/installer/initial-status.gz | awk '{ print $2 }' | sort -u > $DPKG_INITIAL

Followed by a long list of items installed in general.

awk '$3 !~ /install|remove|purge/ { next } { gsub(/remove|purge/, "uninstall", $3) ; gsub(/:.+/, "", $4) ; a[$4]=$3 } END { for (p in a) { if (a[p] == "install") { print p } } }' /var/log/dpkg.log | sort -u > $DPKG_INSTALLED

I then compared the two files $DPKG_INITIAL and $DPKG_INSTALLED to list only the items unique to $DPKG_INSTALLED.

comm -23 $DPKG_INSTALLED $DPKG_INITIAL > $DPKG_CUSTOM

From there I wanted to filter out the dependencies, this is where this method may miss some desired packages, it is unaware of dependencies that are also explicitly installed.

I wrote a quick bash function to shorten this steps in processing these items.

function rdep() { apt-cache rdepends $1 | tail -n +3 | sed -e 's/^ //' -e '/^ /d' | cut -d':' -f1 | sort -u; }

After that I passed each line from my file $DPKG_CUSTOM into this function with xargs.

echo "$(for i in $(cat $DPKG_CUSTOM) ; do rdep $i ; done)" | sort -u > $DPKG_DEPS

Once I had the long list of every possible dependency, (not sure on the every possible statement), I once again got the lines that were unique to a single file.

comm -23 $DPKG_CUSTOM $DPKG_DEPS > my-packages

And my finished list of packages is now in a file named my-packages available for me to review.

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

8


 

cd /var/log/apt
cat  history.log | grep Commandline

this way you see the list of commands performed in the past.

Remove the grep code if you need more information:

less history.log

if the log is compressed (i.e. end with gz)

gunzip <filename>

to zip it again when finished you can do:

gzip <filename>

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

9


 

Someone linked to http://unix.stackexchange.com/questions/3595/ubuntu-list-explicitly-installed-packages/3624#3624 which does have a good solution, but, it doesn’t behave correctly as the output from aptitude has changed. Here is an updated version, based around compared currently installed packages compared to 12.04 LTS. You will need aptitude installed, that is the only requirement.

aptitude search '~i !~M' -F '%p' | sort -u | tr -d ' ' > currentlyinstalled && wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest | cut -f 1 | sort -u > defaultinstalled && comm -23 currentlyinstalled defaultinstalled

To break the above command down into parts, this bit outputs one package per line of everything installed on the system

aptitude search '~i !~M' -F '%p' | sort -u | tr -d ' ' > currentlyinstalled

And this downloads the default package list & crops the redundant information.

wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest | cut -f 1 | sort -u > defaultinstalled

and comm compares the two files and outputs the packages which arent in the default list.

comm -23 currentlyinstalled defaultinstalled

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

10


 

Use a distribution manifest file as the base package set. Sort the manually installed results into package groups by architecture and section, so it’s easier to focus on groups of packages (maybe you don’t care about some sections).

https://gist.github.com/darrenleeweber/8cc570ff402f19af7fa4

#!/bin/bash manifest_url='http://releases.ubuntu.com/releases/trusty/ubuntu-14.04.3-desktop-amd64.manifest' manifest_file=$(echo $manifest_url | sed -e 's#.*/##g') if [ ! -e $manifest_file ]; then wget -q $manifest_url fi cat $manifest_file | cut -f1 | sort -u > default_installed.txt aptitude search '~i !~M' -F '%p' --disable-columns | sort -u > currently_installed.txt comm -23 currently_installed.txt default_installed.txt > manually_installed.txt # sort the 'mannually_installed.txt' packages by architecture and section mkdir -p package_files while read p; do apt-cache show $p > info.txt arch=$(grep -m1 'Architecture: ' info.txt | sed -e 's/Architecture: //') section=$(grep -m1 'Section: ' info.txt | sed -e 's/Section: //' -e 's/\//_/g') file="${arch}_${section}_packages.txt" echo $p >> "package_files/$file" done <manually_installed.txt rm info.txt

http://askubuntu.com/questions/32007/how-to-find-manually-installed-packages

11


 

apt-rdepends –-dotty git-arch | dot -Tpng > git_deps.png

https://blog.hartwork.org/?p=108

12


 

apt-cache rdepends packagename should do what you want

http://askubuntu.com/questions/128524/how-to-list-dependent-packages-reverse-dependencies

13


 

aptitude has a fairly nice way of handling this:

$ aptitude why bash
i foomatic-filters PreDepends bash (>= 2.05)
It only lists one reason, but that’s usually enough…

14


 

There are more than one way, with each method showing a different output.

For a detailed view of the dependency tree; aptitude install apt-rdepends apt-rdepends bash

Alternatively;

apt-cache showpkg bash

Or a concise list:

apt-cache rdepends bash

15


 

apt-cache showpkg <pkgname> 

Example:

apt-cache showpkg lightdm

16


 

Reverse depends

Reverse depends means you want a list of packages that depend on a given package.

Example

$ apt-cache rdepends jetty
jetty
Reverse Depends:
  solr-jetty
  libjetty-java
  libjetty-extra-java
  libjetty-extra
  libini4j-java
  guacamole

Recursive depends

Using a tool such as apt-rdepends shows what packages a given package is dependent on, plus what packages these packages are also dependent on. This is performed recursively until the entire dependency tree is exhausted.

Example

$ apt-rdepends jetty | head -10
Reading package lists... Done
Building dependency tree       
Reading state information... Done
jetty
  Depends: adduser
  Depends: apache2-utils
  Depends: default-jre-headless
  Depends: java5-runtime-headless
  Depends: jsvc
  Depends: libjetty-java (>= 6.1.26-1ubuntu1)
adduser
  Depends: debconf
  Depends: debconf-2.0
...

Above you can see that jetty is dependent on adduser which itself is dependent on debconf.

Reverse recursive depends

This one shows what packages depend on a package that depends on a given package. This is again done recursively.

Example

$ apt-rdepends --reverse jetty 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
jetty
  Reverse Depends: solr-jetty (>= 3.6.1+dfsg-0ubuntu2)
solr-jetty
  Reverse Depends: chef-solr (>= 10.12.0+dfsg-1)
chef-solr
  Reverse Depends: chef-expander (>= 10.12.0-1)
  Reverse Depends: chef-server-api (>= 10.12.0-1)
chef-expander
chef-server-api
  Reverse Depends: chef-server-webui (>= 10.12.0+dfsg-1)
chef-server-webui

Again here as the tree is explored the first package that lists jetty as a dependency is solr-jetty, which in turn is listed as a dependency for chef-solr, etc.

Types of depends

It can get a little confusing but there are a variety of depends. Looking at the man page for apt-rdepends:

-f, --follow=DEPENDS A comma-separated list of DEPENDS types to follow recursively. By default, it only follows the Depends and PreDepends types. The possible values for DEPENDS are: Depends, PreDepends, Suggests, Recommends, Conflicts, Replaces, and Obsoletes. In --build-depends mode, the possible values are: Build-Depends, Build-Depends-Indep, Build-Conflicts, Build-Conflicts-Indep.

http://unix.stackexchange.com/questions/141247/what-is-the-difference-between-a-recursive-dependency-check-and-a-reverse-depend

17


 

You can use tools like apt-cacher, apt-mirror or apt-offline (which sounds like it fits your requirements best).

apt-offline –

apt-offline is an Offline APT Package Manager

apt-offline can fully update and upgrade an APT based distribution without connecting to the network, all of it transparent to apt

apt-offline can be used to generate a signature on a machine (with no network). This signature contains all download information required for the apt database system. This signature file can be used on another machine connected to the internet (which need not be a Debian box and can even be running windows) to download the updates. The downloaded data will contain all updates in a format understood by apt and this data can be used by apt-offline to update the non-networked machine.

http://superuser.com/questions/324069/grab-all-dependencies-from-apt-get-for-offline-install-ubuntu-11

18


 

I would go with this:

apt-get download PACKAGE && apt-cache depends -i PACKAGE | awk '{print $2}' | xargs apt-get download

Then you can install it with dpkg -i *.deb in the directory you downloaded these.

Iklan

Mohon jangan gunakan emotikon:

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s