Install: Build from source

Benjamin Sautner edited this page Feb 24, 2017 · 12 revisions

Building and deploying nimbits server on a debian (ubuntu) based linux system from source.

We maintain an install script that when executed on a new ubuntu server, it will setup the box with everything needed to run a new server. If all goes well, the new machine will have tomcat8, mySQL Server and nimbits running on http://[ipaddress]:8080/nimbits.

Once you login to the new system, run the following commands to start the setup process:

sudo apt-get install git
git clone https://github.com/bsautner/com.nimbits.git
cd com.nimbits/scripts
chmod +x install.sh 
sudo ./install.sh

You'll be prompted several times for things such as a database password. The default database root password is nimbits. Which you can change see: mySQL setup.

If you use a different password than the default, and build directly from source the application won't start and you'll get a 404 from the server. You'll be prompted for the database password twice during sql install, and a third time later in the setup - they all must be the same!

Advanced Installation

In this wiki i'm going to document all of the steps I follow to spin up a nimbits server on a fresh ubuntu installation which the above script does for you.

In this case, i'm starting with a new Amazon EC2 instance on AWS using the Ubuntu Server Image. I selected an instance type of t2.small as anything smaller cannot build the server. A machine should have at least 2gb of ram to compile nimbits. If you plan to deploy to a Raspberry Pi or similar device, just build the server on a separate machine first.

Securing the server

Besides accepting basic http authentication, nimbits does not have any built in security. It relies on a correctly configured firewall. You should only allow traffic to your server from specific known IP Addresses, such as a web server you own that uses nimbits as a backend, or a proxy server.

When configuring firewalls, ensure ssh port and port 8080 are open, you can change ports for both of these to something random. The default http port is 8080.

Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-fce3c696
Ubuntu Server 14.04 LTS (HVM), EBS General Purpose (SSD) Volume Type. Support available from Canonical (http://www.ubuntu.com/cloud/services).

Install Prerequisites:

Log into your minty fresh server e.g ssh -i keyfile.pem ubuntu@54.174.238.254

Update the server

sudo apt-get update
sudo apt-get upgrade
sudo apt-get upgrade-dist
sudo apt-get autoremove
sudo apt-get clean

Install JAVA

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

set the $JAVA_HOME variable in the ~/.profile file:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Install GIT, Tomcat and Build tools

I'm installing tomcat 7 here, but nimbits works on most java containers.

sudo apt-get install tomcat7
sudo apt-get install git
sudo apt-get install maven

Verify tomcat installed ok by browsing to http://server.ip.address:8080

Install mySQL server and create an empty database. Nimbits will create the schema for you

sudo apt-get install mysql-server
mysql -u root -p
sql> create database nimbits;
sql> exit;

Build Nimbits

git clone https://github.com/bsautner/com.nimbits
cd com.nimbits
mvn clean install

Go have a beer.

When done, copy the server war file to the tomcat web directory. Here, I rename the file to ROOT.war which will put the server in the root context.

sudo rm -fR /var/lib/tomcat7/webapps/ROOT
sudo cp ./nimbits_server/target/nimbits_server.war /var/lib/tomcat7/webapps/ROOT.war
sudo service tomcat7 restart

Go back to http://server.ip.address:8080 and you should see a nimbits login. The first user you create here will be the admin of the instance.

For more reading see these wikis: