How to create package in Solaris

For this example I will be use apache web server, compiled from source and created as package

Create directory structure for package. For me /usr/src sound's good, but you can do it using your home directory
 

# cd /usr/src
# mkdir RTNapache InfoPath

Create in InfoPath directory file pkginfo with content
 

ARCH=i386
CATEGORY=application
NAME=Apache httpd server
PKG=RTNapache
VERSION=2.2.4
DESC=The Apache Project is a collaborative software development effort 
aimed at creating a robust, commercial-grade, featureful, and 
freely-available source code implementation of an HTTP (Web) server.
VENDOR=Apache License Version 2.0, January 2004 http://www.apache.org/licenses/


- ARCH is architecture you build this package. Can be sparc, i386 or ppc
- CATEGORY describe with keywords in which category is the package
- NAME define brief name of our package
- PKG is the name of package. Here is interest the fact 1st 4 letters should be unique
- VERSION is the version of package. In this case this is the version of Apache httpd server
- DESC is extensive text about the package
- VENDOR describe the copyright of the package



Configure, compile and install the software on original place
 

# ./configure --prefix=/opt/RTNapache --enable-so –enable-mods-shared=most
# make
# make install
# cd /opt/RTNapache/
# mv  * /usr/src/RTNapache/
# cd ..
# rmdir RTNapache

Do some changes to be sure server will work fine
 

Change index.html in /usr/src/RTNapache/htdocs to represent the situation with compiled software
Change in /usr/src/RTNapache/conf/httpd.conf: 
- comment ServerAdmin line
- set ErrorLog to be /var/adm/httpd because /opt is not the proper place for log files
- set CustomLog to be /var/adm/httpd (same reason as above)
Change permition of /usr/src/RTNapache/htdocs to be 755 to let user daemon to read web server content
Change ownership of /usr/src/RTNapache to be root:root

Create in InfoPath directory file, named prototype. To make it by hand is very hard, so we will use tool, named pkgproto executing
 

# pkgproto ./RTNapache > InfoFiles/prototype

Add record to prototype file for creation of /var/adm/httpd directory
 

# echo "d none /var/adm/httpd 0644 root root" >> InfoFiles/prototype

Add record to prototype file with information about pkginfo file
 

# echo "i pkginfo=/usr/src/InfoFiles/pkginfo" >>InfoFiles/prototype

Create the package
 

#  pkgmk -f InfoFiles/prototype -b /usr/src

Let's get little info about this new package
 

# cd /var/spool/pkg
# pkginfo -d .
application RTNapache Apache httpd server

Now in directory /var/spool/pkg we get our package and we can pack it as tar, transfer somewhere and install

No comments:

Post a Comment

Compressed tar archive

There are some cases when you want to create compressed tar archive but you do not have enough disk space to keep original files and tar arc...