MESSAGE
DATE | 2004-05-14 |
FROM | From: "Inker, Evan"
|
SUBJECT | Subject: [hangout] Help File Library: Slackware: The Quick and Dirty Quide to Packag es
|
Help File Library: Slackware: The Quick and Dirty Quide to Packages http://www.justlinux.com/nhf/Distribution_Specific/Slackware_Linux/Slackware __The_Quick_and_Dirty_Quide_to_Packages.html
Written By: X_console
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:
explodpkg hdsetup.tgz cp sbin/upgradepkg /sbin 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:
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:
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:
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:
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:
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:
create a directory tree copy all the files related to the package into the appropriate directories in the directory tree. 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:
cd /slackpack 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:
./configure --prefix=/slackpack make 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.
**************************************************************************** This message contains confidential information and is intended only for the individual or entity named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as an invitation or offer to buy or sell any securities or related financial instruments. GAM operates in many jurisdictions and is regulated or licensed in those jurisdictions as required. ****************************************************************************
____________________________ NYLXS: New Yorker Free Software Users Scene Fair Use - because it's either fair use or useless.... NYLXS is a trademark of NYLXS, Inc
|
|