puflogh300X74.gif

Polarwave's OpenBSD
Tips and Tricks for Newbies

| Packages |

| Home | Tips and Tricks | Links | News Feeds | Fun | Contact | Blog (Opens in New Page) |


Packages

Working With Packages

I normally try to install packages whenever possible. Sometimes there's a special need that can only be addressed by installing a port with some special make options on it, but in most cases, packages do just fine. I quote an excerpt from 15.1 - Introduction:

Another advantage is that users rarely need to compile software from source,
as packages have already been compiled and are available and ready to be used
on an OpenBSD system. In minutes, a large number of packages can be fetched
and installed, with everything in the right place.
I have to confess I've been lazy and am still running OpenBSD 4.1, but with all applicable security patches applied. So, in ~/.profile, my package path looks like this:
PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/
And, below that, in my export line, I've tacked PKG_PATH onto the end of the line:
export PATH HOME TERM PS1 CVSROOT EDITOR FCEDIT JAVA_HOME PKG_PATH
If you don't have a PKG_PATH value set in the environment, then you should be a good typist, since you'll have to type the entire path to the package you want to install. Here's an example of what it'd look like:
sudo pkg_add -v ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/screen-4.0.3p0.tgz
I don't know about you, but that's more typing than I want to do if I don't have to. I do an awful lot of work already in terminal windows as it is, since that's the way I learned early on, rather than a GUI interface, and it's become an ingrained habit.

Above I used an exact package name, but sometimes you might choose not to do that. In such cases, it'll pay you to use the -i switch on pkg_add since, if it finds more than one package with the same root in the name, it'll stop. In interactive mode, it'll show you your choices. You can then make your choice and continue on with the install.

Now, sometime later, perhaps I no longer want the screen package installed on my system. To uninstall, I would do this:
sudo pkg_delete screen
After you've installed and uninstalled lots of packages over a period of time, it can get confusing, trying to figure out exactly when something was installed. This happens because everytime a package is installed, the files and directories in /var/db/pkg are "touched" , effectively changing their dates to the same as when the last package that used them as dependencies was installed. To find the date on an installed package, you can do this:
ls -l /var/db/pkg/<your package name here>
As stated above, the date you see using the ls method can be misleading. The date of the package's directory will probably correspond with a file inside the directory named +REQUIRED. That right there can tell you when it was "touched" last while installing another package that needed it as a dependency. Another way to tell when it was last "touched" is:
stat -f"%Sc" /var/db/pkg/<your package name here>
That should give you the last change time of the inode.

Sometimes packages install documentation besides the man pages. Want to find out what got installed and where it all is?
pkg_info -L <your package name here>
That command will tell you. Everything I've written here is just to help you get started quickly. As is preached incessantly on the mailing lists and in the forums, and, rightfully so, READ, READ, READ! Read the faqs, read the man pages, read any other accompanying documentaion you can find on a subject before running for help. I've found when I do this, I tend to remember things a lot better and am more capable of maintaining my operating on my own, than if someone just sent the answer to me and "fixed" everything for me.

Back to Tips and Tricks
Home

Delicious Bookmark this on Delicious

No affiliation between this site and the OpenBSD project exists or is implied.

valid-html401.png