In Solaris, you use the pkgadd command to install new packages.
By default, the pkgadd command reads the default admin file /var/sadm/install/admin/default which specifies the base directory to be /opt.
There might be times where you want to specify a different base directory. One such example is if you have the /opt directory mapped to a network storage and only want to install the package locally.
To change the default base directory, the best practice is to create a new file in the same directory as the default admin file.
Let’s say we call the new file /var/sadm/install/admin/new-base-dir and we like to install the new package to /local.
In the new file, add the following line.
basedir=/local
Once you have saved your changes, you can run the pkgadd command and specify to use the newly created admin file by using the -a flag.
pkgadd -a new-base-dir -d NameOfPackage