A
repository is a location where the clients publish and retrieve
packages. There are two ways to obtain copy of Oracle Solaris 11.1
IPS (Image Packaging System) repository image, one method is to
download the repository image from the Oracle
Solaris 11 Website, create a local repository and the second
method is to retrieve the repository directly from the internet. Here
we dont have internet, hence we will go with creating a local
repository.
Concatenate
the downloaded repository files “sol-11_1-repo-full.iso-a” and
“sol-11_1-repo-full.iso-b” to “sol-11_1-repo-full.iso”.
Execute the below command to do the same.
huser@nn:~$
cat sol-11_1-repo-full.iso-a sol-11_1-repo-full.iso-b >
sol-11_1-repo-full.iso
Mount
the repository iso image to /mnt directory.
huser@nn:~$
sudo lofiadm -a /mnt/sf_ISOs/sol-11_1-repo-full.iso
huser@nn:~$
lofiadm
Specify
the lofiadm device from the “lofiadm” command output to mount the
image.
huser@nn:~$
sudo mount -F hsfs /dev/lofi/1 /mnt
Now
we will create a zfs dataset for package repository. We have disabled
atime to improve the performance during repo updates and enabled
compression.
huser@nn:~$
sudo zfs create -o mountpoint=/SoLoRepo/ -o atime=off -o
compression=on rpool/SoLoRepo
Copy
and synchronize all the files in the repository to the mountpoint we
created for the repository using “rsync”.
huser@nn:~$
sudo rsync -aPvz /temp/ /SoLoRepo/
Next
we will configure the web interface for the clients to access the
repository. The “svc:/application/pkg/server” is a depot server
for IPS. We will use port 8080 to listen to request from clients to
access data contained on package repository. The
“/application/pkg/server” is not enabled by default in a fresh
Solaris 11 installation.
To
enable clients to access the local repository via HTTP, let’s
configure and enable the “svc:/application/pkg/server” using SMF
service. We will configure three properties namely “inst_root” to
specify the repository directory, default is /var/pkg/repo;
“readonly” and “port”.
huser@nn:~$
sudo svccfg -s application/pkg/server setprop
pkg/inst_root=/SoLoRepo/repo/
huser@nn:~$
sudo svccfg -s application/pkg/server setprop pkg/readonly=true
huser@nn:~$
sudo svccfg -s application/pkg/server setprop pkg/port=8080
To
confirm the value of properties, use the below command.
huser@nn:~$ svccfg -s pkg/server listprop | egrep "inst_root|readonly|port"
Refresh
and enable the “application/pkg/server” service
huser@nn:~$
sudo svcadm -v refresh application/pkg/server
huser@nn:~$
sudo svcadm -v enable application/pkg/server
To
confirm the above activity, execute the below command.
huser@nn:~$
svcs application/pkg/server
Set
the publisher to get the packages from local repository
huser@nn:~$
sudo pkg set-publisher -P -g /SoLoRepo/repo/ solaris
huser@nn:~$
sudo pkg set-publisher -g http://nn:8080 solaris
huser@nn:~$
pkg publisher
Verifying
the port
huser@nn:~$
netstat -an | grep 8080
*.8080
*.* 0 0 128000 0 LISTEN
huser@nn:~$
Access
to repository can be tested using a browser, pointing to
http://nn:8080
Everything
being set we will unmount the /temp directory and delete the lofi
device.
Unmount
the /temp directory and delete the lofi device.
huser@nn:~$
umount /mnt
huser@nn:~$
lofiadm -d /dev/lofi/1
We
will try installing terminator (I will need it later) package using
our local repository to test it.
Finally,
our Oracle Solaris 11.1 local repository has been created, up and
running using SMF, and is made available using HTTP and local ZFS.
Well written ..
ReplyDeletehttp://www.ananyatales.com/