Configure Perforce
  • Download the Perforce daemon file 'p4d' and client 'p4' files directly into /usr/local/bin. These files are for Linux installs using the 2.6 kernel version.
cd /usr/local/bin
wget http://www.perforce.com/downloads/perforce/r10.2/bin.linux26x86/p4d
wget http://www.perforce.com/downloads/perforce/r10.2/bin.linux26x86/p4
 
  • Make the 'p4d' and 'p4' files executable.
chmod +x p4d p4

 

  • Create a directory to hold Perforce files.

 

sudo mkdir /perforce
sudo chown perforce /perforce
sudo mkdir /perforce/log
sudo chown perforce /perforce/log
  • Add the following lines to the end of /etc/profile. These settings will be used by local client programs run on the Linux server – not by the Perforce server.
# Perforce Settings
export P4JOURNAL=/perforce/log/journal
export P4LOG=/perforce/log/p4err
export P4ROOT=/perforce
export P4PORT=localhost:1666
export P4USER=perforce
  • Load the Perforce settings.
 source /etc/profile
 
Setup Perforce As Bootup Service
  • Change to the initialization control directory.
cd /etc/init.d
  • Create the Perforce control script using 'sudo vi perforce'.
#!/bin/sh -e
 
export P4JOURNAL=/perforce/log/journal
export P4LOG=/perforce/log/p4err
export P4ROOT=/perforce
export P4PORT=localhost:1666
 
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
 
p4user=perforce
p4start="p4d -d -r $P4ROOT -J $P4JOURNAL -L $P4LOG -p $P4PORT"
p4stop="p4 -Hlocalhost -p$P4PORT -u$p4user admin stop"
 
case "$1" in
start)
echo "STARTING PERFORCE SERVER...."
$p4start;
;;
stop)
echo "STOPING PERFORCE SERVER...."
$p4stop;
;;
restart)
echo "STOPING PERFORCE SERVER....."
$p4stop
echo "STARTING PERFORCE SERVER...."
$p4start
;;
*)
echo "Usage: /etc/init.d/perforce (start|stop|restart)"
exit 1
;;
esac
exit 0
posted on 2011-08-16 17:39  尚書  阅读(448)  评论(0编辑  收藏  举报