Ubuntu apt: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
No edit summary |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[ | [[Category:Ubuntu|apt]] | ||
== Get all non LTS packages == | == Get all non LTS packages == | ||
< | <syntaxhighlight lang=awk> | ||
# dpkg --list | awk '/^ii/ {print $2}' | xargs apt-cache show | awk ' | # dpkg --list | awk '/^ii/ {print $2}' | xargs apt-cache show | awk ' | ||
BEGIN{ | BEGIN{ | ||
Line 16: | Line 16: | ||
support="none"; | support="none"; | ||
}' | }' | ||
</ | </syntaxhighlight> | ||
== Ubuntu support status == | |||
<syntaxhighlight lang=bash> | |||
$ ubuntu-support-status --show-unsupported | |||
</syntaxhighlight> | |||
== Configuring a proxy for apt == | == Configuring a proxy for apt == | ||
Put this into your /etc/apt/apt.conf.d/00proxy : | Put this into your /etc/apt/apt.conf.d/00proxy : | ||
< | <syntaxhighlight lang=bash> | ||
// Options for the downloading routines | // Options for the downloading routines | ||
Acquire | Acquire | ||
Line 68: | Line 73: | ||
}; | }; | ||
}; | }; | ||
</ | </syntaxhighlight> | ||
==Use this proxy config for in the shell== | |||
<syntaxhighlight lang=bash> | |||
eval $(apt-config dump Acquire | awk -F '(::| )' '$3 ~ /Proxy/{printf "%s_proxy=%s\nexport %s_proxy\n",$2,$4,$2;}') | |||
</syntaxhighlight> | |||
== Getting some packages from a newer release == | |||
In this example we are living in <i>xenial</i> and want PowerDNS from <i>zesty</i> because we need CAA records in the nameservice. | |||
=== Pin the normal release === | |||
<syntaxhighlight lang=bash> | |||
# echo 'APT::Default-Release "xenial";' > /etc/apt/apt.conf.d/01pinning | |||
</syntaxhighlight> | |||
=== Add new release to /etc/apt/sources.list === | |||
This is the /etc/apt/sources.list on my x86 64bit Ubuntu: | |||
<pre> | |||
# Xenial | |||
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe | |||
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe | |||
deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main restricted universe | |||
# Zesty | |||
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ zesty main restricted universe | |||
deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ zesty-updates main restricted universe | |||
deb [arch=amd64] http://security.ubuntu.com/ubuntu zesty-security main restricted universe | |||
</pre> | |||
=== Tell apt via /etc/apt/preferences.d/... to prefer some packages from the new release === | |||
This is the /etc/apt/preferences.d/pdns: | |||
<pre> | |||
Package: pdns-* | |||
Pin: release a=zesty, l=Ubuntu | |||
Pin-Priority: 1000 | |||
Package: pdns-* | |||
Pin: release a=zesty-updates, l=Ubuntu | |||
Pin-Priority: 1000 | |||
Package: pdns-* | |||
Pin: release a=zesty-security, l=Ubuntu | |||
Pin-Priority: 1000 | |||
</pre> | |||
=== Upgrade to the packages from the new release === | |||
<syntaxhighlight lang=bash> | |||
# apt update | |||
... | |||
2 packages can be upgraded. Run 'apt list --upgradable' to see them. | |||
... | |||
</syntaxhighlight> | |||
=== Check with "apt-cache policy" which version is preferred now === | |||
<syntaxhighlight lang=bash> | |||
# apt-cache policy pdns-server pdns-tools | |||
pdns-server: | |||
Installed: 4.0.3-1 | |||
Candidate: 4.0.3-1 | |||
Version table: | |||
*** 4.0.3-1 1000 | |||
500 http://de.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages | |||
100 /var/lib/dpkg/status | |||
4.0.0~alpha2-3build1 990 | |||
990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages | |||
pdns-tools: | |||
Installed: (none) | |||
Candidate: 4.0.3-1 | |||
Version table: | |||
4.0.3-1 1000 | |||
500 http://de.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages | |||
4.0.0~alpha2-3build1 990 | |||
990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages | |||
</syntaxhighlight> | |||
=== Upgrade to the packages from the new release === | |||
<syntaxhighlight lang=bash> | |||
# apt install pdns-tools | |||
Reading package lists... Done | |||
Building dependency tree | |||
Reading state information... Done | |||
Some packages could not be installed. This may mean that you have | |||
requested an impossible situation or if you are using the unstable | |||
distribution that some required packages have not yet been created | |||
or been moved out of Incoming. | |||
The following information may help to resolve the situation: | |||
The following packages have unmet dependencies: | |||
pdns-tools : Depends: libstdc++6 (>= 6) but 5.4.0-6ubuntu1~16.04.5 is to be installed | |||
E: Unable to correct problems, you have held broken packages. | |||
</syntaxhighlight> | |||
This shows the pinning to xenial works ;-). | |||
=== Override pinning for one package === | |||
<syntaxhighlight lang=bash> | |||
# apt -t zesty install libstdc++6 | |||
... | |||
</syntaxhighlight> | |||
== Get man pages in minimized ubuntu == | |||
<syntaxhighlight lang=bash> | |||
# man ls | |||
This system has been minimized by removing packages and content that are | |||
not required on a system that users do not log into. | |||
To restore this content, including manpages, you can run the 'unminimize' | |||
command. You will still need to ensure the 'man-db' package is installed. | |||
</syntaxhighlight> | |||
In <i>/etc/dpkg/dpkg.cfg.d/excludes</i> comment out <i>path-exclude=/usr/share/man/*</i> : | |||
<syntaxhighlight lang=bash> | |||
# Drop all man pages | |||
#path-exclude=/usr/share/man/* | |||
... | |||
</syntaxhighlight> | |||
<syntaxhighlight lang=bash> | |||
# rm /usr/bin/man | |||
# dpkg-divert --quiet --remove --rename /usr/bin/man | |||
</syntaxhighlight> |
Latest revision as of 09:43, 22 September 2023
Get all non LTS packages
# dpkg --list | awk '/^ii/ {print $2}' | xargs apt-cache show | awk '
BEGIN{
support="none";
}
/^Package:/,/^$/{
if(/^Package:/){ pkg=$2; }
if(/^Supported:/){ support=$2; }
if(/^$/ && support != "5y"){ printf "%s:\t%s\n", pkg, support; }
}
/^$/ {
support="none";
}'
Ubuntu support status
$ ubuntu-support-status --show-unsupported
Configuring a proxy for apt
Put this into your /etc/apt/apt.conf.d/00proxy :
// Options for the downloading routines
Acquire
{
Queue-Mode "host"; // host|access
Retries "0";
Source-Symlinks "true";
// HTTP method configuration
http
{
//Proxy::http.us.debian.org "DIRECT"; // Specific per-host setting
Proxy "http://<user>:<password>@<proxy-host>:<proxy-port>";
Timeout "120";
Pipeline-Depth "5";
// Cache Control. Note these do not work with Squid 2.0.2
No-Cache "false";
Max-Age "86400"; // 1 Day age on index files
No-Store "false"; // Prevent the cache from storing archives
};
ftp
{
Proxy "http://<user>:<password>@<proxy-host>:<proxy-port>";
//Proxy::http.us.debian.org "DIRECT"; // Specific per-host setting
Timeout "120";
/* Passive mode control, proxy, non-proxy and per-host. Pasv mode
is prefered if possible */
Passive "true";
Proxy::Passive "true";
Passive::http.us.debian.org "true"; // Specific per-host setting
};
cdrom
{
mount "/cdrom";
// You need the trailing slash!
"/cdrom"
{
Mount "sleep 1000";
UMount "sleep 500";
}
};
};
Use this proxy config for in the shell
eval $(apt-config dump Acquire | awk -F '(::| )' '$3 ~ /Proxy/{printf "%s_proxy=%s\nexport %s_proxy\n",$2,$4,$2;}')
Getting some packages from a newer release
In this example we are living in xenial and want PowerDNS from zesty because we need CAA records in the nameservice.
Pin the normal release
# echo 'APT::Default-Release "xenial";' > /etc/apt/apt.conf.d/01pinning
Add new release to /etc/apt/sources.list
This is the /etc/apt/sources.list on my x86 64bit Ubuntu:
# Xenial deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main restricted universe # Zesty deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ zesty main restricted universe deb [arch=amd64] http://de.archive.ubuntu.com/ubuntu/ zesty-updates main restricted universe deb [arch=amd64] http://security.ubuntu.com/ubuntu zesty-security main restricted universe
Tell apt via /etc/apt/preferences.d/... to prefer some packages from the new release
This is the /etc/apt/preferences.d/pdns:
Package: pdns-* Pin: release a=zesty, l=Ubuntu Pin-Priority: 1000 Package: pdns-* Pin: release a=zesty-updates, l=Ubuntu Pin-Priority: 1000 Package: pdns-* Pin: release a=zesty-security, l=Ubuntu Pin-Priority: 1000
Upgrade to the packages from the new release
# apt update
...
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
...
Check with "apt-cache policy" which version is preferred now
# apt-cache policy pdns-server pdns-tools
pdns-server:
Installed: 4.0.3-1
Candidate: 4.0.3-1
Version table:
*** 4.0.3-1 1000
500 http://de.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages
100 /var/lib/dpkg/status
4.0.0~alpha2-3build1 990
990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
pdns-tools:
Installed: (none)
Candidate: 4.0.3-1
Version table:
4.0.3-1 1000
500 http://de.archive.ubuntu.com/ubuntu zesty/universe amd64 Packages
4.0.0~alpha2-3build1 990
990 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Upgrade to the packages from the new release
# apt install pdns-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
pdns-tools : Depends: libstdc++6 (>= 6) but 5.4.0-6ubuntu1~16.04.5 is to be installed
E: Unable to correct problems, you have held broken packages.
This shows the pinning to xenial works ;-).
Override pinning for one package
# apt -t zesty install libstdc++6
...
Get man pages in minimized ubuntu
# man ls
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, including manpages, you can run the 'unminimize'
command. You will still need to ensure the 'man-db' package is installed.
In /etc/dpkg/dpkg.cfg.d/excludes comment out path-exclude=/usr/share/man/* :
# Drop all man pages
#path-exclude=/usr/share/man/*
...
# rm /usr/bin/man
# dpkg-divert --quiet --remove --rename /usr/bin/man