Querying IPS packages
Often you want to install some package in OpenSolaris but you don't know its name. It happens to me almost all the time - I know the binary I need (e.g. javac) but I have no idea in which package to find it. Honestly, the package names in OpenSolaris are not very easy to guess and right now I don't know about an online repository where to search for packages according to their contents (like I would use in case of Linux).
However there is a way how to search for a package according to its contents right from OpenSolaris - you don't even need to open a web browser! Just run the following command:
$ pkg search -r [filename]
For example if you want to find the name of the package which contains the "whereis" binary, just run:
$ pkg search -r whereis
You get a list of all packages that contain the "whereis" file or folder. This is what you get when searching for whereis:
roman@opensolaris:~$ pkg search -r whereis
INDEX ACTION VALUE PACKAGE
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.79
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.86
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.86
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.75
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.89
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.90
basename file usr/ucb/whereis pkg:/SUNWscp@0.5.11-0.91
To install the latest version of the package you can simply run now
$ pfexec pkg install SUNWscp
If you want to request a specific version, run the install command with full IPS package name, e.g.:
$ pfexec pkg install pkg:/SUNWscp@0.5.11-0.91
You will sometimes see multiple packages - e.g. in case of Apache there are these packages available in the main IPS repository: SUNWapch, SUNWapch2 and SUNWapch22.
To find out more about any of the packages (is it installed? which version? where does it come from? how big is it? etc.), you can run:
$ pkg info [package name]
To query the remote package repositories, you can use the -r option again:
$ pkg info -r [package name]
Here's an example - I can verify whether the SUNWscp package has been installed:
roman@opensolaris:~$ pfexec pkg info SUNWscp
Name: SUNWscp
Summary: Source Compatibility
State: Installed
Authority: opensolaris.org (preferred)
Version: 0.5.11
Build Release: 5.11
Branch: 0.91
Packaging Date: Fri Jun 13 18:00:49 2008
Size: 1.2 MB
FMRI: pkg:/SUNWscp@0.5.11,5.11-0.91:20080613T180049Z
Finally you can also search
packages on your disk or use pkg info for local packages by using the following command:
$ pkg search -l [filename]
$ pkg info -l [package name]
So the -l parameter is used for local repository queries, which is very useful if you want to find out more about packages installed on your disk.
Is there any way to search in package description and not only in file names (as apt-cache search do it in Ubuntu)?
Eg:
pkg search -r glassfish
and not only
pkg search -r asadmin
Posted by e2 on June 26, 2008 at 10:33 AM GMT #
It might be possible using "pkg contents" and grep... even though this is probably not the most optimal way. I'll try to find out.
Posted by Roman Strobl on June 26, 2008 at 10:52 AM GMT #
I just found a response on the forums:
"Actually, right now you can't search for package name or description.
That's being fixed as we speak, so the capabilities will be there soon."
Posted by Roman Strobl on June 26, 2008 at 10:56 AM GMT #