The basic principles for platform-specific instructions are:
Download the appropriate server for your operating system (as mentioned in the previous section)
Download the zipped test repository (see link mentioned in the previous section)
Unzip the repository in a local directory
Initialize the Perforce repository in that directory
Run the Perforce server (
p4d
orp4d.exe
) specifying a particular port and the correct directory
When the file is uncompressed, it creates a directory named PerforceSample
. The PerforceSample
directory contains the following files:
It also contains the following directories containing Perforce archive files:
depot
jam
spec
Please note that a copy of these instructions is also available at the web page linked in the previous Platform specific executables section. Use the online instructions if they are different to what is contained here:
Uncompress the
sampledepot.zip
file using a standard compression utility such as WinZip or 7-Zip. On Windows 7 or above, Windows Explorer can open.zip
files as compressed folders: right-click the folder, click on Extract All, and then follow the instructions.The
PerforceSample
directory where you unzipped the files, for examplec:\PerforceSample
, is known as theP4ROOT
directory.Copy the
p4d.exe
executable to theP4ROOT
directory using Windows Explorer.Run a command prompt window (click on Start, type
Command Prompt
and click on Run).Change to the
P4ROOT
directory:cd c:\PerforceSample
To create your sample Perforce database, restore the checkpoint file by issuing the following command (from the
P4ROOT
directory):p4d -r . -jr checkpoint
To ensure that the database format is consistent with the Perforce server version that you are using, issue the following command:
p4d -r . -xu
If the command is successful, you will see the message: ...upgrades done.
Run the file
server.bat
(see the following sections for details).
Please note that a copy of these instructions is also available at the web page linked in the previous Platform specific executables section. Use the online instructions if they are different to what is contained here.
Uncompress the
sampledepot.tar.gz
file using the following commands, we will assume in your/tmp
directory:cp sampledepot.tar.gz /tmpcd /tmpgunzip sampledepot.tar.gztar xf sampledepot.tar
ThePerforceSample
directory where you unzipped the files, for example/tmp/PerforceSample
, is known as theP4ROOT
directory.Copy the
p4d
executable to theP4ROOT
directory:cp p4d /tmp/PerforceSample
Change to the
P4ROOT
directory:cd /tmp/PerforceSample
To create your sample Perforce database, restore the checkpoint file by issuing the following command (from the
P4ROOT
directory):p4d -r . -jr checkpoint
To ensure that the database format is consistent with the Perforce Server version that you are using, issue the following command:
p4d -r . -xu
If the command is successful, you will see the message: ...upgrades done.
The preceding installation instructions will allow you to run the test repository as an ordinary user, without requiring administrator privileges.
However, you may still have problems on locked down corporate installations of Windows. The privileges required are to:
Download the executables and the zipped repository
Being able to unzip them to a directory on your local PC
Being able to run a perforce server executable (
p4d.exe
) which uses a (configurable) port, you may need to be given permission for this
The authors have created a simple batch file (server.bat
) as part of the zipped sample repository which shows you the command format and provides some simple guidance. You can just run this file from a cmd window, or by double-clicking on it from Windows Explorer:
C:\PerforceSample>server.bat Please note that the following command will not exit and will just say: Perforce Server starting... This is perfectly normal! Just minimise this window and leave it running. If you close this Window, or press Ctrl+C the server will stop. C:\PerforceSample>p4d -p 1666 -r c:\PerforceSample\ -vserver=3 -L p4d.log Perforce Server starting...
The server.bat file is located within the sample repository directory. The contents of the file are:
@setlocal @echo off REM Start of possible customization REM You can change the following line to set the value REM to a different port on the local machine if you wish REM ----- set P4PORT=1666 REM ------ REM End of customization REM This sets the environment variable to the path of this file set CURR_DIR=%~dp0 set P4ROOT=%CURR_DIR% set P4JOURNAL=%CURR_DIR%journal REM The "title" command just sets the title of the CMD window title Perforce server - don't stop! @echo. @echo Please note that the following command will not exit and will just say: @echo Perforce Server starting... @echo. @echo This is perfectly normal! Just minimise this window and leave it running. @echo If you close this Window, or press Ctrl+C the server will stop. REM We assume the p4d.exe is present in this directory @echo on %P4ROOT%p4d.exe -p %P4PORT% -r %P4ROOT% -vserver=3 -L p4d.log @endlocal