0

I have a production FreeBSD webserver which I would like to "clone" to create a development/preproduction server.

I've installed a clean FreeBSD server and now I would like to know if there's an easy way to list all the ports installed on the production server, get that list out and input that to the new server, so I can easily install all the same apps and same versions than in the production machine.

We are using:
FreeBSD 7.1
portmaster as a port manager

2 Answers 2

3

This is from the EXAMPLES section of the portmaster man page:

  • First, get a list of installed ports:

    portmaster --list-origins > installed-port-list
    
  • On your target system, use that list as input to portmaster:

    portmaster `cat installed-port-list`
    
8
  • ...although this won't necessarily get you the same version of the ports unless the ports tree on your target system matches the installed versions on your production host.
    – larsks
    Jan 26, 2011 at 20:37
  • Interesting... There are some ports tha 'don't exist', so I think that should mean that I don't have that repositories or something like that... I'm trying to find a fix to that now...
    – Andor
    Jan 26, 2011 at 20:56
  • I'm a linux admin and I'm still a bit lost in this :D
    – Andor
    Jan 26, 2011 at 20:58
  • 1
    Make sure your ports tree is up-to-date -- or is at least identical to the production system. It's possible that your installed packages may be out of sync w/r/t the ports tree if some were installed using "pkg_add" (which installs binary packages).
    – larsks
    Jan 26, 2011 at 21:32
  • 1
    This is probably the best source of information. In general, no, there's only one "ports tree", but there are multiple versions of it (e.g., -release, -stable, etc).
    – larsks
    Jan 27, 2011 at 0:33
0

you need bash

mkdir -p /usr/local/pkg

cd /usr/local/pkg

for i in pkg_info |cut -f 1 -d " " ; do pkg_create -b $i ; done

then, scp the resulting pkgs to the target server and install them by pkg_add * Then, copy over the /usr/local/etc of the source-server and copy any entries in /etc/rc.conf and related files that seem useful and appropriate.

1
  • Why is bash necessary?
    – Chris S
    Feb 22, 2011 at 0:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .