Configuring Perforce on a Local Area Network Imran Bashir Nov 5th, 2011
Why Use SCM?• Having a SCM ‘Software Configuration Management’ tool is an efficient way to backup and update your data files. No need to backup data on CDs and DVDs.• An SCM tool like Perforce stores data on a repository that can be locally stored on your machine or another machine on a local or remote network.• Files are version controlled.• A practical scenario: Use a separate machine (server) to store all of your data files while your workstation or laptop (client) only stores a subset of information from the dataset that you need. In this way, you can save resources on the machine you normally use for your day to day work.• In these slides, I will show you how to configure two machines A (server) and B (client) both on a local network using Perforce.
Steps (1 of 5)• There is a good YouTube demonstration video on installation of perforce on client and server. Type this in the search field “10-Minute Client and Server Setup on Windows”• Using the procedure in video, install P4 server and P4V on machine A (server). No need for P4 Proxy unless you are remotely connecting to your local network. Install P4 server (optional) and P4V on machine B (client).• Download Apple Bonjour application on both machines. You will need this to search for the server on machine A from machine B. – http://support.apple.com/kb/DL999• Turn off firewalls one machine A and B. Test connections between machines using IP ping.• On the Machine A, check to see if ‘Perforce’ process is running. Control Panel-> Admin Tools-> Services• Open command window in System Admin mode (by right clicking on icon and selecting ‘Run as Admin’).
Steps (2 of 5)• On Machine A, enable Zeroconf for the ‘Perforce’ service. From the prompt type – svcinst stop -n Perforce <Enter> – p4 set -S Perforce P4ZEROCONF=1 <Enter> – p4 set -S Perforce P4DESCRIPTION=“Machine A Server“ <Enter> – svcinst start -n Perforce <Enter>• You can set other parameters too. Check the last slide for details. These entries are stored in the machine, so you do not need to do this every reboot. <phew!>• Now launch P4V on machine B. The startup wizard will launch and a menu will appear where Perforce will search for any perforce servers on the local network. You should see the name ‘Perforce’ and a description (that you typed in P4DESCRIPTION while configuring the server on Machine A) in the menu. This is the most critical point for the whole setup. If you do not see it, check the firewall setup on both machines. Make sure you can ping Machine A (server) from Machine B (client) at least.
Steps (3 of 5)• If nothing works, try using the ‘brute force’ method of configuring the ‘Perforce’ service on Machine A. Type in the settings in the right window of the figure below. You will need to stop the service first, type the settings in, and then start the service again. The settings in ‘Start Parameters’ is static i.e. they are lost as soon as you close that menu or reboot the computer.
Steps (4 of 5)• If you can see the server from Machine B (client) but the software complains about not being able to resolve the server IP address and gives an error as follows:• …then try to type the IP address and the port number (default 1666) as shown in the window below.
Steps (5 of 5)• If you don’t have your workspace setup, you can do that later. The key thing is to be able to see the depot tree from Machine B which should mirror what is on Machine A. Try checking in some dummy text files on Machine A and then check the depot view on Machine B. See the screenshot below.
Configuring Windows Firewall• The last step is to enable the firewall on Machine A. It will block Machine B from connecting to the server. You will have to add some exceptions to the firewall settings to allow seamless connection between the two machines. This screenshot shows configuration of the firewall on Windows XP.
• Setting a Perforce Service Manually Make sure to right click on ‘cmd’ and ‘run as administrator’• Example: Adding a second Perforce service.• You want to create a second Perforce service with a root in C:p4root2 and a service name of Perforce2. The svcinst executable is in the server root of the first Perforce installation you installed in C:perforce.• Verify that your p4d.exe executable is at Release 99.1/10994 or greater:• p4d -V• (If you are running an older release, you must first download a more recent release from http://www.perforce.com and upgrade your server before continuing.)• Create a P4ROOT directory for the new service:• mkdir c:p4root2• Copy the server executables, both p4d.exe (the server) and p4s.exe (the service), and your license file into the new directory:• copy c:perforcep4d.exe c:p4root2 copy c:perforcep4d.exe c:p4root2p4s.exe copy c:perforcelicense c:p4root2license• Use Perforces svcinst.exe (the service installer) to create the "Perforce2" service:• svcinst create -n Perforce2 -e c:p4root2p4s.exe -a• After you create the Perforce2 service, set the service parameters for the Perforce2 service:• p4 set -S Perforce2 P4ROOT=c:p4root2• p4 set -S Perforce P4NAME=MyPerforceServer• p4 set -S Perforce P4ZEROCONF=1• p4 set -S Perforce P4DESCRIPTION="Connect here for SCM goodness“• p4 set -S Perforce2 P4PORT=1667• p4 set -S Perforce2 P4LOG=log2• p4 set -S Perforce2 P4JOURNAL=journal2• Finally, use the Perforce service installer to start the Perforce2 service:• svcinst start -n Perforce2.• The second service is now running, and both services will start automatically the next time you reboot.• Can setup multiple services• Once settings are set, the remain in effect for that server.