Skip to main content

VPS Deployment

Deploy PC2 on a Virtual Private Server for 24/7 access from anywhere.

ProviderSpecsPriceNotes
Contabo4 vCPU, 8GB RAM~$6/moBest value
Hetzner2 vCPU, 4GB RAM~$5/moEU-based
DigitalOcean2 vCPU, 4GB RAM$24/moEasy setup
Vultr2 vCPU, 4GB RAM$24/moGlobal locations
InterServer1 vCPU, 2GB RAM$6/moBudget option

Minimum Requirements: 1 vCPU, 2GB RAM, 20GB SSD, Ubuntu 22.04

SSH into your server and run:

curl -fsSL https://raw.githubusercontent.com/Elacity/pc2.net/main/scripts/start-local.sh | bash

Then access at http://YOUR_SERVER_IP:4200.

Manual Setup

1. Create Your VPS

  1. Sign up with your chosen provider
  2. Create a new VPS with Ubuntu 22.04 LTS
  3. Choose at least 2GB RAM
  4. Note your server IP address

2. Connect and Install Dependencies

ssh root@YOUR_SERVER_IP

apt update && apt upgrade -y

curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs git
npm install -g pm2

3. Clone and Build PC2

cd ~
git clone https://github.com/Elacity/pc2.net
cd pc2.net

npm install --legacy-peer-deps --ignore-scripts

cd pc2-node
npm install --legacy-peer-deps
npm run build
cd ..

4. Create Systemd Service

cat > /etc/systemd/system/pc2-node.service << 'EOF'
[Unit]
Description=PC2 Node - Personal Cloud
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/pc2.net/pc2-node
ExecStart=/usr/bin/node dist/index.js
Restart=on-failure
RestartSec=10
Environment=NODE_ENV=production
Environment=PORT=4200

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable pc2-node
systemctl start pc2-node

5. Configure Firewall

ufw allow 22      # SSH
ufw allow 4200 # PC2
ufw allow 80 # HTTP (for SSL)
ufw allow 443 # HTTPS
ufw enable

6. Verify

curl http://localhost:4200/health

Get HTTPS Access

Option A: Free *.ela.city Subdomain (Easiest)

  1. Open your PC2 at http://YOUR_IP:4200
  2. Go to Settings -> Network
  3. Register your subdomain

Access at https://yourname.ela.city.

Option B: Custom Domain with Caddy

apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update
apt install caddy

cat > /etc/caddy/Caddyfile << 'EOF'
yourdomain.com {
reverse_proxy localhost:4200
}
EOF

systemctl restart caddy

Caddy automatically gets SSL certificates from Let's Encrypt.

Managing Your Node

systemctl status pc2-node     # Check status
systemctl start pc2-node # Start
systemctl stop pc2-node # Stop
systemctl restart pc2-node # Restart
journalctl -u pc2-node -f # View logs (live)
journalctl -u pc2-node -n 100 # Last 100 lines

Updating

Via UI (Recommended): Settings -> About -> Check for Updates -> Install Update

Via Terminal:

cd ~/pc2.net && git fetch origin && git reset --hard origin/main
cd pc2-node && npm install --legacy-peer-deps && npm run build
systemctl restart pc2-node

Backup

systemctl stop pc2-node
cd ~/pc2.net/pc2-node
tar -czvf ~/pc2-backup-$(date +%Y%m%d).tar.gz data/
systemctl start pc2-node

Security Hardening

Create Non-Root User

adduser pc2admin
usermod -aG sudo pc2admin
mkdir -p /home/pc2admin/.ssh
cp ~/.ssh/authorized_keys /home/pc2admin/.ssh/
chown -R pc2admin:pc2admin /home/pc2admin/.ssh

Update the systemd service to use pc2admin instead of root.

Having issues? See Troubleshooting.