Sunday, 30 August 2015

Create Local Repository - Solaris 11.2

Image packaging system(IPS) and important concept from Solaris 11 onwards. I would like to create local repository on the local system by downloading the files from the Oracle website using oracle's automated script.

Download below files and copy to your local Solaris server.
Below are the files copied on my local Solaris server. 

root@solnode1:/var/share/pkg# pwd
/var/share/pkg
root@solnode1:/var/share/pkg# ls -l
total 14373953
-rwx------   1 root     root        5594 Aug 29 20:52 install-repo.ksh
drwxr-xr-x   3 pkg5srv  pkg5srv        7 Aug 30 08:42 repositories
-rw-r--r--   1 root     root     1771800121 Aug 29 15:32 sol-11_2-repo-1of4.zip
-rw-r--r--   1 root     root     1889867782 Aug 29 15:35 sol-11_2-repo-2of4.zip
-rw-r--r--   1 root     root     1902167161 Aug 29 16:46 sol-11_2-repo-3of4.zip
-rw-r--r--   1 root     root     1790358735 Aug 29 16:44 sol-11_2-repo-4of4.zip
-rw-r--r--   1 root     root         227 Aug 29 16:14 sol-11_2-repo-md5sums.txt
root@solnode1:/var/share/pkg#

root@solnode1:/var/share/pkg#./install-repo.ksh -d /var/share/pkg/repositories/ -v -c

The script would compare the checksums of the downloaded files, uncompress and would initiate the repository creation. 

your current publisher would be pointing to "pkg.oracle.com" and it needs to be changed to your local repository. 

root@solnode1:~# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F http://pkg.oracle.com/solaris/release/
root@solnode1:~#

root@solnode1:~# pkg set-publisher -G '*' -M '*' -g file:///var/share/pkg/repositories solaris
root@solnode1:~#

root@solnode1:~# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F file:///var/share/pkg/repositories/
root@solnode1:~#

To enable clients to access the local repository via HTTP, enable the application/pkg/server Service Management Facility (SMF) service.

root@solnode1:~# svccfg -s application/pkg/server setprop pkg/inst_root=/var/share/pkg/repositories
root@solnode1:~# 

check does repos work
root@solnode1:~# svcprop -p pkg/inst_root application/pkg/server
/var/share/pkg/repositories
root@solnode1:~#

Reload the pkg.depotd repository service.

root@solnode1:~# svcadm refresh application/pkg/server
root@solnode1:~#

we had successfully created solaris 11.2 local repository.