Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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`
    
share|improve this answer
    
...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 '11 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 '11 at 20:56
    
I'm a linux admin and I'm still a bit lost in this :D –  Andor Jan 26 '11 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 '11 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 '11 at 0:33

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.

share|improve this answer
    
Why is bash necessary? –  Chris S Feb 22 '11 at 0:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.