Tuesday, 28 February 2012

Solaris [SunOS] - Installing and Managing packages using the package manager

Managing packages with Solaris is easy with pkg utilities... The post discusses the basics in adding, removing and querying packages on a Solaris system.

Finding out details of installed packages

Code Snippet
  1. pkginfo | grep python
End of Code Snippet

pkginfo will display a list of all packages managed by the package manager. By searching for 'python', this gives us it's package name: SMCpython... and tells us its an application.

application SMCpython python

Obtaining Packages

1. Firstly find out your processor type and your Solaris/SunOS version.

Code Snippet
  1. uname -a
End of Code Snippet

SunOS servername 5.9 Generic_117171-07 sun4u sparc SUNW,Sun-Fire-V440

This tells me that im running SunOS 5.9 (Solaris v9) and using the SPARC processor type.

2. You can optionally use pkg-get or pkgutil to automatically download and install packages (This will also automatically download package dependencies). See my blog post on how to take this option!

3. Downloading packages manually (like a boss - also if its a server/system that does not have internet access). Find and download the appropriate package from one of these mirror sites using your Solaris version and processor type from step 1...

Package Download Websites

Installing Packages

Once you have obtained a package to install, you will have a file similar to this: 'gcc-3.4.6-sol9-sparc-local'. We can then use the pkgadd utility to install the package into the system. You will be warned if the package has any dependencies (in which case, you will need to install these first). The following example will install version 3.4.6 of the GCC compiler for Solaris 9 [SPARC processor]...

Code Snippet
  1. pkgadd -d gcc-3.4.6-sol9-sparc-local
End of Code Snippet

Removing Packages

Packages can be removed using the pkgrm utility, alongside the name of the package. To get the name of the package, you will need to use pkginfo...

Code Snippet
  1. pkginfo | grep gcc
End of Code Snippet

This gives...
application SMCgcc gcc

We can then use pkgrm on the package name SMCgcc

Code Snippet
  1. pkgrm SMCgcc
End of Code Snippet

Check which package owns a file

If you would like to find out which package owns a file on your system, then you can run the following command...

Code Snippet
  1. pkgchk -l -p /usr/local/lib/python2.6/genericpath.pyc
End of Code Snippet

Pathname: /usr/local/lib/python2.6/genericpath.pyc
Type: regular file
Expected mode: 0644
Expected owner: root
Expected group: bin
Expected file size (bytes): 3332
Expected sum(1) of contents: 54794
Expected last modification: Sep 09 12:02:14 2009
Referenced by the following packages:
Current status: installed

Creating Solaris Packages
Here are a couple of good guides on creating packages for Solaris...



Solaris Package Cheatsheet

No comments: