Skip to content

Creating the OpenSprites Server

James edited this page Aug 9, 2016 · 9 revisions

Initial Setup

  1. Create a new 64bit Ubuntu Server LTS installation. This guide assumes the server is remote and SSH has already been installed.
  2. Log in via SSH into the root account.
  3. Update packages using apt-get update and apt-get upgrade.
  4. Change the hostname with hostname opensprites and edit /etc/hostname, and then reboot.
  5. Create a new non-root user to work with: useradd osuser, mkdir /home/osuser, mkdir /home/osuser/.ssh, chmod 700 /home/osuser/.ssh.
  6. Create a strong password for the non-root user with passwd osuser.
  7. Open the sudoers file by running visudo. Add the line osuser ALL=(ALL) ALL.
  8. On your local machine, use ssh-keygen -t rsa to generate a new RSA key for authentication.
  9. You will now need to copy id_rsa.pub to the server with ssh-copy-id osuser@<host>.
  10. Open the SSH server configuration file with nano /etc/ssh/sshd_config and use CTRL-W to find PermitRootLogin and PasswordAuthentication. Set the values for both to no. To save, press CTRL-X and then type y followed by enter to confirm.
  11. Restart the SSH server for the changes to come into effect using service ssh restart.
  12. Allow the following ports through the firewall with ufw allow 22, ufw allow 80, ufw allow 443, and finally, ufw enable.
  13. Close the root SSH session and continue using the non-root account.

##Installing OpenSprites-Next

  1. Install build essential and the GNU C++ compiler using sudo apt-get install build-essential g++.
  2. Make sure you are in /home/osuser before downloading node.js 6.2.2 with wget https://nodejs.org/download/release/v6.2.2/node-v6.2.2.tar.gz.
  3. Extract the archive with tar -xvf node-v6.2.2.tar.gz and then delete it to save space by running rm node-v6.2.2.tar.gz.
  4. Using cd, enter the new directory.
  5. Run ./configure, followed by make and finally sudo make install. This may take a while.
  6. Install the libcap2-bin if you have not already with sudo apt-get install libcap2-bin.
  7. Allow node.js to run on port 80 with sudo setcap cap_net_bind_service=+ep /usr/local/bin/node.
  8. Install MongoDB from the Ubuntu repository by executing sudo apt-get install mongodb. MongoDB should now start with Ubuntu automatically.
  9. Run mongo to open the shell. Create the OpenSprites-next database with use next. MongoDB creates databases on the fly, so create a temporary collection to retain it by executing db.createCollection('temp').
  10. Create the database user with db.createUser( {user: 'databaseuser', pwd: 'databasepassword' } ). Remember the username and password for later. Exit the shell with CTRL-C.
  11. Download the OpenSprites Next with git clone https://github.com/OpenSprites/OpenSprites-next.git opensprites-next, before entering the directory with cd opensprites-next.
  12. Install node-gyp by executing npm install -g node-gyp.
  13. Install node-canvas with sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev, followed by npm install canvas.
  14. Check Python 2.7 is installed by running sudo apt-get install python2.7.
  15. Install Sound eXchange using sudo apt-get install sox.
  16. Create a new file in with nano .env and copy in the config file.
  17. Replace the database username an password with the MongoDB credentials made earlier. Change the hostname to the IP address or domain where the website is being hosted.
  18. Run npm install, followed by npm run build, and finally npm start to run the server.

##Errors If you get errors during install, try running the following commands.

npm rebuild lwip
npm rebuild bcrypt
npm rebuild canvas

Clone this wiki locally