LoginSignup
2
2

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にかかれてることをやってみる

    • p4d: Perforceサーバを動かす。(-dをつけると、デーモンとなる.)

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

      mkdir /home/pi/p4client
      cd /home/pi/p4client
      p4 -p $P4PORT client
      #ここで、viがたちあがってなんかでてくるので、:wq で保存して抜ける
      #
      # テストファイル
      echo "<html> Hello World! </html>" > 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の設定して、自動起動したい ... うまくうごいてないです!!

    • Example systemd Perforce Service Fileより
    • sudo adduser perforce
      =>perforceというユーザーを作っておく
    • sudo vi /lib/systemd/system/p4d.service
      =>以下のファイル作成。/home/pi/p4rootにPerforceのレポジトリが生成される。ユーザperforceが読み書きできる属性にしておくこと。

      例_/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