Multiple installation of one ports

Chris St Denis chris at
Tue Sep 16 19:47:46 UTC 2008

Matthew Seaman wrote:
> FreeBSD wrote:
>> Hi everyone,
>> I've been asked by a customer to install Drupal on one server to 
>> manage a new site. No problem yet. But, he also asked if it would be 
>> possible to install it for other sites.
>> I know that there is a warning if you want to install a port that is 
>> already installed, but is there a way to bypass this? I know I could 
>> install it from the tarball from the website, but I want to be able 
>> to use portupgrade and portaudit to deal with it.
>> Any suggestions?
> This is an interesting problem.  The FreeBSD ports system does not at
> present allow multiple installations of the same port, even into
> different ${PREFIX}es.  This make sense for most of the software dealt
> with by the ports system, but in the specific case of web based
> applications having the same application installed into multiple 
> locations
> in the same web tree is a perfectly reasonable thing to want to do.
> Here are some ideas as to ways you might consider for working round the
> problem and still being able to use the ports system in the usual way.
> None of these are tested by me in any way, and some of them may not
> actually work.
>  i) If you have spare IPs available, simply set up jails to run 
> second       and subsequent instances of drupal and apache.  This is 
> pretty much     overkill but it's a tried and tested strategy and 
> should be reliable.
>     The downside is you need to install at least enough of a system in
>     each jail to support running apache, etc. plus you have to maintain
>     each of the different jail environments separately.
> ii) If you haven't any spare IPs, you can install multiple copies of
>     the same port on the same machine by changing *both* $PKG_DBDIR
>     and $PREFIX in the environment to distinct values for each copy.  
>     Unfortunately changing $PREFIX doesn't give you complete freedom
>     to choose where a web app will be installed -- typically a web app
>     will be located at ${PREFIX}/www/app-name.  However by judicious
>     use of the Alias directive in httpd.conf you can make all those
>     different directories appear in the same web tree.  Like option
>     (i) you've still got multiple copies of ports to maintain, although
>     in this case, it's only the drupal port and anything that depends
>     on drupal that you need multiple copies of, rather than the entire
>     installation tree of ports.
> iii) A kind of wacky idea this, and it will only work for web apps whose
>     configuration files are contained within the web root.  That's 
> true      of most PHP based web apps -- other languages may differ.
>     Install the port once only, in the normal fashion.  Then create
>     loopback mounts of the application directory multiple time, each to
>     a union fs (see mount_unionfs(8)) where you superpose a separate
>     layer to contain just the configuration files for that instance.
>     It's conceptually complicated, but all the work should be at the
>     setup stage and after that, there's only one instance of your web
>     app to keep properly maintained.
> iv) I've no idea if this is at all possible with Drupal, but really 
> the     absolute easiest solution is to choose a CMS that lets you 
> manage     several different web sites (virtual hosts, web trees, what 
> you will)     within the same instance. 
>     Cheers,
>     Matthew

What I do with webapps from ports is install them once, then copy them 
to each of the customers that wants them.

It's not a perfect solution, but for a webapp what I care about for the 
ports is dependency tracking, and portaudit.

More information about the freebsd-questions mailing list