Install on Ubuntu

A virtual machine with 1 GB RAM is sufficient.

Use SSH to connect to your virtual machine.

Quick automated install

This has been tested on Debian 9, 10 and 11 and Ubuntu 18.04, 20.04 and 21.04. All you need is to run these three lines on the command line shell, as root or as a user with sudo access:

wget -qO - https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt-get install -qqy nodejs
npx saltcorn-install -y

The first two lines will install Node.js 14. The last line will call the Saltcorn install script accepting all the defaults, Which installs PostgreSQL and sets up Saltcorn as a service listening on port 80.

If you want a different port or a different database backend, or not install as a service, You can omit the final -y to get an interactive installation:

wget -qO - https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt-get install -qqy nodejs
npx saltcorn-install


The following sections explain more manual installation procedures, but there is no need to do that if the quick automated install works for you.

Manual installation

These instructions are for Ubuntu 20.04 (we have not tested with other versions or other distributions, but it should work. You may need to install the python3 package instead of python-is-python3 on earlier versions of Ubuntu/Debian ).

Install node.js

wget -qO - https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs libpq-dev build-essential python-is-python3 

Create a user

adduser saltcorn
adduser saltcorn sudo
su saltcorn
cd
mkdir -p ~/.config/
npm config set prefix /home/saltcorn/.local
echo 'export PATH=/home/saltcorn/.local/bin:$PATH' >> /home/saltcorn/.bashrc
source /home/saltcorn/.bashrc

Install saltcorn

npm install -g @saltcorn/cli

if this fails, you may need to tell npm to disregard file permissions during compilation:

npm install -g @saltcorn/cli --unsafe

Setup saltcorn

run

saltcorn setup and follow instructions. It will ask you for a sudo password, enter the one you set when you created the saltcorn user.

now exit to become root user again

exit

Now run Saltcorn manually as the saltcorn user:

sudo -u saltcorn saltcorn serve

and check that you can connect to your server through your domain. If not, check your DNS setup. If everything works, go back to your SSH terminal and stop the saltcorn server by pressing Ctrl-C.

Install saltcorn as a service

Installing saltcorn as a service will mean it runs in the background and restarts automatically if the system reboots.

create a file /lib/systemd/system/saltcorn.service with these contents:

[Unit]
Description=saltcorn
Documentation=https://saltcorn.com
After=network.target

[Service]
Type=notify
WatchdogSec=5
User=saltcorn
WorkingDirectory=/home/saltcorn
ExecStart=/home/saltcorn/.local/bin/saltcorn serve -p 80
Restart=always
Environment="NODE_ENV=production"

[Install]
WantedBy=multi-user.target

You may need to make the node executable able to open port 80 for non-root users:

sudo setcap 'cap_net_bind_service=+ep' `which node`

then run:

sudo systemctl daemon-reload
sudo systemctl start saltcorn
sudo systemctl enable saltcorn

Update existing installation of saltcorn

Note that it is recomended to make backup of server before do update.

Repeat the 

npm install -g @saltcorn/cli --unsafe

command as the saltcorn user, and then sudo systemctl start saltcorn

A fully manual set up

This is a fully manual set up that uses neither npx saltcorn-install nor the saltcorn setup CLI command. This is the process used to create the DigitalOcean marketplace image:

  1. Install these apt packages: https://github.com/saltcorn/saltcorn/blob/v0.5.4/deploy/digitalocean-marketplace/packages.txt
  2. Run this script as root to install node and allow it to open port 80 as a non-root user: https://github.com/saltcorn/saltcorn/blob/v0.5.4/deploy/digitalocean-marketplace/scripts/10-install-node
  3. Run the script as root to set up the database, install saltcorn and enable ufw and unattended upgrades: https://github.com/saltcorn/saltcorn/blob/v0.5.4/deploy/digitalocean-marketplace/scripts/20-setup. You can omit the last steps (after line 12) if you don't need a firewall or unattended upgrades
  4. Copy this file (the systemd unit)  to /lib/systemd/system/saltcorn.service: https://github.com/saltcorn/saltcorn/blob/v0.5.4/deploy/digitalocean-marketplace/files/lib/systemd/system/saltcorn.service
  5. Run this script as root to set up the Saltcorn configuration and enable the daemon: https://github.com/saltcorn/saltcorn/blob/v0.5.4/deploy/digitalocean-marketplace/files/var/lib/cloud/scripts/per-instance/01-set-secret
  6. Saltcorn should now be running!