Cheatsheet for Installing in Linux Server

Launch a new host/instance

Sign up with https://www.digitalocean.com/

Upload an ssh key.

Create a droplet. "Ubuntu 17.04 x64, 2 GB Memory / 40 GB Disk" works well. The next size down can also work, though it will become overloaded if a few people visit the domain at once.

Visit digitalocean's droplets page and discover the ip address of your new host. Whenever you see x.x.x.x below, use the ip address.

Create a Non-root User

Log into the new host. Make a non-root account and copy root's ssh public keys into it. Give the new account sudo rights with usermod.

ssh root@x.x.x.x
adduser hifi
cp -r ~root/.ssh ~hifi/.ssh
chown -R hifi:hifi ~hifi/.ssh
usermod -aG sudo hifi
exit

Install Build Requirements

Log into the new host as the non-root user. Install the prerequisites for building High Fidelity's servers.

ssh hifi@x.x.x.x
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libssl-dev cmake
sudo apt-get install qt*5-dev libqt5quick5 libqt5websockets5-dev

Checkout High Fidelity's Source and Build

git clone https://github.com/highfidelity/hifi.git
cd hifi
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSERVER_ONLY=TRUE ..
make -j2

Set up Systemd Files

sudo su
mkdir -p /var/log/hifi/

cat > /etc/systemd/system/domain-server.service <<EOF
[Unit]
Description=Domain Server service for High Fidelity
After=network.target
[Service]
Restart=on-failure
WorkingDirectory=/home/hifi/hifi/build/domain-server
ExecStart=/bin/bash -c 'ulimit -c unlimited; /home/hifi/hifi/build/domain-server/domain-server 2>&1 >>  /var/log/hifi/domain-server.log'
[Install]
WantedBy=multi-user.target
EOF

cat > /etc/systemd/system/assignment-client.service <<EOF
[Unit]
Description=Assignment client service for High Fidelity server
After=network.target
PartOf=assignment-clients.target
[Service]
Restart=always
Environment="LD_LIBRARY_PATH=/home/hifi/hifi/build/ext/makefiles/nvtt/project/lib/"
WorkingDirectory=/home/hifi/hifi/build/assignment-client
ExecStart=/bin/bash -c 'ulimit -c unlimited; /home/hifi/hifi/build/assignment-client/assignment-client -n7 2>&1 >> /var/log/hifi/assignment-client.log'
[Install]
WantedBy=assignment-clients.target
EOF

Run the Servers

systemctl start domain-server
systemctl start assignment-client

Adjust Server Settings

Visit the domain-server page: http://x.x.x.x:40100/ and add a password (don't use a password that's in use elsewhere).

See domain-server settings documentation.

Building on Older Ubuntu

The only reason for Ubuntu 17 is to get acceptable Qt packages. Older Ubuntu works fine if you can run Qt's installer. It's possible to run Qt's installer on a local Linux machine and install to ~/Qt, and then

rsync -avP ~/Qt/ hifi@x.x.x.x:Qt/

Depending on your net connection, you might also be able to just run the installer from the cloud host and have it display on your local X server.

Before running cmake, do

export QT_CMAKE_PREFIX_PATH=/home/hifi/Qt/5.9/gcc_64/lib/cmake/

you'll need to adjust the path to match the exact version of Qt you install. If this works, cmake will configure the build to use the Qt libraries from ~/Qt rather than looking for system libraries.

Domain Content

Built this way, the entity data will be here:

/home/hifi/.local/share/High Fidelity - dev/assignment-client/entities/models.json.gz

It would make sense to set up a recurring backup of this directory.

You may also want to give this server a place name.