{"id":274,"date":"2016-04-01T14:38:20","date_gmt":"2016-04-01T12:38:20","guid":{"rendered":"http:\/\/www.lambiek.eu\/blog\/?p=274"},"modified":"2016-04-01T14:39:06","modified_gmt":"2016-04-01T12:39:06","slug":"solaris-multiple-repositories-using-package-server-instances-and-apache","status":"publish","type":"post","link":"https:\/\/www.lambiek.eu\/blog\/tutorial\/solaris-multiple-repositories-using-package-server-instances-and-apache\/","title":{"rendered":"Solaris multiple repositories using package server instances and Apache"},"content":{"rendered":"<p>It is possible to host multiple repositories from a single host, or present them using a frontend proxy to your network infrastructure. In my case I have two repositories which I want to host for our Solaris infrastructure: the solaris repository and a custom repository containing our own packages.<\/p>\n<p>For this to work you will need two package servers and a webserver to act as proxy. The package server is installed by default and you can create two instances rather easily. You will need to install Apache using:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Install Apache\">\r\npkg install pkg:\/\/solaris\/web\/server\/apache-22\r\n<\/pre>\n<p>Next thing to do is to setup two instances of a package server:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Setup pkg server instances\" >\r\nsvccfg -s pkg\/server add solaris\r\nsvccfg -s pkg\/server:solaris\r\naddpg pkg application\r\naddpg general framework\r\nsetprop pkg\/port=integer: 10081\r\nsetprop pkg\/inst_root= astring: \/path\/to\/solaris-repo\r\nsetprop pkg\/proxy_base= astring: \"http:\/\/myrepo.local\/solaris\"\r\nsetprop pkg\/readonly= boolean: true\r\n\r\nsvccfg -s pkg\/server add custom\r\nsvccfg -s pkg\/server:custom\r\naddpg pkg application\r\naddpg general framework\r\nsetprop pkg\/port=integer: 10082\r\nsetprop pkg\/inst_root= astring: \/path\/to\/custom-repo\r\nsetprop pkg\/proxy_base= astring: \"http:\/\/myrepo.local\/custom\"\r\nsetprop pkg\/readonly= boolean: true\r\n\r\nsvcadm enable pkg\/server:solaris\r\nsvcadm enable pkg\/server:custom\r\n<\/pre>\n<p>Then we need to setup Apache to handle the repository requests<\/p>\n<pre class=\"lang:default decode:true \" title=\"Apache configuration for pkg publisher\" >\r\ncat \/etc\/apache2\/2.2\/conf.d\/publisher.conf\r\n#\r\n# Publisher configuration\r\n# Reference: https:\/\/docs.oracle.com\/cd\/E23824_01\/html\/E21803\/apache-config.html#scrolltoc\r\n#\r\n\r\n&amp;lt;LocationMatch \".*\/catalog.attrs\"&amp;gt;\r\nHeader set Cache-Control no-cache\r\n&amp;lt;\/LocationMatch&amp;gt;\r\n\r\n&amp;lt;LocationMatch \".*\/search\/\\d\/.*\"&amp;gt;\r\nHeader set Cache-Control no-cache\r\n&amp;lt;\/LocationMatch&amp;gt;\r\n\r\nAddOutputFilterByType DEFLATE text\/html application\/javascript text\/css text\/plain\r\nAllowEncodedSlashes NoDecode\r\nMaxKeepAliveRequests 10000\r\nProxyTimeout 30\r\nProxyRequests Off\r\n\r\nRedirect \/solaris http:\/\/myrepo.local\/solaris\r\nProxyPass \/solaris http:\/\/localhost:10081 nocanon max=200\r\n\r\nRedirect \/custom http:\/\/myrepo.local\/custom\r\nProxyPass \/custom http:\/\/localhost:10082 nocanon max=200\r\n<\/pre>\n<p>Then enable the Apache server using:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Enable Apache\" >\r\nsvcadm enable svc:\/network\/http:apache22\r\n<\/pre>\n<p>Finally point a client to the newly configured repositories:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Configure publisher on client\" >\r\npkg set-publisher -G '*' -g http:\/\/myrepo.local\/solaris solaris\r\npkg set-publisher -g http:\/\/myrepo.local\/custom custom\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to host multiple repositories from a single host, or present them using a frontend proxy to your network infrastructure. In my case I have two repositories which I want to host for our Solaris infrastructure: the solaris repository and a custom repository containing our own packages. For this to work you will &#8230; <span class=\"more\"><a class=\"more-link\" href=\"https:\/\/www.lambiek.eu\/blog\/tutorial\/solaris-multiple-repositories-using-package-server-instances-and-apache\/\">[Read more&#8230;]<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[23,24,13],"_links":{"self":[{"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/posts\/274"}],"collection":[{"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":2,"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions\/276"}],"wp:attachment":[{"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lambiek.eu\/blog\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}