2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[メモ] Raspberry Pi で、Perforceサーバ(p4d)を動かす

Last updated at Posted at 2016-09-07

(2020.7.15更新) 現在は、ARM向けのバイナリは提供されていません。(ftpからファイルも削除されてます)。


動機・概要

環境

  • Raspberry Pi 3
  • 2016-05-27-raspbian-jessie-lite

手順

  1. Raspbian焼いて、いつもの設定など

  2. p4dp4 の準備

ファイル取得

Raspberry Pi 1なら、armel

wget ftp://ftp.perforce.com/perforce/r16.1/bin.linux26armel/p4d

wget ftp://ftp.perforce.com/perforce/r16.1/bin.linux26armel/p4

Raspberry Pi 2/3 なら、armhf.

wget ftp://ftp.perforce.com/perforce/r16.1/bin.linux26armhf/p4d
wget ftp://ftp.perforce.com/perforce/r16.1/bin.linux26armhf/p4

実行属性つけて.

chmod +x p4 p4d

/usr/local/binにコピー.

sudo mv p4 p4d /usr/local/bin

3. テスト - [Run P4D and Your Website on a Raspberry Pi](https://www.perforce.com/ja/blog/140228/run-p4d-website-raspberry-pi)にかかれてることをやってみる
    - `p4d`: Perforceサーバを動かす。(`-d`をつけると、デーモンとなる.)

        ```bash
export P4PORT=localhost:1666
export P4ROOT=/home/pi/p4root
mkdir $P4ROOT
p4d -r $p4ROOT -p $P4PORT
- `p4`: クライアント

    ```bash

mkdir /home/pi/p4client
cd /home/pi/p4client
p4 -p $P4PORT client

ここで、viがたちあがってなんかでてくるので、:wq で保存して抜ける

テストファイル

echo " Hello World! " > index.html

addして、submit.

p4 -p $P4PORT add index.html
p4 -p $P4PORT submit -d "Adding index.html to my raspberry pi p4 server"

Pythonのhttpサーバを実行

python -m SimpleHTTPServer

ブラウザで、http://<ラズパイのIP>:8000 にアクセス

これで、らずぱい上で、Perforceでバージョン管理できるWebサイトが動いたね、、とのこと。


4. `systemd`の設定して、自動起動したい ... <font color='red'>うまくうごいてないです!!</font>
    - [Example systemd Perforce Service File](http://answers.perforce.com/articles/KB/10832)より
    - `sudo adduser perforce`<br>=>`perforce`というユーザーを作っておく
    - `sudo vi /lib/systemd/system/p4d.service`<br>=>以下のファイル作成。`/home/pi/p4root`にPerforceのレポジトリが生成される。ユーザ`perforce`が読み書きできる属性にしておくこと。

        ```txt:例_/lib/systemd/system/p4d.service
# Example Perforce systemd file (p4d.service):
#
# This service file will start Perforce at boot, and
# provide everything needed to use systemctl to control
# the Perforce server process.

        [Unit]
        # Note that descriptions are limited to 80 characters:
Description=Perforce Server

        # Starts Perforce only after the network services are ready:
After=network.target

        [Service]
        # The type should always be set to "forking" to support multiple Perforce processes:
Type=forking

        # Set the system user used to launch this process (usually 'perforce'):
User=perforce

        # The command used to start Perforce:
ExecStart=/usr/local/bin/p4d -r /home/pi/p4root -p localhost:1666 -d

        [Install]
# Describes the target for this service -- this will always be 'multi-user.target':
WantedBy=multiuser.target

その他

  • WinとかMacとか、Intel系Linuxだと、P4Vっていう、ヴィジュアルクライアントがある。
  • SDカードでの運用はいけないと思う。
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?