Perforce – Centos start investigation and install

The Perforce service and applications are available from the Downloads page on the Perforce web site: http://www.perforce.com/downloads/complete_list

THIS is not a JOKE!

dovakin_p4.jpg

Installation:

Do not worked for me:

Official

From here: http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.install.html#install.unix

Although you can install p4 and p4d in any directory, on UNIX, the Perforce applications typically reside in /usr/local/bin, and the Perforce service is usually located either in /usr/local/bin or in its own server root directory. You can install Perforce applications on any machine that has TCP/IP access to the p4d host.

To limit access to the Perforce service’s files, ensure that the p4d executable is owned and run by a Perforce user account that has been created for the purpose of running the Perforce service.

To start using Perforce:

  1. Download the p4 and p4d applications for your platform from the Perforce web site.
  2. Make the downloaded p4 and p4d files executable.
  3. Create a server root directory to hold the Perforce database and versioned files.
  4. Tell the Perforce service what port to listen to by specifying a TCP/IP port to p4d.
  5. Start the Perforce service (p4d).
  6. Set the p4d port and address for Perforce applications by setting the P4PORT environment variable.
chmod +x p4
chmod +x p4d

Then move file to recommended dir:

[root@testcentos www]# mv p4d /usr/local/bin
[root@testcentos www]# cd /usr/local/bin
[root@testcentos bin]# ls -l
total 5856
-rwxr-xr-x. 1 root root 5993112 Mar 26 09:33 p4d
[root@testcentos bin]#

bug_p4.jpg

Also do not work:

Perforce visual

From here: http://www.perforce.com/documentation/tenminute-test-drive-linuxunix

Make a directory to use for your demo installation, and set up your environment:

(I have made /usr/perforce)

mkdir ~/perforce

For bash:

export PATH=~/perforce:$PATH export P4PORT=1666
[root@testcentos bin]# export PATH=/usr/perforce:$PATH export P4PORT=1666

Go to our Downloads page and download the Perforce Server executable (p4d), P4V (p4v.tgz), and the Perforce Command-Line Client (P4) for your platform. Put the programs in your /perforce directory.

Make the server executable, then start it (root permission not required):

cd ~/perforce chmod a+x p4d ./p4d -d
[root@testcentos perforce]# chmod a+x p4d ./p4d
[root@testcentos perforce]# chmod a+x p4d ./p4d -d
chmod: invalid option -- 'd'
Try 'chmod --help' for more information.
[root@testcentos perforce]# ls -l
total 8616
-rw-r--r--. 1 root root 2825800 Mar 26 11:57 p4
-rwxr-xr-x. 1 root root 5993112 Mar 26 09:33 p4d
[root@testcentos perforce]# chmod +x p4
[root@testcentos perforce]# ls -l
total 8616
-rwxr-xr-x. 1 root root 2825800 Mar 26 11:57 p4
-rwxr-xr-x. 1 root root 5993112 Mar 26 09:33 p4d

Unzip and untar p4v.tgz:

tar xvzf p4v.tgz

Finally, launch P4V:

./p4v

dog_p4.jpg

Procedures above looks not complex, I cannot run P4 by them.

Will try another:

Third way

From: https://ssteiner.wordpress.com/2008/04/23/installing-perforce-on-red-hat-linux-the-gory-details/

Also can help: http://sudomakeinstall.com/linux-systems/perforce-p4d-init-d-script-centos

1. Download the ‘daemon’ utility. This utility allows ‘p4d’ to be run by the ‘perforce’ user instead of ‘root’. I use /usr/local/src for the source of anything I install on the server so here’s what I did. If you’re not logged in as root, put a ‘sudo’ ahead of each of the commands below or ‘su’ in first.

cd /usr/local/src
wget http://libslack.org/daemon/download/daemon-0.6.3.tar.gz
tar zxvf daemon-0.6.3.tar.gz
cd daemon-0.6.3.tar.gz
./configure
make install

2. 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, adjust if you’re still running a 2.4.x kernel:

cd /usr/local/bin
wget http://www.perforce.com/downloads/perforce/r07.3/bin.linux26x86/p4d
wget http://www.perforce.com/downloads/perforce/r07.3/bin.linux26x86/p4

3. Make the ‘p4d’ and ‘p4’ files executable.

chmod +x p4d p4

4. Create a group for perforce files and a user for admin work:
(I really do not now why is this important because I want to run it as is – root)
<ignoring>

groupadd p4admin
useradd -m -g p4admin perforce

5. Use ‘visudo’ to give the perforce user account the ability to use ‘sudo’. Add the following line at the end o f the file. NOTE: visudo on Red Hat doesn’t actually use ‘vi’ to do the work, it uses pico so don’t expect ‘vi’ commands to work. Stupid Red Hat. Stupid pico.

perforce ALL = ALL

6. Log off your default user account.
7. Log in using the ‘perforce’ account.
8. Create a directory to hold the repository. I based mine in /var/www.

sudo mkdir /var/www/perforce
sudo chown perforce:p4admin /var/perforce

<ignoring>

9. Create a directory to hold Perforce log files under /var/log.

sudo mkdir /var/log/perforce
sudo chown perforce:p4admin /var/log/perforce

A. 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.

P4USER may also be a root in my situation
# Perforce Settings
export P4JOURNAL=/var/log/perforce/journal
export P4LOG=/var/log/perforce/p4err
export P4PORT=localhost:1666
export P4ROOT=/var/www/perforce
export P4USER=perforce

B. Load the Perforce settings.

source /etc/profile

Does not work now:

[root@testcentos init.d]# service perforce status
/etc/init.d/perforce: line 10: -d”: command not found

Setup Perforce As Bootup Service

1. Change to the initialization control directory.

cd /etc/init.d

2. Create the Perforce control script using ‘sudo vi perforce’.

#!/bin/sh -e

export P4JOURNAL=/var/log/perforce/journal
export P4LOG=/var/log/perforce/p4err
export P4ROOT=/perforce_depot
export P4PORT=1666

PATH=”/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin”

p4start=”p4d -d”
p4stop=”p4 admin stop”
p4user=perforce

case “$1″ in
start)

# NOTE: in original, haven’t found RedHat equiv or source to include
# Haven’t found . /lib/lsb/init-functions
# log_action_begin_msg “Starting Perforce Server”
daemon -u $p4user $p4start;
;;

stop)
# see above
# log_action_begin_msg “Stopping Perforce Server”
daemon -u $p4user $p4stop;
;;

restart)
daemon -u $p4user $p4stop
daemon -u $p4user $p4start
;;

*)
echo “Usage: /etc/init.d/perforce (start|stop|restart)”
exit 1
;;

esac

exit 0

3. Goto your home directory then use the control script to start the Perforce server.

cd ~
sudo /etc/init.d/perforce start

4. Make sure it actually started

ps aux | grep perforce

I get:

userx@wonky [~]# ps aux | grep perforce
perforce 3669 0.0 0.0 1736 536 ? Ss 20:27 0:00 daemon -u perforce p4d -d
perforce 3672 0.0 0.0 5076 1492 ? S 20:27 0:00 p4d
userx 3689 0.0 0.0 1584 492 pts/0 S+ 20:27 0:00 grep perforce

14. Create a Perforce group to limit resource usage using:

sudo p4 group developers

This, on Red Hat, opens ‘pico’ where you’re editing a text file to set the following values. See the Perforce site for more information.

Group: developers
MaxResults: 50000
MaxScanRows: 250000
MaxLocktime: 30000
Timeout: 4320
Subgroups:
Users: developer

To which perforce responds:

userx@wonky [~]# sudo p4 group developers
Group developers created.

5. Use the control script to restart the Perforce server.

sudo /etc/init.d/perforce restart

Another way don’t work:

This guide can help partually

From: http://www.donaldsimpson.co.uk/2011/10/25/setting-up-perforce-on-a-linux-server-and-a-windows-client/

Set root_dir

export P4ROOT=/apps/perforce
– or –
-r /var/www/perforce

Try run: (without nohup )

./p4d -r /var/www/perforce -J /var/log/journal -L /var/log/p4err -p 1666

 

Nope, did not work:

[root@testcentos perforce]# ./p4d -r /var/www/perforce/ -J /var/log/perforce/journal -L /var/log/perforce/p4err -p 1666
[1] 20070
[root@testcentos perforce]# ps aux | grep perforce
root     19488  0.0  0.1 175548  3056 pts/0    S    14:33   0:00 sudo su perforce
root     19490  0.0  0.0 145472  1828 pts/0    S    14:33   0:00 su perforce
perforce 19492  0.0  0.0 108340  1768 pts/0    S    14:33   0:00 bash
root     20107  0.0  0.0 103252   836 pts/0    S+   14:49   0:00 grep perforce
[1]+  Exit 255                ./p4d -r /var/www/perforce/ -J /var/log/perforce/journal -L /var/log/perforce/p4err -p 1666

Reboot and check everything, and still can’t start:

[root@testcentos perforce]# ./p4d
Perforce Server starting...
^C[root@testcentos perforce]# p4d -r /var/www/perforce/ -J /var/log/journal -L /var/log/p4err -p tcp64:[::]:1666
[1] 3154
[root@testcentos perforce]# -bash: p4d: command not found
p4d -r /var/www/perforce/ -J /var/log/journal -L /var/log/p4err -p tcp64:[::]:1666^C
[1]+  Exit 127                p4d -r /var/www/perforce/ -J /var/log/journal -L /var/log/p4err -p tcp64:[::]:1666
[root@testcentos perforce]# ./p4d -r /var/www/perforce/ -J /var/log/journal -L /var/log/p4err -p tcp64:[::]:1666
[1] 3155
[root@testcentos perforce]# Perforce Server starting...

 

 

 

 

fu_p4.jpg

Doesn’t work:

[root@testcentos perforce]# ./p4 info
Perforce client error:
 Connect to server failed; check $P4PORT.
 TCP connect to perforce:1666 failed.
 Name or service not known
[root@testcentos perforce]# ./p4d
Perforce server error:
 Listen 1666 failed.
 TCP listen on 1666 failed.
 bind: 0.0.0.0:1666: Address already in use

FINALLY

It’s worked:

p4_works_centos.PNGProbably there is no output after ./p4d runs, but server is up and listen

 

Useful commands:

p4 info   — This should show if you can access the perforce server at all
p4 counters — This should give you a list of all counters
p4 counter change — This should give you the value of the change list counter, which is probably also requested by the hudson server.

About trianglesis

Александр Брюндтзвельт - гений, филантроп, 100 гривен в кармане. Этот блог - "сток" моих мыслей и заметок. Достаточно одного взгляда на него, чтобы понять, что такой же бардак творится у меня в голове. Если вам этот бардак интересен - милости прошу.
Bookmark the permalink.