(2020.7.15更新) 現在は、ARM向けのバイナリは提供されていません。(ftpからファイルも削除されてます)。
動機・概要
-
たまたま、こういう記事を見てしまった : 自前でPerforceサーバー立てたいけど(2016.09.07)
-
Perforce ... なつかしい... ARMのバイナリ配布してるのか、、。。Git Fusionってなんだ!?!?(こっちはうごかしていない)
-
Perforceサーバは、
p4d
を実行すれば動く。 -
ユーザ5人までは無料 https://www.perforce.com/purchase/pricing-licensing
Free for Small Teams: Up to 5 Free
Perforce Helix SCM and content collaboration solutions are free for up to 5 users.
環境
- Raspberry Pi 3
2016-05-27-raspbian-jessie-lite
手順
-
Raspbian焼いて、いつもの設定など
-
p4d
とp4
の準備
ファイル取得
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カードでの運用はいけないと思う。