Introduction
There are many applications one might want to use on an OpenBSD system.
To make this software easier to install and manage, it is ported
to OpenBSD and packaged.
The aim of the package system is to keep track of which software gets
installed, so that it may be easily updated or removed.
In minutes, a large number of packages can be fetched and installed, with
everything put in the right place.
The ports collection does not go through the same thorough security
audit that is performed on the OpenBSD base system.
Although we strive to keep the quality of the packages high, we just do not
have enough resources to ensure the same level of robustness and security.
The OpenBSD ports team considers packages to be the goal of their porting
work, not the ports themselves.
In general, you are advised to use packages over building an application
from ports.
Packages can be easily managed with the help of several utilities:
- pkg_add(1)
- for installing and updating packages
- pkg_check(8)
- for checking the consistency of installed packages
- pkg_delete(1)
- for removing installed packages
- pkg_info(1)
- for displaying information about packages
In order to run properly, application X may require that other applications
Y and Z be installed.
Application X is said to be dependent on these other applications, which is
why Y and Z are called dependencies of X.
In turn, Y may require other applications P and Q, and Z may require
application R to function properly.
This way, a whole dependency tree is formed.
Packages look like simple .tgz
bundles.
Basically they are just that, but there is one crucial difference:
they contain some extra packing information.
This information is used by
pkg_add(1) for several purposes:
- Different checks: has the package already been installed, or does it
conflict with other installed packages or file names?
- Dependencies which are not yet present on the system are automatically
fetched and installed before proceeding with the installation of the
package.
- Information about the package(s) is recorded in a central repository,
located in
/var/db/pkg
by default.
This will, among other things, prevent the dependencies of a package
from being deleted before the package itself has been deleted.
This helps ensure that an application cannot be accidentally broken
by a careless user.
Selecting a Mirror
There are two places pkg_add(1)
will look for packages:
the installurl(5) file
(/etc/installurl
) or the PKG_PATH
environment
variable.
The former is the preferred method and is configured by default on new
installations.
If the use of multiple mirrors is needed, PKG_PATH
allows this
via a colon-separated list:
# export PKG_PATH=scp://user@company-build-server/usr/ports/packages/%a/all:https://trusted-public-server/%m:installpath
While the default should work well for most people, a list of alternate
locations can be found on the mirrors page.
Finding Packages
A large collection of pre-compiled packages is available for the most common
architectures.
To search for any given package name, use the -aQ
flags of
pkg_info(1).
$ pkg_info -aQ unzip
lunzip-1.14p0
unzip-6.0p17
unzip-6.0p17-iconv
Another way to find what you're looking for is with the pkg_locate
command, available from the pkglocatedb
package.
$ pkg_locate mutool
mupdf-1.24.9-js:textproc/mupdf,js:/usr/local/bin/mutool
mupdf-1.24.9-js:textproc/mupdf,js:/usr/local/man/man1/mutool.1
mupdf-1.24.9:textproc/mupdf:/usr/local/bin/mutool
mupdf-1.24.9:textproc/mupdf:/usr/local/man/man1/mutool.1
If you're looking for a specific filename, it can be used to find which
package(s) contain that file.
You will notice that certain packages are available in a few different
varieties.
These are called flavors.
The ports FAQ explains flavors
in detail, but it basically means they're configured with different sets
of options.
For example, a package might have optional database support, support for
systems without X11, etc.
Some packages are also divided into subpackages that may be
installed separately.
Not all possible packages are necessarily available on the mirror servers.
Some applications simply don't work on all architectures.
Some applications cannot be distributed via mirrors for licensing reasons.
Installing Packages
The pkg_add(1) utility is used
to install packages.
If multiple flavors of a package exist, you will be prompted to choose which
one you want to install.
# pkg_add rsync
Ambiguous: choose package for rsync
a 0: <None>
1: rsync-3.3.0p2
2: rsync-3.3.0p2-minimal
Your choice:
Here you would select 1 if you want the standard package or 2
if you need iconv support.
You can also choose the flavor directly on the command line by using
pkg_add rsync--
(for the default) or
pkg_add rsync--iconv
(for the iconv flavor).
It is possible to specify multiple package names on one line, which then
all get installed at once, along with their dependencies.
You may also specify the absolute location of a package, be it a local
file or remote URL.
Supported URL prefixes are http, https, ftp and scp.
For some packages, important additional information will be given about
the configuration or use of the application.
# pkg_add jove
jove-4.16.0.73p1: ok
--- +jove-4.16.0.73p1 -------------------
See /usr/local/share/jove/README about changes to /etc/rc or
/etc/rc.local so that the system recovers jove files
on reboot after a system crash
Additionally, some packages provide configuration and other information
in a file located in /usr/local/share/doc/pkg-readmes
.
For your safety, if you are installing a package which you had installed
earlier and removed, configuration files which have been modified will
not be overwritten.
The same is true for when you update a package.
Sometimes you may encounter an error like the one in the following example:
# pkg_add xv
xv-3.10ap4:jpeg-6bp3: ok
xv-3.10ap4:png-1.2.14p0: ok
xv-3.10ap4:tiff-3.8.2p0: ok
Can't install xv-3.10ap15 because of libraries
|library X11.16.1 not found
| not found anywhere
Direct dependencies for xv-3.10ap15 resolve to png-1.6.31 jasper-1.900.1p5 tiff-4.0.8p1 jpeg-1.5.1p0v0
Full dependency tree is png-1.6.31 tiff-4.0.8p1 jasper-1.900.1p5 jpeg-1.5.1p0v0
The packing information bundled in the package includes information
about shared libraries that the package expects to be installed.
If one of the required libraries can't be found, the package is not
installed because it would not function anyway.
There are several things to check:
- Your system may be incomplete: you did not install one of the
file sets that contains the required
library.
- Your system (or packages) may be outdated: you have an older version
of the required library.
Make sure that both the base system and any installed packages are up to date.
- If you're running -current, base and package snapshots may be slightly
out of sync.
Wait for the mirrors to catch up and try again.
Updating Packages
Installed packages can be updated with
pkg_add(1) like so:
# pkg_add -u
This will attempt to update all installed packages, including their
dependencies.
Removing Packages
To remove a package, simply use
pkg_delete(1):
# pkg_delete screen
Again, modified configuration files will not be removed.
Dependencies that are no longer needed can afterwards be removed with the
-a
flag:
# pkg_delete -a
Duplicating Installed Packages on Another Machine
Installing a new OpenBSD system with the same set of packages as an older
machine is a fairly common use case.
The -mz
flags of
pkg_info(1) will yield
appropriate results to make this task easier.
- The
-m
flag only selects packages that were manually
installed.
Dependencies are not recorded, as they're pulled in automatically.
- The
-z
flag excludes version information from the output.
Only the flavor and branch are displayed, ensuring that future package
installations will select the appropriate version.
For instance:
$ pkg_info -mz | tee list
abcde--
mpv--
python--%3.6
vim--no_x11
Copy the "list" file over to the other machine and run:
# pkg_add -l list
Every package specification has a flavor (--
being the default)
appended to its name, and packages that co-exist in several versions also
have branch information.
In this case, subsequent
pkg_add(1) commands will select
the current python package of the 3.6
version branch.
Incomplete Package Installation or Removal
In some odd cases, you may find a package was not added completely,
due to conflicts with other files.
The incomplete installation is usually marked with "partial-" prepended to
the package name.
This can, for instance, happen when you coincidentally press CTRL+C during
installation.
The installation can be later completed, and the "partial-*" package will
disappear, or it can be removed with
pkg_delete(8).
More dire system failures, such as file system issues, may
lead to /var/db/pkg
becoming corrupted or inconsistent.
The pkg_check(8) utility can
help clean things up.
¡®Yes, sir. I felt sure you understood that. She said she had told you.¡¯ "Why, eh,--I--I don't know that my movements need have anything to do with his. Yours, of course,--" "Ah, but if it saved your life!" "No, I'm not," grumbled the Doctor, "I've had enough of this wild-goose chase. And besides, it's nearly dinner time." "I am coming to that," Lawrence said, lighting a fresh cigarette. "As soon as Bruce was in trouble and the plot began to reel off I saw that it was mine. Of course there were large varyings in the details, but the scheme was mine. It was even laid on the same spot as my skeleton story. When I grasped that, I knew quite well that somebody must have stolen my plot." Judy In a coach-house, through which we passed on our way to see the prince's favourite horses with the state carriages¡ªquite commonplace and comfortable, and made at Palitana¡ªwas a chigram,[Pg 68] off which its silk cover was lifted; it was painted bright red and spangled with twinkling copper nails. This carriage, which is hermetically closed when the Ranee goes out in it, was lined with cloth-of-gold patterned with Gohel Sheri's initials within a horseshoe: a little hand-glass on one of the cushions, two boxes of chased silver, the curtains and hangings redolent of otto of roses. "Are you certain of it? You have seen so very little of him, and you may be mistaken." "And your wife?" "I drawed on my man's bundle o' wood," said Gid, "and then dropped a little, so's to git him where he was biggest and make sure o' him." HoME²¨¶àÒ°½áÒÂ×óÏßÊÓÆµ
ENTER NUMBET 0016gzzzyc.org.cn
www.hwaall.net.cn
www.lysc0311.org.cn
fsgbxj.com.cn
jnihfs.com.cn
sjmqwk.com.cn
shqb.net.cn
trchain.com.cn
rychain.com.cn
www.xfj119.com.cn