Centos安装Perforce

Author: Jin
Date: 20140827
System: CentOS release 6.5 (Final)

参考:http://www.cnblogs.com/itech/archive/2011/08/19/2146058.html
windows安装
http://www.cnblogs.com/itech/archive/2011/08/15/2139516.html

1.创建用户
useradd -d /usr/local/perforce -m perforce
passwd perforce

2.安装
1).安装
http://filehost.perforce.com/perforce/r14.1/bin.linux26x86_64/
su - perforce
mkdir p4root
mkdir log
mkdir bin && cd bin
wget http://filehost.perforce.com/perforce/r14.1/bin.linux26x86_64/p4d && chmod 755 p4d
wget http://filehost.perforce.com/perforce/r14.1/bin.linux26x86_64/p4 && chmod 755 p4

2)配置
# vim p4server001.ini

 1 # and it need be $USERHOME/$P4SERVERNAME.ini

 2 USER=perforce

 3 USERHOME=/usr/local/perforce

 4 

 5 P4USER=perforce

 6 P4PASSWD=123.com

 7 P4SERVERNAME=p4server001

 8 

 9 p4=$USERHOME/bin/p4

10 p4d=$USERHOME/bin/p4d

11 

12 P4PORT=192.168.1.220:1666

13 P4ROOT=$USERHOME/p4root

14 JOURNAL=$USERHOME/journal

15 LOG=$USERHOME/log/p4server001.log
View Code

3.启动
1) 启动脚本
# vim /etc/init.d/p4server001

 1 #!/bin/bash

 2 #

 3 # chkconfig:1235 80 80

 4 # description: p4server001 daemon

 5 #

 6 

 7 PATH=/sbin:/bin:/usr/bin:/usr/sbin

 8 

 9 # Source in the configs...

10 . /usr/local/perforce/p4server001.ini

11 

12 SU="su $USER -c"

13 LOCKFILE=$USERHOME/$P4SERVERNAME.lock

14 

15 start() {

16 STARTCMD="$p4d -d -v server=$SERVERLEVEL,track=$TRACKLEVEL -p $P4PORT -r $P4ROOT -L $LOG -J $JOURNAL"

17 $SU "$STARTCMD" 2>&1

18 touch $LOCKFILE

19 $SU "logger p4d starting"

20 echo "p4d was started on" `hostname -s`

21 }

22 stop() {

23 STOPCMD="$p4 -p $P4PORT -u $P4USER admin stop"

24 echo $P4PASSWD | $p4 -p $P4PORT -u $P4USER login

25 $SU "$STOPCMD" 2>&1

26 rm $LOCKFILE

27 $SU "logger p4d stopping"

28 echo "p4d was stopped on" `hostname -s`

29 }

30 

31 status() {

32 if [ -f $LOCKFILE ];

33 then

34 echo p4d status: running

35 else

36 echo p4d status: stopped

37 fi

38 }

39 

40 case "$1" in

41 

42 'start')

43 start

44 ;;

45 

46 'stop')

47 stop

48 ;;

49 

50 'status')

51 status

52 ;;

53 *)

54 echo "Usage: p4server001 { start | stop | status }"

55 ;;

56 

57 esac
View Code

# chmod 755 /etc/init.d/p4server001
2)启动
使用root启动
[root@gs01 ~]# /etc/init.d/p4server001 start
p4d was started on gs0
[root@gs01 ~]# /etc/init.d/p4server001 status
p4d status: running

4.开机启动
[root@gs01 ~]# chkconfig --add p4server001
[root@gs01 ~]# chkconfig p4server001 on
[root@gs01 ~]# chkconfig p4server001 --list
p4server001 0:off 1:on 2:on 3:on 4:on 5:on 6:off

5.设置
1)管理员账号
第一个登录的账号,会提示是否作为管理员,登录时可以自己创建账号。

2)开启utf8字符支持
p4d -xi

3)客户端配置
[perforce@gs01 ~]$ cat client.ini
export P4PORT=192.168.1.220:1666 #P4所在的主机
export P4CLIENT=gs01 #指定了与perforce服务器交流的client是什么
export P4USER=perforce #P4用户名
export P4PASSWD=123.com #P4密码
export P4CHARSET=utf8 #调用命令时使用的字符集
# . client.ini
p4 -u $P4USER -C $P4CHARSET login

修改客户端配置,比如

现在的情况,从开发版本切换出一个release版本 如何修改
p4 -u $P4USER client
Stream: //Server/Relese0811
或者windows图形界面修改work space

 

4)安全等级
默认安全等级为0,连接到服务器就可以自己创建账号,创建workspace
$ p4 -u jin login
$ p4 counter -f security 1
You don't have permission for this operation.
使用图形界面工具p4admin修改
关闭任何用户的write权限
从write修改为list
好像还是可以创建

5)权限管理
http://www.cnblogs.com/itech/archive/2011/08/15/2139695.html

 

你可能感兴趣的:(centos)