linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:40:00 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info
THE QUICK AND DIRTY GUIDE TO SLACKWARE PACKAGES: VERSION 1.0
Slackware Linux makes use of Slackware packages for easy installation, and removal of user installed software. Slackware packages have a .tgz extension and can be obtained from the Slackware home site at http://www.slackware.com, as well as various other FTP sites that have them. Slackware packages contain binary files, meaning that there is no need to build the software from source. This will be, as the title says, a quick and dirty guide. I will explain the tools that the you will most likely use to install, remove, and create Slackware packages. I will not go into detail however, of the many options available in the tools we will be using. I think the manual pages for them are easy enough to read, and you probably will not be using all the options anyway.

THE TOOLS
The following are the tools you will most likely be using to deal with manipulating Slackware packages:

  • pkgtool
  • installpkg
  • removepkg
  • upgradepkg
  • makepkg
  • explodepkg

We will be covering the basics of using these tools. Check your system to make sure you have them. Older versions of Slackware may not have upgradepkg in them. At this time of writing, it is available at the Slackware homesite as hdsetup.tgz. If you do not have upgradepkg in your system, download it and do the following:

root# explodpkg hdsetup.tgz
root# cp sbin/upgradepkg /sbin
root# cp usr/man/man8/upgradepkg.8.gz /usr/man/man8

The following sections will now explain what each tool is used for, and how they are used.

pkgtool
pkgtool is a graphical program that allows you to manipulate the installation and removal of Slackware packages. It carries a few command line options used during the initial Slackware Linux setup. You will not need to use these command line options. pkgtool is easy enough to use. There are six menu options available in the main menu, with a short description of what each option does. I think this is easy enough to understand and requires no explanation. The one option you may be interested in is the View option. This option allows you to view the contents of a package, as well as a description of what the package does and/or contains.

installpkg
installpkg installs Slackware packages just like pkgtool does, except it does it on the fly without you needing to choose from menus. The basic usage command is:

root# installpkg foo.tgz

This command will install foo.tgz into your system. However, newer files in the package will overwrite older files existing on your system. You will want to make note of what files will be installed on your system. This can be done by passing the -warn option. With the -warn option, installpkg will generate a report on what files will be installed, and you can then cross-reference to see if you have any existing files already on your system. Here's a short example:

root# installpkg -warn foo.tgz
Scanning the contents of foo.tgz...

The following files will be overwritten when installing this package.
Be sure they aren't important before you install this package:

-rwxr-xr-x root/root       1242 1999-06-05 12:34 usr/local/bin/foo
-rw-r--r-- root/root        120 1999-06-05 12:34 usr/local/etc/foorc
You've been warned.

I recommend that you always use the -warn option before installing any package. Once you are sure you know what is being installed, you can go ahead and install the package.

removepkg
removepkg removes an already installed package on the system. Like installpkg, this feature is also available by using pkgtool, except that this is run without a menu interface. removepkg needs to be used in the /var/log/packages directory. The syntax is:

root# removepkg foo

You need to be careful when using removepkg as it may delete a file you wanted to keep. You will want to use the -warn option with removepkg before actually removing a package. This can be done as follows:

root# removepkg -warn foo
Only warning... not actually removing any files.
Here's what would be removed (and left behind) if you
removed the package(s):

  --> /usr/local/bin/foo
  --> /usr/local/etc/foorc

Be sure you use the -warn option all the time before removing a package. Removing the wrong package will cause you uncessesary headaches. Know what you are removing before you remove it.

upgradepkg
upgradepkg will upgrade an already existing package installed in your system. It does this by first installing the new package, and then removing any files from the old package that are not in the new package. Keep that in mind! If you need to keep any configuration files from the old package, be sure to back them up. upgradepkg works in two ways. If you have installed package foo.tgz and you want to upgrade it, and the new package is called foo.tgz, then the command to upgrade is:

root# upgradepkg foo.tgz

Otherwise, if you installed the package foo.tgz and the upgraded package is foo-2.0.tgz, then the command to upgrade is:

root# upgradepkg foo.tgz%foo-2.0.tgz

Notice the "%" symbol seperating both package names. This syntax is used when the upgraded package has a different name from the currently installed package. If the old and new packages both have the same name, just use the first example's syntax.

makepkg
makepkg is used to create Slackware specific packages. In order to create a Slackware package, you will need to have the binary files for the package you want to create. Obviously this means you will need to either have the binary files already available in your system, or you will have to build the binary files from the source files. Here are the steps you need to follow to create a Slackware package:

  1. create a directory tree
  2. copy all the files related to the package into the appropriate directories in the directory tree.
  3. run makepkg to create the Slackware package.

I would advice you to create a directory where you will keep your Slackware packages. For instance, something like /slackpack. This is where you will create your directory tree. /slackpack will simple contain the location on where the files in the package you are creating will be installed. For instance, foo.tgz will install the binary file foo in /usr/local/bin and a configuration file foorc in /usr/local/etc. Therefore, /slackpack will contain the following directories:

  • /slackpack/usr/local/bin
  • /slackpack/usr/local/etc

Understand? If not, look at it again and you will. The next step is to copy all the files to the directory tree. So in this case, there are only two files to foo.tgz, and they are foo and foorc. We then copy the files to where they will be installed, in this case, /usr/local/bin and /usr/local/etc respectively. When that is done with, we do the following:

root# cd /slackpack
root# makepkg foo.tgz

This will create a package called foo.tgz which contains the files foo and foorc which will be installed in /usr/local/bin and /usr/local/etc respectively.

As you can probably see, you will need to hunt around for the files and then to copy them to the created directory tree. An easier way to do this would be to build the package from source, and then have the built binaries installed into the directory tree. For instance, we have downloaded a source package called foo.tar.gz. We have already created a directory /slackpack it is currently empty. The first thing to do is to unpack the source file and then to build the source:

root# ./configure --prefix=/slackpack
root# make
root# make install

The line ./configure --prefix=/slackpack will cause make install to install all packages into /slackpack while at the same time, building the directory tree for you. So when you are done, just cd to /slackpack and run makepkg from within it, and it will automatically build the package for you. If the source package you build does not support the ./configure stage, then you will have to build and find out where the files will be installed in. Fortunately, most major source packages will require you to make use of the ./configure stage.

When you run makepkg two things will happen. First it will check to see if there are any symbolic links in the package you are creating. If there are, makepkg will recommend that a script be made and that all symbolic links are deleted. Do it if you want to. Secondly, it will as you if you want to change the permissions of the files to 755 and changing all ownerships to root. Unless some of the files need to retain special permissions for whatever reasons, go ahead and say yes to this question. Once you have finished all of these steps, your Slackware package is ready.

explodepkg
explodepkg is used to extract the contents of a package to the current directory. This is used mostly with makepkg. Basically if after you make a package, and then decide to make modifications to it, you can use explodepkg to unpack the package, modify it, and then rebuild it with makepkg.

CONCLUSION
As you have seen, the Slackware package managing system is extremely simple to understand and to use. It is advisable that you learn how to use it, and to create Slackware packages after building the binaries from the source package. It will be easier to keep track of them and to upgrade and uninstall them in future.

X_console shellscope@yahoo.com

   
We would like to hear your feedback.  

 

[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif