ubuntu 14.04 安装preforce

官网: http://www.perforce.com/

         http://www.perforce.com/support-services

 

1. 下载相关文件

    http://filehost.perforce.com/perforce/r13.2/bin.linux26x86/

    下载后,赋予 执行权限

    chmod +x p4 p4broker p4d p4p perfmerge perfsplit

    

 

2. 配置和安装

    2.1 创建 perforce server 的目录 

       /home/carloz/programfiles/p4home

               

       [通常地p4root,log,journal需要挂载到不同的物理硬盘,来避免灾难事故的影响]

    2.2 创建 perforce server 配置文件

       /home/carloz/programfiles/p4home/p4server001.ini       

# This will be configure file for p4 server,
# and it need be $P4HOME/$P4SERVERNAME.ini
USER=carloz
P4HOME=/home/carloz/programfiles/p4home

P4USER=perforce
P4PASSWD=123
P4SERVERNAME=p4server001

p4=$P4HOME/p4
p4d=$P4HOME/p4d

P4PORT=127.0.0.1:1666
P4ROOT=$P4HOME/p4root
JOURNAL=$P4HOME/journal
LOG=$P4HOME/log/p4server001.log

TRACKLEVEL=1
SERVERLEVEL=2

 

      2.3 创建脚本 p4server001

#!/bin/bash
#
# chkconfig:1235 80 80
# description: p4server001 daemon
#

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

# Source in the configs...
. /home/carloz/programfiles/p4home/p4server001.ini

SU="su $USER -c"
LOCKFILE=$P4HOME/$P4SERVERNAME.lock

start() {
    STARTCMD="$p4d -d -v server=$SERVERLEVEL,track=$TRACKLEVEL -p $P4PORT -r $P4ROOT -L $LOG -J $JOURNAL"
    $SU "$STARTCMD" 2>&1
    touch $LOCKFILE
    $SU "logger p4d starting"
    echo "p4d was started on" `hostname -s`
}

stop() {
    STOPCMD="$p4 -p $P4PORT -u $P4USER admin stop"
    echo $P4PASSWD | $p4 -p $P4PORT -u $P4USER login
    $SU "$STOPCMD" 2>&1
    rm $LOCKFILE
    $SU "logger p4d stopping"
    echo "p4d was stopped on" `hostname -s`
}

status() {
    if [ -f $LOCKFILE ];
        then
            echo p4d status: running
        else
            echo p4d status: stopped
    fi
}

case "$1" in

'start')
        start
        ;;

'stop')
        stop
        ;;

'status')
        status
        ;;
*)
        echo "Usage: p4server001 { start | stop | status }"
        ;;

esac

 

         赋予脚本执行权限: chmod +x p4server001

        将p4server001拷贝到/etc/init.d下:  sudo cp p4server001 /etc/init.d/

        

    2.3 将下载的p4相关文件 拷贝 到 p4home目录下:

       

    2.4 启动 p4d

      sudo /etc/init.d/p4server001 start 或者 sbin/service p4server001 start

 

      查看状态: /etc/init.d/p4server001 status 或 ps -ef | grep p4d

       停止: sudo /etc/init.d/p4server001 stop

 

http://www.cnblogs.com/itech/archive/2011/08/19/2146058.html

    

 

posted @ 2015-09-20 01:09  carlo-z  阅读(559)  评论(0编辑  收藏  举报