Install Perforce according to this: http://capnjosh.com/blog/installing-perforce-on-ubuntu-server-16/
Then run the configure script mentioned in what comes out after the installer ran.
That script essentially just sets up a .conf file in /etc/perforce/p4dctl.conf.d/
You can edit that thing directly or add another one if you want to have another perforce instance running on the same machine.
Note: you cannot use p4dctl with replication, as best as I can tell – it clobbers any “p4 configure” things that may have been set in the master-configured stuff ro the replica.
Start and Stop all perforce instanced mentioned in /etc/perforce/p4dctl.conf.d/:
p4dctl start -a
p4dctl stop -a