How I Installed Perforce on DigitalOcean
6 min read

How I Installed Perforce on DigitalOcean

I rarely touched server kinds of stuff, but I need to install Perforce on my server so I can collaborate with our team members on a project with many binary files in it. And I did it! Yay! Here's how.
How I Installed Perforce on DigitalOcean

Why Did I Do it?

I was searching for version control to put our fmod project somewhere. Git was unlikely to choose and I couldn't find any good tutorial on how to put the fmod project on Git.

Gladly fmod documented how to use source control on one's project. It supports SVN and Perforce natively. I don't care about which one to use. I just need to put our fmod project so we can work using a single project together. I need it fast, reliable, cheap, and proven to use.

After I tried to connect SVN to fmod without any success (it was a headache!), then I tried to use Perforce. Oh boy it was smooth as butter.

What is Perforce? What's the difference with git?

At first, I was confused because I just can't find "Perforce version control" on its website, that's because it's called Helix Core.

The page said, "Helix Core is the best version control". Hmm... Git is also version control. So what's the difference between git and Helix Core?

When someone talked about Perforce, maybe it's Helix Core

Git is a distributed version control, which means every person holds their repository data alongside its history changes. When someone pushes something, they push information about changes in the repo.

Helix Core, however, is centralized and using a single source of truth. Every team will change the project directly on a server called depot. When someone wants to change a file, they should "lock" it so that person owns that file and exclusively can submit the change to the server. It's like telling others "Hey guys! I'm updating this file first and don't change it before me, okay?". It's really good for binary files because the change is for the whole file instead of some specific line of text.

This article explains it better:

Git vs. Perforce: How to Choose (and When to Use Both) | Perforce Software
Git and Perforce both provide version control solutions. Git has been widely adopted for smaller code-only projects. And Perforce version control software (Helix Core) is known for enterprise-grade performance. Compare Git vs. Perforce.

Now on to technical stuffs thingy

Steps to Install Perforce on DigitalOcean


1. First, make sure you have a virtual machine to use. I used the cheapest one with Ubuntu for its OS, which is $5 a month.

2. SSH to your Droplet and enter this command so we can install Perforce
wget -qO - | sudo apt-key add -

3. Create a file in path /etc/apt/sources.list.d/perforce.list. Fill it with the following line {distro} release

Where {distro} is replaced with your Ubuntu distro version, which it could be: precise, trusty, xenial, bionic, or focal. I was using focal.

4. Run apt-get update

5. Run  sudo apt-get install helix-p4d

Create a user to install Perforce

It's better to install Perforce other than root. To do that, run this command to create a user named "perforce"

sudo adduser perforce

enter credential needed for that user

Create folder for your depots

1. Run this command to create a folder where your files resides
mkdir /opt/perforce/servers/{your folder name}

and set the ownership of that folder to our user

sudo chown perforce /opt/perforce/servers/{your folder name}

2. Create a folder where you put your logs
mkdir /var/log/perforce

and also set the ownership of this folder

sudo chown perforce /var/log/perforce

Post Installation

1. After installations complete, setup your configuration by running this command

Make sure to enter your "server root" with /opt/perforce/servers/{your folder name}.

Also, make sure to note-down your Superuser login and password

Prevent Unauthorized Access

By default, Perforce Helix will create a user when executed by a nonexistent user. To prevent this from happening, run this command so only Superuser can create a user.

p4 configure set dm.user.noautocreate=2

Run perforce as a service

1. Run this command to put our service script configuration

2. Run your favorite text file and create a file called p4dservice. I was using Vim, so I ran vim p4dservice. Add this script into that file. Make sure to replace {your folder name} and {your super user name} with your own configuration.



# Provides: p4dservice

# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and Stop
# Description:

export P4JOURNAL=/var/log/perforce/journal
export P4LOG=/var/log/perforce/p4err
export P4ROOT=/opt/perforce/servers/{your folder name}
export P4PORT=1666
export P4USER={your super user name}


. /lib/lsb/init-functions

p4start="p4d -d"
p4stop="p4 admin stop"

case "$1" in
    log_action_begin_msg "Starting Perforce Server"
    daemon -u $p4user -- $p4start;

    log_action_begin_msg "Stopping Perforce Server"
    daemon -u $p4user -- $p4stop;


    echo "Usage: /etc/init.d/perforce (start|stop|restart)"
    exit 1


exit 0

If you installed ssl, set your P4Port to ssl:1666

After you created this file, then run

chmod +x p4dservice

Finally, run

sudo update-rc.d p4dservice defaults

and then reboot your Droplet with

sudo reboot

Run the P4V

Your perforce will run after your droplet is rebooted. Now you can use it with your P4V!

Download the P4V here

Helix Visual Client (P4V) | Perforce
Helix Visual Client gives you visibility and control over your assets. Use the P4V download for time-lapse and revision views, insight into your project metadata, and a powerful GUI.

Install P4V application and enter your credential with your droplet's IP:1666 and use your super's account, and now you're ready to go!

I wanted to uninstall Helix Core, how do I do that?

When I tried to install perforce, I did many mistakes and would like to redo all installations. To do that just run these commands (thanks to this SO!)

sudo apt-get remove helix-p4d
sudo apt-get purge helix-p4d
sudo apt autoremove
sudo rm /etc/perforce
sudo rm /opt/perforce
sudo apt-get remove helix-p4dctl
sudo apt-get purge helix-p4dctl

Do you still find difficulties?

I also found this article from Allar is greatly helpful. I learned from this article first, but need some more grain control over my Droplet and do more manual installation instead. But, if you need something run in no time, you can follow his tutorial and use his script. Check it out!

Setting up version control (Perforce) for Unreal Engine 4 using DigitalOcean and Ubuntu (Part 1)
A common question with Unreal Engine 4 (UE4) [] is“how do you set up version control?” I think this is a very important questionand if you have never used version control for your projects you are cripplingyourself from the start. I won’t go into details about why you s…

Enjoying this blog? Support me!