Skip to content

Instantly share code, notes, and snippets.

@johan--
Forked from travist/README.md
Created January 18, 2019 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johan--/a6f55ffd67b99541ea8210f3a7f6d593 to your computer and use it in GitHub Desktop.
Save johan--/a6f55ffd67b99541ea8210f3a7f6d593 to your computer and use it in GitHub Desktop.
Installing Form.io on Ubuntu Server

Installing Form.io Enterprise on Ubuntu Sever

This is a complete installation script of a standalone Form.io server within Ubuntu Server. You must upgrade one of your Form.io projects to Enterprise to get this working.

#!/bin/bash
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential checkinstall
# If you are using VirtualBox, you will probably also want to install ssh.
# sudo apt-get install ssh
# sudo service ssh start
# sudo systemctl enable ssh
#
# You can then enable Port Forwarding (with NAT) with local port of
# 2222 to virtual box port of 22, and then log in using the following command.
#
# ssh -p 2222 formio@localhost
#
sudo apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev tcl8.5 libgdbm-dev libc6-dev libbz2-dev
# Python 2.7
cd ~
wget http://python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar -xvf Python-2.7.12.tgz
cd Python-2.7.12
./configure
make
sudo checkinstall -y
cd ~
sudo rm -rf Python*
# Node.js
cd ~
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
# Redis
cd ~
wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
sudo make install
sudo mkdir /etc/redis
sudo cp redis.conf /etc/redis/
cd ~
sudo rm -rf redis-stable*
sudo sed -i 's/supervised no/supervised systemd/g' /etc/redis/redis.conf
echo "[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target" | sudo tee /lib/systemd/system/redis.service
sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis
sudo chown redis:redis /var/lib/redis
sudo chmod 770 /var/lib/redis
sudo systemctl enable redis
sudo systemctl start redis
# MongoDB
cd ~
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y --allow-unauthenticated mongodb-org
echo "[Unit]
Description=High-performance, schema-free document-oriented database
Documentation=man:mongod(1)
After=network.target
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target" | sudo tee /lib/systemd/system/mongodb.service
sudo systemctl enable mongodb.service
sudo systemctl start mongodb
# PM2
sudo npm install -g pm2
# RUNNING...
cd ~/formio-server
export PROTOCOL='http';\
export PORT=3000;\
export ADMIN_EMAIL="test@example.com";\
export ADMIN_PASS="CHANGEME";\
export DB_SECRET="CHANGEME";\
export JWT_SECRET="CHANGEME";\
pm2 start server.js
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup systemd -u formio --hp /home/formio"
pm2 save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment