How to Setup p4 in Linux / Unix
Well many people have these questions to me that they are facing issues setting up p4 client in Linux or Unix. The Solution is pretty much straight forwards but sometimes we miss some of things which delay the setup process.
Here I have tried to points out these already available on Perforce Knowledge base site.
Download and Installations:
|1.||Download the p4 executable file from the Perforce web site:|
The Perforce client programs are typically downloaded to /usr/local/bin.
|2.||Make the p4 file executable (chmod +x p4)|
Perforce Configuration and Workspace Setting
Using Config Files:
Config files are text files containing Perforce settings that are in effect for files in and below the directory where the config file resides. Config files are useful if you have multiple client workspaces on the same machine. By specifying the settings in config files, you avoid the inconvenience of changing system settings every time you want to work with a different work-space.
To use config files, you define the P4CONFIG environment variable, specifying a file name (for example, .p4config). When you issue a command, Perforce searches the current working directory and its parent directories for the specified file and uses the settings it contains (unless the settings are overridden by command-line flags).
P4CONFIG = .p4config
Each setting in the file must be specified on its own line, using the following format:
For details about these settings, refer to the Perforce Command Reference.
Example: Using config files to handle switching between two workspaces
Ona switches between two workspaces on the same machine. The first workspace is ona-ash. It has a client root of /tmp/user/ona and connects to the Perforce server at ida:1818. The second workspace is called ona-agave. Its client root is /home/ona/p4-ona, and it uses the Perforce server at warhol:1666.
Any work she does on files under /tmp/user/rama is managed by the Perforce server at ida:1818 and work she does on files under /home/rama/p4-ona is managed by the Perforce server at warhol:1666.
Method 2: Environment Variable Setting
|If the server is running on||and is listening to port||set P4PORT to|
|1.||Specify the workspace name by setting P4CLIENT; for example, on a UNIX system:|
|Issue the p4 client command.|
|3.||Specify (at least the minimum) settings and save the specification.|
The client root is the top directory of your client workspace, where Perforce stores your working copies of depot files. Be sure to set the client root, or you might inadvertently sync files to your client machine’s root directory.