[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
slackware:package_management_hands_on [2014/02/09 15:20 (UTC)] – created kikinovak | slackware:package_management_hands_on [2014/02/20 11:42 (UTC)] (current) – [Managing package dependencies] added missing formatting codes alienbob | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Package Management: A Hands-On Explanation ====== | ====== Package Management: A Hands-On Explanation ====== | ||
- | <note warning>WORK IN PROGRESS</ | + | **WORK IN PROGRESS** |
===== Anatomy of a Slackware package ===== | ===== Anatomy of a Slackware package ===== | ||
Line 165: | Line 165: | ||
</ | </ | ||
- | <note warning> | + | ==== Know more about the contents of a package ==== |
+ | Every package has a corresponding entry in ''/ | ||
+ | |||
+ | < | ||
+ | # less / | ||
+ | PACKAGE NAME: | ||
+ | COMPRESSED PACKAGE SIZE: | ||
+ | UNCOMPRESSED PACKAGE SIZE: 2.0M | ||
+ | PACKAGE LOCATION: / | ||
+ | PACKAGE DESCRIPTION: | ||
+ | wget: wget (a non-interactive network retriever) | ||
+ | wget: | ||
+ | wget: GNU Wget is a free network utility to retrieve files from the | ||
+ | wget: World Wide Web using HTTP and FTP, the two most widely used Internet | ||
+ | wget: protocols. | ||
+ | wget: background after having logged off. | ||
+ | wget: | ||
+ | wget: The author of Wget is Hrvoje Niksic < | ||
+ | wget: | ||
+ | wget: | ||
+ | wget: | ||
+ | FILE LIST: | ||
+ | ./ | ||
+ | install/ | ||
+ | install/ | ||
+ | install/ | ||
+ | usr/ | ||
+ | usr/bin/ | ||
+ | usr/ | ||
+ | usr/man/ | ||
+ | usr/ | ||
+ | usr/ | ||
+ | usr/info/ | ||
+ | usr/ | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ===== Managing Slackware packages with slackpkg ===== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | A few remarks: | ||
+ | |||
+ | - Only official Slackware packages are handled by '' | ||
+ | - Third-party packages can be managed if you use Matteo Rossini' | ||
+ | - Dependencies still have to be managed manually. | ||
+ | |||
+ | ==== Initial configuration ==== | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | < | ||
+ | # / | ||
+ | ... | ||
+ | # FRANCE (FR) | ||
+ | ftp:// | ||
+ | # http:// | ||
+ | </ | ||
+ | |||
+ | <note warning> | ||
+ | |||
+ | If you prefer managing packages locally without the benefit of updates, you can still use the Slackware installation DVD as a package source. In that case, you will have to configure the default mount point: | ||
+ | |||
+ | < | ||
+ | # / | ||
+ | ... | ||
+ | # | ||
+ | # Local CD/DVD drive | ||
+ | # | ||
+ | cdrom:// | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Don't forget to mount the DVD before calling '' | ||
+ | |||
+ | < | ||
+ | # mount /dev/cdrom /mnt/cdrom | ||
+ | </ | ||
+ | |||
+ | Update the information on available packages: | ||
+ | |||
+ | < | ||
+ | # slackpkg update | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | <note tip> | ||
+ | |||
+ | ==== Installing packages ==== | ||
+ | |||
+ | Example with a single package: | ||
+ | |||
+ | < | ||
+ | # slackpkg install mplayerplug-in | ||
+ | </ | ||
+ | |||
+ | Confirm the installation in the subsequent screen, and the package is automatically downloaded and installed. | ||
+ | |||
+ | You can also provide several packages as an argument: | ||
+ | |||
+ | < | ||
+ | # slackpkg install mplayerplug-in bittorrent | ||
+ | </ | ||
+ | |||
+ | You can also manage whole package groups: | ||
+ | |||
+ | < | ||
+ | # slackpkg install kde | ||
+ | </ | ||
+ | |||
+ | Another example for package groups: | ||
+ | |||
+ | < | ||
+ | # slackpkg install xfce | ||
+ | </ | ||
+ | |||
+ | ==== Remove packages ==== | ||
+ | |||
+ | Example with a single package: | ||
+ | |||
+ | < | ||
+ | # slackpkg remove mplayerplug-in | ||
+ | </ | ||
+ | |||
+ | As above, confirm the removal of the package in the subsequent screen. | ||
+ | |||
+ | Remove several packages at once: | ||
+ | |||
+ | < | ||
+ | # slackpkg remove mplayerplug-in bittorrent | ||
+ | </ | ||
+ | |||
+ | Likewise, you can remove a whole package group: | ||
+ | |||
+ | < | ||
+ | # slackpkg remove kde | ||
+ | </ | ||
+ | |||
+ | Or: | ||
+ | |||
+ | < | ||
+ | # slackpkg remove xfce | ||
+ | </ | ||
+ | |||
+ | ==== Upgrading packages ==== | ||
+ | |||
+ | When a package update is available, you can install it using the following command: | ||
+ | |||
+ | < | ||
+ | # slackpkg upgrade iptables | ||
+ | </ | ||
+ | |||
+ | Update several packages at once: | ||
+ | |||
+ | < | ||
+ | # slackpkg upgrade mozilla-firefox mozilla-thunderbird | ||
+ | </ | ||
+ | |||
+ | It is common practice to keep your whole system up to date: | ||
+ | |||
+ | < | ||
+ | # slackpkg upgrade-all | ||
+ | </ | ||
+ | |||
+ | ==== Search for specific packages or files ==== | ||
+ | |||
+ | Search for a specific package: | ||
+ | |||
+ | < | ||
+ | # slackpkg search k3b | ||
+ | Looking for k3b in package list. Please wait... DONE | ||
+ | The list below shows all packages with name matching " | ||
+ | [uninstalled] - k3b-2.0.2_20120226.git-i486-1 | ||
+ | </ | ||
+ | |||
+ | If the package is already installed, here's what you get: | ||
+ | |||
+ | < | ||
+ | # slackpkg search Terminal | ||
+ | Looking for Terminal in package list. Please wait... DONE | ||
+ | The list below shows all packages with name matching " | ||
+ | [ installed ] - Terminal-0.4.8-i486-1 | ||
+ | </ | ||
+ | |||
+ | You can also search for individual files. The search will eventually display on or several packages containing the file in question: | ||
+ | |||
+ | < | ||
+ | # slackpkg file-search libncurses.so | ||
+ | Looking for libncurses.so in package list. Please wait... DONE | ||
+ | The list below shows the packages that contains " | ||
+ | [ installed ] - aaa_elflibs-14.0-i486-4 | ||
+ | [ installed ] - ncurses-5.9-i486-1 | ||
+ | </ | ||
+ | |||
+ | If you want to know more about the content of a package: | ||
+ | |||
+ | < | ||
+ | # slackpkg info mesa | ||
+ | |||
+ | PACKAGE NAME: mesa-8.0.4-i486-1.txz | ||
+ | PACKAGE LOCATION: | ||
+ | PACKAGE SIZE (compressed): | ||
+ | PACKAGE SIZE (uncompressed): | ||
+ | PACKAGE DESCRIPTION: | ||
+ | mesa: mesa (a 3-D graphics library) | ||
+ | mesa: | ||
+ | mesa: Mesa is a 3-D graphics library with an API very similar to that of | ||
+ | mesa: another well-known 3-D graphics library. | ||
+ | mesa: used by X to provide both software and hardware accelerated graphics. | ||
+ | mesa: | ||
+ | mesa: Mesa was written by Brian Paul. | ||
+ | mesa: | ||
+ | </ | ||
+ | |||
+ | ==== Cleaning the system ==== | ||
+ | |||
+ | Remove all third-party packages: | ||
+ | |||
+ | < | ||
+ | # slackpkg clean-system | ||
+ | </ | ||
+ | |||
+ | If you decide to keep some of the packages, simply unselect them in the subsequent screen. | ||
+ | |||
+ | You can also use '' | ||
+ | |||
+ | < | ||
+ | # slackpkg file-search glxgears | ||
+ | Looking for glxgears in package list. Please wait... DONE | ||
+ | The list below shows the packages that contains " | ||
+ | [ installed ] - mesa-8.0.4-i486-1 | ||
+ | </ | ||
+ | |||
+ | With this information, | ||
+ | |||
+ | < | ||
+ | # slackpkg reinstall mesa | ||
+ | </ | ||
+ | |||
+ | ===== Rebuild official packages ===== | ||
+ | |||
+ | Slackware provides the entire system' | ||
+ | |||
+ | * the source code for the application or the library; | ||
+ | * its fabrication recipe in the shape of a '' | ||
+ | * the package description in a '' | ||
+ | * eventually, a post-installation script named '' | ||
+ | * various other files like patches, custom menu entries, etc. | ||
+ | |||
+ | ==== Build a package from source ==== | ||
+ | |||
+ | In the example below, we will build the '' | ||
+ | |||
+ | <note tip>The '' | ||
+ | |||
+ | < | ||
+ | # removepkg Terminal | ||
+ | </ | ||
+ | |||
+ | Choose an appropriate place on your system to store the source code and the scripts, for example: | ||
+ | |||
+ | < | ||
+ | # cd | ||
+ | # mkdir -pv source/ | ||
+ | mkdir: created directory ' | ||
+ | mkdir: created directory ' | ||
+ | # cd source/ | ||
+ | # links mirrors.slackware.com | ||
+ | </ | ||
+ | |||
+ | Fetch the content from the '' | ||
+ | |||
+ | < | ||
+ | # ls -lh | ||
+ | total 1,4M | ||
+ | -rw-r--r-- 1 root root 821 nov. 24 15:09 slack-desc | ||
+ | -rw-r--r-- 1 root root 1,4M nov. 24 15:11 Terminal-0.4.8.tar.xz | ||
+ | -rw-r--r-- 1 root root 3,6K nov. 24 15:10 Terminal.SlackBuild | ||
+ | </ | ||
+ | |||
+ | Make the '' | ||
+ | |||
+ | < | ||
+ | # chmod +x Terminal.SlackBuild | ||
+ | # ./ | ||
+ | </ | ||
+ | |||
+ | The script initiates the package compilation. If everything goes as expected, the operation exits with the following message: | ||
+ | |||
+ | < | ||
+ | Slackware package / | ||
+ | </ | ||
+ | |||
+ | Now we can install the resulting package: | ||
+ | |||
+ | < | ||
+ | # installpkg / | ||
+ | </ | ||
+ | |||
+ | ==== Modify an official Slackware package ==== | ||
+ | |||
+ | The main reason for rebuilding an official package is to modify it, for example to add or strip certain functionalities. In the following example, we will rebuild the '' | ||
+ | |||
+ | Let's begin with removing the package if it is installed: | ||
+ | |||
+ | < | ||
+ | # removepkg audacious-plugins | ||
+ | </ | ||
+ | |||
+ | Now create a suitable directory to store the source code: | ||
+ | |||
+ | < | ||
+ | # cd / | ||
+ | # mkdir audacious-plugins | ||
+ | # cd audacious-plugins | ||
+ | # links mirrors.slackware.com | ||
+ | </ | ||
+ | |||
+ | Fetch the contents of the ''/ | ||
+ | |||
+ | < | ||
+ | # chmod +x audacious-plugins.SlackBuild | ||
+ | # ls -lh | ||
+ | total 1,4M | ||
+ | -rw-r--r-- 1 root root 1,4M nov. 24 15:28 audacious-plugins-3.3.1.tar.xz | ||
+ | -rwxr-xr-x 1 root root 4,0K nov. 24 15:28 audacious-plugins.SlackBuild* | ||
+ | -rw-r--r-- 1 root root 892 nov. 24 15:28 slack-desc | ||
+ | </ | ||
+ | |||
+ | Now edit '' | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | # Configure: | ||
+ | CFLAGS=" | ||
+ | CXXFLAGS=" | ||
+ | ./configure \ | ||
+ | --prefix=/ | ||
+ | --libdir=/ | ||
+ | --sysconfdir=/ | ||
+ | --mandir=/ | ||
+ | --enable-amidiplug \ | ||
+ | --disable-gtkui \ -> add this option | ||
+ | --program-prefix= \ | ||
+ | --program-suffix= \ | ||
+ | ${ARCHOPTS} \ | ||
+ | --build=$ARCH-slackware-linux | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Build and install the package: | ||
+ | |||
+ | < | ||
+ | # ./ | ||
+ | ... | ||
+ | Slackware package / | ||
+ | # installpkg / | ||
+ | </ | ||
+ | |||
+ | ==== Choosing your configuration options for compiling ==== | ||
+ | |||
+ | The source configuration script (or more exactly the sometimes very long line in the SlackBuild beginning with '' | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | # Configure: | ||
+ | CFLAGS=" | ||
+ | CXXFLAGS=" | ||
+ | ./configure \ | ||
+ | --prefix=/ | ||
+ | --libdir=/ | ||
+ | --sysconfdir=/ | ||
+ | --mandir=/ | ||
+ | --enable-amidiplug \ | ||
+ | --program-prefix= \ | ||
+ | --program-suffix= \ | ||
+ | ${ARCHOPTS} \ | ||
+ | --build=$ARCH-slackware-linux | ||
+ | |||
+ | exit 1 -> add this option to interrupt the script | ||
+ | |||
+ | # Build and install: | ||
+ | make $NUMJOBS || make || exit 1 | ||
+ | make install DESTDIR=$PKG || exit 1 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Now run the script and wait a few seconds for the configuration overview: | ||
+ | |||
+ | < | ||
+ | # ./ | ||
+ | ... | ||
+ | Configuration: | ||
+ | | ||
+ | ... | ||
+ | |||
+ | Interfaces | ||
+ | ---------- | ||
+ | GTK (gtkui): | ||
+ | Winamp Classic (skins): | ||
+ | </ | ||
+ | |||
+ | Use the '' | ||
+ | |||
+ | < | ||
+ | # tar xvf audacious-plugins-3.3.1.tar.xz | ||
+ | # cd audacious-plugins-3.3.1 | ||
+ | # ./configure --help | less | ||
+ | ... | ||
+ | --disable-speedpitch | ||
+ | --disable-gtkui | ||
+ | --disable-skins | ||
+ | --disable-lyricwiki | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | <note tip>The SlackBuild script already takes care of automatically uncompressing the source tarball to the ''/ | ||
+ | |||
+ | < | ||
+ | |||
+ | Once you've chosen all your configuration options, get rid of the temporary '' | ||
+ | |||
+ | < | ||
+ | # ./ | ||
+ | ... | ||
+ | Slackware package / | ||
+ | # installpkg / | ||
+ | </ | ||
+ | |||
+ | ===== Building third-party packages ===== | ||
+ | |||
+ | Slackware offers only a limited choice of packages compared to behemoth distributions like Ubuntu or Debian. More often than not, you'll want to install a package that's not provided by the distribution. In that case, what can a poor boy do? | ||
+ | |||
+ | The [[http:// | ||
+ | | ||
+ | ==== Building packages using the SlackBuilds.org scripts ==== | ||
+ | |||
+ | In the following example, we will build and install the '' | ||
+ | |||
+ | For a start, '' | ||
+ | |||
+ | < | ||
+ | # cd / | ||
+ | </ | ||
+ | |||
+ | Download the following components into this directory : | ||
+ | |||
+ | - the compressed tarball containing the scripts to build the package; | ||
+ | - the compressed source code tarball. | ||
+ | |||
+ | In our case: | ||
+ | |||
+ | < | ||
+ | # links http:// | ||
+ | </ | ||
+ | |||
+ | - In the Search field in the upper left corner of the screen, type '' | ||
+ | - Follow the '' | ||
+ | - Once you're on the '' | ||
+ | |||
+ | <note tip> | ||
+ | |||
+ | Here's our two downloaded tarballs: | ||
+ | |||
+ | < | ||
+ | # ls -l cowsay* | ||
+ | -rw-r--r-- 1 root root 15136 nov. 25 08:14 cowsay-3.03.tar.gz | ||
+ | -rw-r--r-- 1 root root 2855 nov. 25 08:14 cowsay.tar.gz | ||
+ | </ | ||
+ | |||
+ | Uncompress the tarball containing the scripts: | ||
+ | |||
+ | < | ||
+ | # tar xvzf cowsay.tar.gz | ||
+ | cowsay/ | ||
+ | cowsay/ | ||
+ | cowsay/ | ||
+ | cowsay/ | ||
+ | cowsay/ | ||
+ | cowsay/ | ||
+ | </ | ||
+ | |||
+ | Eventually, you can do a little cleanup and delete the tarball: | ||
+ | |||
+ | < | ||
+ | # rm -f cowsay.tar.gz | ||
+ | </ | ||
+ | |||
+ | Now move the source tarball to the newly created '' | ||
+ | |||
+ | < | ||
+ | # mv -v cowsay-3.03.tar.gz cowsay/ | ||
+ | « cowsay-3.03.tar.gz » -> « cowsay/ | ||
+ | </ | ||
+ | |||
+ | Here's what we have: | ||
+ | |||
+ | < | ||
+ | # tree cowsay | ||
+ | cowsay | ||
+ | |-- cowsay-3.03.tar.gz | ||
+ | |-- cowsay.info | ||
+ | |-- cowsay.SlackBuild | ||
+ | |-- cowsay.SlackBuild.patch | ||
+ | |-- README | ||
+ | `-- slack-desc | ||
+ | </ | ||
+ | |||
+ | Now '' | ||
+ | |||
+ | < | ||
+ | # cd cowsay/ | ||
+ | # ls -l cowsay.SlackBuild | ||
+ | -rwxr-xr-x 1 kikinovak users 1475 mai | ||
+ | # ./ | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | If everything goes well, the process spews out a package in ''/ | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | Slackware package / | ||
+ | </ | ||
+ | |||
+ | All that's left to do is install the package using '' | ||
+ | |||
+ | < | ||
+ | # installpkg / | ||
+ | # cowsay Hi there ! | ||
+ | | ||
+ | < Hi there ! > | ||
+ | | ||
+ | \ ^__^ | ||
+ | | ||
+ | (__)\ )\/\ | ||
+ | ||----w | | ||
+ | || || | ||
+ | </ | ||
+ | |||
+ | ==== Managing package dependencies ==== | ||
+ | |||
+ | Some packages require the presence of other packages, either to build (//build dependencies// | ||
+ | |||
+ | To take an example, let's have a look at the '' | ||
+ | |||
+ | < | ||
+ | This requires: libgnomecups. | ||
+ | </ | ||
+ | |||
+ | Moreover, every script tarball contains an '' | ||
+ | |||
+ | < | ||
+ | PRGNAM=" | ||
+ | VERSION=" | ||
+ | HOMEPAGE=" | ||
+ | ... | ||
+ | REQUIRES=" | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | This simply means that before we build the '' | ||
+ | |||
+ | Besides strictly required dependencies, | ||
+ | |||
+ | |||
+ | **WORK IN PROGRESS** | ||
====== Sources ====== | ====== Sources ====== | ||
- | < | + | |
+ | | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
<!-- You must also remove the tag-word " | <!-- You must also remove the tag-word " | ||
- | {{tag> | + | {{tag> |