-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux_package_managers.txt
404 lines (353 loc) · 18.1 KB
/
linux_package_managers.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
[[{linux,packaging]]
# APPLICATION PACKAGE MANAGERS
[[{packaging.rpm,packaging.dnf,01_PM.WiP,doc_has.cheatsheet]]
# DNF ("yum++")
## *.rpm
* rpm files contains single (ussually compiled) packages plus install scripts.
If the depends on other dependencies, dnf can take care of dowloading and
installing them first. To manually (trying to) install some package:
```
$ rpm -qa # <·· list all installed packages on the system.
$ rpm -qi packageABC # <· display information on a given package (version, install date)
$ rpm -ql packageABC # <· list all files installed by package.
```
* <https://dnf.readthedocs.io/en/latest/>
* <https://github.com/rpm-software-management>
* Fedora Devs Plans to Replace DNF with DNF5 in Fedora Linux 39
<https://linuxiac.com/fedora-devs-plans-to-replace-dnf-with-dnf5-in-fedora-39/>
### MOST COMMONLY USED COMMANDS
* DNF Full command list
<https://dnf.readthedocs.io/en/latest/command_ref.html>
```
| $ dnf search myPackage # <· Show matching pattern in package name|description
| $ dnf list myPackage # <· Show matching pattern in package name
|
| $ sudo dnf install myNewPackage # <· Install package and dependencies
| (-y flag to avoid confirmation prompt)
| $ dnf info myPackage # <·dump detailed information, including dependencies.
| $ sudo dnf remove myPakcage # <· Removes package
|
| $ sudo dnf history # ← Check dnf install history
| $ sudo dnf history undo 13 # ← Undo/rollback install
|
| $ sudo dnf upgrade # ← Upgrade all upgradable packages
| (patch security bugs)
```
### Package Report
```
| $ dnf list installed # ← report all installed packages
| $ dnf list available # ← report all available packages
| # in any accessible repository
| $ dnf list obsoletes # ← report obsoleted by packages
| in any accessible repository
| $ dnf list recent # ← report packages recently added
| into accessible repositories
| $ dnf list upgrades # ← report available packages upgrading
```
*Avoid dnf/yum update certain packages:*
(This can be needed in critical systems where no downtime is allowed for some service)
* Add next line to /etc/dnf/dnf.conf (new Fedora/RedHat distros) or
/etc/yum.conf ( old Fedora/RedHat distros)
|exclude=kernel* another_package_name_or_name_pattern
* List all available versions of a package
YUM: sorting by version number:
$ yum list docker-ce --showduplicates | sort -r
*Report (remote) package repositories*
```
| $ dnf repolist
| (example output)
| → ...
| → Using metadata from Mon Sep 10 16:21:18 2018
| → repo id repo name
| → base CentOS-7 - Base
| → centos-openshift-origin CentOS OpenShift Origin
| → centos-sclo-rh CentOS-7 - SCLo rh
| → centos-sclo-sclo CentOS-7 - SCLo sclo
| → code Visual Studio Code
| → docker-ce-stable Docker CE Stable - x86_64
| → epel Extra Packages for Enterprise Linux 7 - x86_64 12,672
| → extras CentOS-7 - Extras
| → go-repo go-repo - CentOS
| → nodesource Node.js Packages for Enterprise Linux 7 - x86_64 144
| → openlogic CentOS-7 - openlogic packages for x86_64 113
| → pgdg94 PostgreSQL 9.4 7 - x86_64
| → updates CentOS-7 - Updates
```
### SCL (Software Collections) [[{]]
* <https://www.softwarecollections.org/en/>
```
| $ python --version
| Python 2.7.5
| $ scl enable rh-python35 bash <··· Example Ussage:
| $ python --version
| Python 3.5.1
| $ sudo yum --disablerepo=\* \ <····· Install from a given repository:
| --enablerepo=my-cool-repo \
| install myPackage
| $ dnf groupinfo "Development Tools" <····· $ sudo dnf groupinstall "Development Tools"
| Group: Development Tools to install all the group
| Description: A basic development environment.
| Mandatory Packages:
| autoconf
| automake
| binutils
| ...
| Default Packages:
| byacc
| cscope
| ...
| Optional Packages:
| ElectricFence
| ant
| babel
| ...
```
[[}]]
[[packaging.rpm}]]
[[{packaging.apt,packaging.deb,doc_has.cheatsheet]]
# apt (Debian/Ubuntu/...)
## .deb packages
* A .deb package is a (ussually) precompiled application plus initialization scripts.
.deb packages can fail to install if they depends on other deb packages not yet
installed. Finding and donwloading dependencies can be tedious, and this is solved by
apt, that takes care of downloading and installing transitive dependencies transparently.
To install a .deb package manually (without apt):
```
| $ dpkg -i packageABC.deb # <·· Install
| $ dpkg -r packageABC.deb # <·· remove
| $ dpkg -L packageABC # <·· list all files installed by package.
```
## apt vs apt-get
* `apt-get` (Debian 1993): target sysadmin. Stable and backward compatible API.
Slightly more difficult to use. Mandatory for script.
* `apt`: (Ubuntu 2014). Targets Linux users with user friendly features,
like a status bar with install progress. apt combines apt-get and apt-cache and additional command line options, and removes "obscure" options.
Ex: `apt-get update` only reports if you can update package lists in
remote repositories, while `apt update` add the number of packages
that can be upgrades and suggest `apt list --upgradable` to list
upgradable ones.
```
| apt apt-get Description
| apt-cache
| ------------- ----------------------------------------------
| apt install apt-get install Install a package
| apt update apt-get update Update all repository info
| apt upgrade apt-get upgrade Update all installed packages
| apt autoremove apt-get autoremove Remove packages that are no longer needed
| apt remove apt-get remove Remove an installed package
| apt purge apt-get purge Remove an installed package and delete configuration files
| apt search apt-cache search Seach repositories for a package
| apt show apt-cache show Show details for a package
```
(o 'aptitude' ncurses variant)
* <https://help.ubuntu.com/community/AptGet/Howto#Maintenance_commands>
```
| $ apt search regexPackageName ← Show all package with similar name
| $ apt show package1 ← Show package details (Version, Origin,
| Maintainer, Bugs Reporting[[qa.ticketing]],
| dependencies, recomended extra-packages,
| homepage, Description,
| $ dpkg -L "package_name" ← list files in package
| $ dpkg -c foo.deb ← lists files in the manually downloaded package
| "./foo.deb".
| INSTALL/UPDATE
| $ sudo apt install package1 package2 ← (-s to simulate)
| $ sudo apt reinstall package1 ← Reinstall.
| $ sudo apt upgrade package1 ← Upgrade
| $ apt list --upgradable <· list what can be updated.
| $ sudo apt update ← Refresh local cache with remote info about
| newest package version.
| KEY-POINT Run periodically and after modifications
| to /etc/apt/*.
| $ sudo apt upgrade ← upgrade all installed packages.
| $ sudo apt full-upgrade ← Upgrades packages with dependencies auto-handling
| $ sudo apt dist-upgrade ← like 'upgrade' adding the "smart upgrade" checkbox.
| It tells APT to use "smart" conflict resolution
| system, TRYING TO UPGRADE MOST IMPORTANT PACKAGES
| AT EXPENSE OF LESS IMPORTANT ONES.
| ¡¡¡does not upgrade from a previous version!!!
|
| $ apt-cache depends --recurse \ ← Show installed package dependencies.
| --installed $package ||grep '[ ]'
|
| Cleaning/Removal
| $ sudo apt-get remove "package_name" ← keep configuration files
| $ sudo apt-get purge "package_name" ← Remove configuration files
| $ sudo apt-get autoclean ← removes .deb files for packages no longer installed.
| (saving space in /var/cache/apt/archives)
| $ apt-get clean ← like autoclean, but removing all packages from package-cache.
| Not recomended with slow-connections.
| ($ du -sh /var/cache/apt/archives)
| $ apt-get autoremove ← removes packages no longer needed
|
| $ apt-get check ← update package lists [[packaging.apt.troubleshooting]]
| check for broken dependencies
|
| $ sudo apt -f install ← Fix Broken Packages ("complains" about "unmet dependencies")
| $ dpkg-reconfigure package1
|
| $ echo "'package1' hold" |\ ← Put package1 on hold (AVOID NON-CONTROLLED UPGRADE).
| sudo dpkg --set-selections WARN: (SIDE-EFFECT) prevents upgrades to packages
| depending on updated versions of package1.
| ('sudo apt dist-upgrade' will override it)
| Setting http-proxy
| - alt 1: Temporary proxy session:
| # export http_proxy=http://username:password@yourproxyaddress:proxyport
|
| - alt 2: APT configuration file method
| Add next line to /etc/apt/apt.conf
| | Acquire::http::Proxy "http://yourproxyaddress:proxyport";
```
*Advanced Package Search*
```
| $ dpkg -l $search_term ← find packages whose names contain "search_term".
| It also shows whether a package is installed on your system
|
| $ dpkg -S $search_pattern ← "what package provides this file/package?" reverse lookup.
| List packages providing or owning the file
| or package matching search_pattern. 'dlocate' is a faster
| (but not installed by default) alternative.
| 'apt-file' also allows to search over all available packages,
```
### APT Sources [[01_PM.TODO]]
/etc/apt/sources.list file
<https://help.ubuntu.com/community/SourcesList>
[[packaging.apt}]]
## apk (Alpine) [[{packaging.apk]]
<https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management>
* Alpine Linux is designed to run from RAM, implying that package management
involves two phases:
* Installing / Upgrading / Deleting packages on a running system.
Restoring a system to a previously configured state
(e.g. after reboot), including all previously installed packages
and locally modified configuration files. (RAM-Based Installs Only)
```
| - apk: tool used to install/upgrade/delete software.
| - lbu: tool used to capture the data necessary to
| restore a system to previously configured state.
|
| - apk:
| add Add new packages to the running system
| del Delete packages from the running system
| fix Attempt to repair or upgrade an installed package
| update Update the index of available packages
| info Prints information about installed or available packages
| search Search for packages or descriptions with wildcard patterns
| upgrade Upgrade the currently installed packages
| cache Maintenance operations for locally cached package repository
| version Compare version differences between installed and available packages
| index create a repository index from a list of packages
| fetch download (but not install) packages
| audit List changes to the file system from pristine package install state
| verify Verify a package signature
| dot Create a graphviz graph description for a given package
| policy Display the repository that updates a given
| package, plus repositories that also offer the package
| stats Display statistics, including number of
| packages installed and available, number of
| directories and files, etc.
| manifest Display checksums for files contained in a given package
```
* Alpine packages:
```
| Alpine repositories: directory with *.apk files
| ├ APKINDEX.tar.gz index
| ├ file1.apk ← digitally signed tar.gz (often called "a-pack")
| ├ file2.apk
| ├ ...
|
| The list of repositories to check is stored in /etc/apk/repositories
| (one repo per line). Ex:
| $ cat /media/sda1/apks
| http://nl.alpinelinux.org/alpine/v3.7/community
| @edge http://nl.alpinelinux.org/alpine/edge/main
| @edgecommunity http://nl.alpinelinux.org/alpine/edge/community
| @testing http://nl.alpinelinux.org/alpine/edge/testing
| └─────┬──────┘
| "tagged" repo will be used like
| # apk add stableapp newapp@edge bleedingapp@testing
| └───┘ └──────┘
| by default only untagged repositories are used
|
| Update the Package list ---------------------------------
| # apk update (Fill catche locally from remote APKINDEX.tar.gz)
|
| $ apk add openssh openntp vim # Add Package/s (plus transitive dependencies)
|
| # apk add cherokee --update-cache \ # Add package from dev. repository (dangerous!!)
| --repository http://dl-3.alpinelinux.org/alpine/edge/testing/
| --allow-untrusted
|
| # apk add --allow-untrusted file.apk # Add local Package
| # apk del openssh # Remove a Package
|
| Upgrade Running System -------------------------------------------
| # apk update # STEP 1: Update indexes
| # apk upgrade # STEP 2: Alt 1. Upgrade ALL
| # apk add --upgrade busybox # STEP 2: Alt 2. Upgrade given package
| Remember: when rebooting the machine, the remote repository will
| not be available until after networking is started:
| => packages newer than your boot media will likely not be
| installed after a reboot. To make an "upgrade" persist
| over a reboot, use a local cache.
|
| Search for Packages ----------------------------------------------
| # apk search -v ← list all packages along with descriptions
| # apk search -v 'acf*' ← list all packages part of the ACF system
| # apk search -v --description 'NTP' ← list all packages that list NTP as
| part of their description,
|
|
| Information on Packages ------------------------------------------
| # apk info -a zlib ← -w: show just webpage info
| -a: show all info
```
[[packaging.apk}]]
# upx: executable compressor
* <https://upx.github.io/>
- Not recommended for standard (widely) used executable
since we loose the copy-on-right memory saving features of Linux.
- Can be interesting for "big singletons" apps.
[[{packaging.packer,doc_has.cheatsheet]]
# Packer (Arch Linux)
* packer: bash wrapper to aur+pacman
```
| packer -Syu: update all installed packages, including AUR packages.
| packer -S [package-name]: install package/s from the AUR.
| packer -Rs [package-name]:remove package, including its dependencies.
| packer -Ss [search-term]: search for packages in AUR.
| packer -Qi [package-name]:display information about AUR package, including dependencies.
| packer -Qm: list all installed packages from the AUR.
| packer -Ql [package-name]:list all files installed by an AUR package.
| packer -U [package-name]: update an AUR package if a new version is available.
```
[[packaging.packer}]]
[[{packaging.yaourt,doc_has.cheatsheet]]
# Yaourt (Arch Linux)
* yaourt: Yet Another User Repository Tool
```
| yaourt -Syua: update all installed packages, including AUR packages.
| yaourt -S [package-name]: install package/s from the AUR.
| yaourt -Rs [package-name]: remove package, including its dependencies.
| yaourt -Ss [search-term]: search for packages.
| yaourt -Qi [package-name]: display detailed information, including dependencies.
| yaourt -Qm: list all installed packages from the AUR.
| yaourt -Ql [package-name]: list all files installed by an AUR package.
| yaourt -U [package-name]: update an AUR package if a new version is available.
```
[[packaging.yaourt}]]
[[{packaging.pacman,doc_has.cheatsheet]]
# Pacman (Arch Linux)
```
| pacman -Syu : This command is used to update all installed packages on the system.
| pacman -S [package-name] : This command is used to install a specific package or multiple packages.
| pacman -Rs [package-name]: This command is used to remove a specific package from the system.
| pacman -Ss [search-term] : This command is used to search for packages based on a search term.
| pacman -Qi [package-name]: This command is used to display detailed information about a package, including its dependencies.
| pacman -Q : This command is used to list all installed packages on the system.
| pacman -Ql [package-name]: This command is used to list all files installed by a package.
| pacman -U [package-file]:: This command is used to install a package from a local file.
| pacman -Sc : This command is used to clean up the package cache, removing old and unused package versions.
```
[[packaging.pacman}]]
[[linux,packaging}]]