Package Management: Difference between revisions
Jump to navigation
Jump to search
Managing alternatives with
(New page: == Ubuntu / Debian == <source lang=bash> dpkg --get-selections # Show the list of packages installed through apt-get dpkg --get-selections | grep php # ... filtering for ...) |
|||
(75 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Ubuntu / Debian == |
== Ubuntu / Debian == |
||
See [[apt]]. |
|||
== RPM's == |
|||
* [http://susefaq.sourceforge.net/articles/rpm.html RPM RedHat Package Manager] |
|||
* [http://linuxgazette.net/issue68/nazario.html Using RPM: THe Basics (Part I)] |
|||
* '''Install commands''' |
|||
<source lang="bash"> |
|||
rpm -ivh package # Installing a package - verbose and progress bars |
|||
rpm -iv -nodeps package # Installing a package (verbose), ignore dependencies |
|||
</source> |
|||
* '''Query commands''' |
|||
<source lang="bash"> |
|||
rpm -ql package # List files provided by a package |
|||
</source> |
|||
:* To query a package that has '''not been installed''', add '''-p''' option to the command: |
|||
<source lang="bash"> |
|||
rpm -qpl package # List files provided by a package |
|||
</source> |
|||
== Source package == |
|||
Installing from source package is usually done with |
|||
<source lang="bash"> |
|||
./configure |
|||
make |
|||
sudo make install |
|||
</source> |
|||
Usually <code>./configure --help</code> gives additional package configuration options (like installing documentation, etc). |
|||
;Installing build dependencies |
|||
: Building from sources usually requires more dependencies than using the package. If the package is available on the distribution, the easiest way to install these dependencies is usually via <code>apt-get build-dep</code>: |
|||
<source lang=bash> |
<source lang=bash> |
||
sudo apt-get build-dep udisks |
|||
dpkg --get-selections # Show the list of packages installed through apt-get |
|||
</source> |
|||
dpkg --get-selections | grep php # ... filtering for some specific package keyword |
|||
dpkg -L <package> # Show files delivered by a given <package> |
|||
;Installing as a package |
|||
apt-cache search <keyword> # Search package cache (package name and description) for given <keyword> |
|||
: Instead of installing with <code>make install</code>, use <code>[https://help.ubuntu.com/community/CheckInstall checkinstall]</code> to create a temporary package that can later be uninstalled with the package manager. |
|||
<source lang="bash"> |
|||
./configure |
|||
make |
|||
sudo checkinstall # Creates a package and install it as if 'sudo make install' was run |
|||
#... to uninstall: |
|||
sudo dpkg -r <packagename> |
|||
</source> |
|||
:Note that <tt>checkinstall</tt> can actually run any arbitrary command and monitor change on the file system. |
|||
== Backports == |
|||
=== Debian === |
|||
See [https://www.ocf.berkeley.edu/docs/staff/procedures/backporting-packages/ Backporting Debian packages]. |
|||
== Managing alternatives with <code>update-alternatives</code> == |
|||
Display current set of alternatives (e.g. here for ''gcc'' on ''Cygwin''): |
|||
<source lang=bash> |
|||
$ /usr/sbin/update-alternatives --display gcc |
|||
</source> |
|||
<source lang=bash> |
|||
# gcc - status is manual. |
|||
# link currently points to /usr/bin/gcc-3.exe |
|||
# /usr/bin/gcc-3.exe - priority 30 |
|||
# slave lib-cpp: <NONE> |
|||
# slave cc: /usr/bin/cc-3.exe |
|||
# slave cpp: /usr/bin/cpp-3.exe |
|||
# slave gcov: /usr/bin/gcov-3.exe |
|||
# slave i686-pc-cygwin-gcc-4.3.4: <NONE> |
|||
# slave i686-pc-cygwin-gcc: /usr/bin/i686-pc-cygwin-gcc-3.exe |
|||
# slave protoize: /usr/bin/protoize-3.exe |
|||
# slave unprotoize: /usr/bin/unprotoize-3.exe |
|||
# slave cpp.1.gz: /usr/share/man/man1/cpp-3.1.gz |
|||
# slave gcc.1.gz: /usr/share/man/man1/gcc-3.1.gz |
|||
# slave gcov.1.gz: /usr/share/man/man1/gcov-3.1.gz |
|||
# slave ffi.3.gz: <NONE> |
|||
# slave ffi_call.3.gz: <NONE> |
|||
# slave ffi_prep_cif.3.gz: <NONE> |
|||
# /usr/bin/gcc-4.exe - priority 40 |
|||
# slave lib-cpp: /usr/bin/cpp-4.exe |
|||
# slave cc: /usr/bin/gcc-4.exe |
|||
# slave cpp: /usr/bin/cpp-4.exe |
|||
# slave gcov: /usr/bin/gcov-4.exe |
|||
# slave i686-pc-cygwin-gcc-4.3.4: <NONE> |
|||
# slave i686-pc-cygwin-gcc: /usr/bin/i686-pc-cygwin-gcc-4.exe |
|||
# slave protoize: <NONE> |
|||
# slave unprotoize: <NONE> |
|||
# slave cpp.1.gz: /usr/share/man/man1/cpp-4.1.gz |
|||
# slave gcc.1.gz: /usr/share/man/man1/gcc-4.1.gz |
|||
# slave gcov.1.gz: /usr/share/man/man1/gcov-4.1.gz |
|||
# slave ffi.3.gz: /usr/share/man/man3/ffi-4.3.gz |
|||
# slave ffi_call.3.gz: /usr/share/man/man3/ffi_call-4.3.gz |
|||
# slave ffi_prep_cif.3.gz: /usr/share/man/man3/ffi_prep_cif-4.3.gz |
|||
# Current `best' version is /usr/bin/gcc-4.exe. |
|||
</source> |
|||
'''Create a new entry''' with |
|||
<source lang=bash> |
|||
/usr/sbin/update-alternatives --install /usr/bin/gcc.exe gcc /usr/bin/gcc-3.exe 30 \ |
|||
--slave /usr/bin/cc.exe cc /usr/bin/cc-3.exe \ |
|||
--slave /usr/bin/cpp.exe cpp /usr/bin/cpp-3.exe \ |
|||
--slave /usr/bin/gcov.exe gcov /usr/bin/gcov-3.exe \ |
|||
--slave /usr/bin/i686-pc-cygwin-gcc.exe i686-pc-cygwin-gcc /usr/bin/i686-pc-cygwin-gcc-3.exe \ |
|||
--slave /usr/bin/protoize.exe protoize /usr/bin/protoize-3.exe \ |
|||
--slave /usr/bin/unprotoize.exe unprotoize /usr/bin/unprotoize-3.exe \ |
|||
--slave /usr/share/man/man1/cpp.1.gz cpp.1.gz /usr/share/man/man1/cpp-3.1.gz \ |
|||
--slave /usr/share/man/man1/gcc.1.gz gcc.1.gz /usr/share/man/man1/gcc-3.1.gz \ |
|||
--slave /usr/share/man/man1/gcov.1.gz gcov.1.gz /usr/share/man/man1/gcov-3.1.gz |
|||
</source> |
|||
'''Select an entry''' with |
|||
<source lang=bash> |
|||
/usr/sbin/update-alternatives --auto gcc # Select alternative for gcc based on priority |
|||
/usr/sbin/update-alternatives --set gcc /usr/bin/gcc-3.exe # Set gcc-3 as alternative for gcc (also set slaves, etc) |
|||
/usr/sbin/update-alternatives --config gcc # Select alternative via menu |
|||
</source> |
|||
=== Alternatives for clang === |
|||
<source lang="bash"> |
|||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100 |
|||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 1000 |
|||
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100 |
|||
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 1000 |
|||
sudo update-alternatives --config clang |
|||
sudo update-alternatives --config clang++ |
|||
</source> |
</source> |
Latest revision as of 09:24, 26 November 2019
Ubuntu / Debian
See apt.
RPM's
- RPM RedHat Package Manager
- Using RPM: THe Basics (Part I)
- Install commands
rpm -ivh package # Installing a package - verbose and progress bars
rpm -iv -nodeps package # Installing a package (verbose), ignore dependencies
- Query commands
rpm -ql package # List files provided by a package
- To query a package that has not been installed, add -p option to the command:
rpm -qpl package # List files provided by a package
Source package
Installing from source package is usually done with
./configure
make
sudo make install
Usually ./configure --help
gives additional package configuration options (like installing documentation, etc).
- Installing build dependencies
- Building from sources usually requires more dependencies than using the package. If the package is available on the distribution, the easiest way to install these dependencies is usually via
apt-get build-dep
:
sudo apt-get build-dep udisks
- Installing as a package
- Instead of installing with
make install
, usecheckinstall
to create a temporary package that can later be uninstalled with the package manager.
./configure
make
sudo checkinstall # Creates a package and install it as if 'sudo make install' was run
#... to uninstall:
sudo dpkg -r <packagename>
- Note that checkinstall can actually run any arbitrary command and monitor change on the file system.
Backports
Debian
See Backporting Debian packages.
Managing alternatives with update-alternatives
Display current set of alternatives (e.g. here for gcc on Cygwin):
$ /usr/sbin/update-alternatives --display gcc
# gcc - status is manual.
# link currently points to /usr/bin/gcc-3.exe
# /usr/bin/gcc-3.exe - priority 30
# slave lib-cpp: <NONE>
# slave cc: /usr/bin/cc-3.exe
# slave cpp: /usr/bin/cpp-3.exe
# slave gcov: /usr/bin/gcov-3.exe
# slave i686-pc-cygwin-gcc-4.3.4: <NONE>
# slave i686-pc-cygwin-gcc: /usr/bin/i686-pc-cygwin-gcc-3.exe
# slave protoize: /usr/bin/protoize-3.exe
# slave unprotoize: /usr/bin/unprotoize-3.exe
# slave cpp.1.gz: /usr/share/man/man1/cpp-3.1.gz
# slave gcc.1.gz: /usr/share/man/man1/gcc-3.1.gz
# slave gcov.1.gz: /usr/share/man/man1/gcov-3.1.gz
# slave ffi.3.gz: <NONE>
# slave ffi_call.3.gz: <NONE>
# slave ffi_prep_cif.3.gz: <NONE>
# /usr/bin/gcc-4.exe - priority 40
# slave lib-cpp: /usr/bin/cpp-4.exe
# slave cc: /usr/bin/gcc-4.exe
# slave cpp: /usr/bin/cpp-4.exe
# slave gcov: /usr/bin/gcov-4.exe
# slave i686-pc-cygwin-gcc-4.3.4: <NONE>
# slave i686-pc-cygwin-gcc: /usr/bin/i686-pc-cygwin-gcc-4.exe
# slave protoize: <NONE>
# slave unprotoize: <NONE>
# slave cpp.1.gz: /usr/share/man/man1/cpp-4.1.gz
# slave gcc.1.gz: /usr/share/man/man1/gcc-4.1.gz
# slave gcov.1.gz: /usr/share/man/man1/gcov-4.1.gz
# slave ffi.3.gz: /usr/share/man/man3/ffi-4.3.gz
# slave ffi_call.3.gz: /usr/share/man/man3/ffi_call-4.3.gz
# slave ffi_prep_cif.3.gz: /usr/share/man/man3/ffi_prep_cif-4.3.gz
# Current `best' version is /usr/bin/gcc-4.exe.
Create a new entry with
/usr/sbin/update-alternatives --install /usr/bin/gcc.exe gcc /usr/bin/gcc-3.exe 30 \
--slave /usr/bin/cc.exe cc /usr/bin/cc-3.exe \
--slave /usr/bin/cpp.exe cpp /usr/bin/cpp-3.exe \
--slave /usr/bin/gcov.exe gcov /usr/bin/gcov-3.exe \
--slave /usr/bin/i686-pc-cygwin-gcc.exe i686-pc-cygwin-gcc /usr/bin/i686-pc-cygwin-gcc-3.exe \
--slave /usr/bin/protoize.exe protoize /usr/bin/protoize-3.exe \
--slave /usr/bin/unprotoize.exe unprotoize /usr/bin/unprotoize-3.exe \
--slave /usr/share/man/man1/cpp.1.gz cpp.1.gz /usr/share/man/man1/cpp-3.1.gz \
--slave /usr/share/man/man1/gcc.1.gz gcc.1.gz /usr/share/man/man1/gcc-3.1.gz \
--slave /usr/share/man/man1/gcov.1.gz gcov.1.gz /usr/share/man/man1/gcov-3.1.gz
Select an entry with
/usr/sbin/update-alternatives --auto gcc # Select alternative for gcc based on priority
/usr/sbin/update-alternatives --set gcc /usr/bin/gcc-3.exe # Set gcc-3 as alternative for gcc (also set slaves, etc)
/usr/sbin/update-alternatives --config gcc # Select alternative via menu
Alternatives for clang
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 1000
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 1000
sudo update-alternatives --config clang
sudo update-alternatives --config clang++