The following installation is based on Debian Operating System (Jessie 8.4.4) and the installation commands are executed as a root user.
First of all, Login as the root user using the following command:
sudo su -
You're now logged in as the root user. Run the following commands:
-
Add the repository source:
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list -
verify it with the keys:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 -
Update the apt-get package manager:
apt-get update -
Install the java8 package:
apt-get install oracle-java8-installer
apt-get install oracle-java8-set-default -
Check whether the installation is successful using the following command:
java -version -
Create a user for the tomcat Server (before we install the Tomcat server):
sudo adduser --system --shell /bin/bash --gecos 'Tomcat Java Servlet and JSP engine' --group --disabled-password --home /home/tomcat tomcat -
Create a directory called tmp:
mkdir -p ~/tmp -
Choose the directory:
cd ~/tmp -
Download the Apache Tomcat Server from a mirror:
wget http://muug.ca/mirror/apache-dist/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz -
unzip the tar contents:
tar xvzf ./apache-tomcat-8.5.20.tar.gz -
Once you unzip the contents, you can delete the gzip file:
rm ./apache-tomcat-8.5.20.tar.gz -
Move the Apache Tomcat directory to /usr/share :
sudo mv ./apache-tomcat-8.5.20/ /usr/share/ -
remove the older tomcat directory(if you have any) to make sure you are using the newest version:
sudo rm -f /usr/share/tomcat -
Provide the soft link to Apache tomcat directory:
sudo ln -s /usr/share/apache-tomcat-8.5.5 /usr/share/tomcat -
Install the apache server:
apt-get install apache2 -
Load and source the environment configurations of apache2 server:
source /etc/apache2/envvars -
Start the Apache server:
/etc/init.d/apache2 start -
To print the process info of apache server:
ps -ef | grep apache -
Install the MySql server:
sudo apt-get install mysql-server -
Now we will need to add the
character-set-server=utf8line to the my.cnf file(read the next step) -
Open the my.cnf file in nano file editor using
nano /etc/mysql/my.cnfand add this linecharacter-set-server=utf8at the end of the file
(You can exit the nano editor withCtrl+x, then typeyat the prompt and hitEnter) -
Login to MySQL:
mysql -u root -p
Enter your password at the prompt -
Execute following commands in Mysql interpreter:
Create a database user called webanno with your password 'enter_your_password' which is later used by the application to access the database (instructions for settings.properties file below).
mysql>
CREATE DATABASE webanno DEFAULT CHARACTER SET utf8 COLLATE utf8_bin ;mysql>
CREATE USER 'webanno'@'localhost' IDENTIFIED BY 'enter_your_password';mysql>
GRANT ALL PRIVILEGES ON webanno.* TO 'webanno'@'localhost';mysql>
exit -
Install aptitude package manager with following command:
aptitude install tomcat8-user authbind -
Create a directory called /opt:
cd /opt/ -
Create a new Tomcat Instance:
tomcat8-instance-create -p 18080 -c 18005 webanno -
Change the permissions of /opt/webanno:
chown -R www-data /opt/webanno -
Open the webanno configuration file in nano editor using:
nano /etc/init.d/webanno -
Paste the following script in the file:
#!/bin/sh
# Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: webanno
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: WebAnno init script
# Description: This file should be placed in /etc/init.d. It
# allows starting/stopping WebAnno using the
# "service" command and ensures that WebAnno starts
# when the system is booted.
### END INIT INFO
# Author: Richard Eckart de Castilho
NAME="WebAnno"
DAEMON=none
WEBANNO_HOME="/srv/webanno"
WEBANNO_PORT="18080"
WEBANNO_USER="www-data"
CATALINA_BASE="/opt/webanno"
AUTHBIND=""
JAVA_OPTS="-Djava.awt.headless=true -Xmx750m -XX:+UseConcMarkSweepGC -Dwebanno.home=$WEBANNO_HOME"
setup_authbind() {
# log_action_msg "Setting up authbind configuration for $DESC on port $WEBANNO_PORT"
touch /etc/authbind/byport/$WEBANNO_PORT
chmod 500 /etc/authbind/byport/$WEBANNO_PORT
chown $WEBANNO_USER /etc/authbind/byport/$WEBANNO_PORT
AUTHBIND="authbind --deep"
}
tomcat_pid() {
echo `ps -fe | grep -- "-Dcatalina.base=$CATALINA_BASE" | grep -v grep | tr -s " "|cut -d" " -f2`
}
do_start_cmd_override() {
if [ $WEBANNO_PORT -lt 1024 ]
then
setup_authbind
fi
su - www-data -s "/bin/bash" -c "JAVA_OPTS=\"$JAVA_OPTS\" $AUTHBIND $CATALINA_BASE/bin/startup.sh" > /dev/null 2>&1
}
do_stop_cmd_override() {
su - www-data -s "/bin/bash" -c "$CATALINA_BASE/bin/shutdown.sh" > /dev/null 2>&1
}
do_status() {
local pid
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
log_action_msg "Status $DESC: running"
return 0
else
log_action_msg "Status $DESC: stopped"
return 1
fi
}You can exit the nano editor with Ctrl+x , then type y at the prompt and hit Enter
-
Change the permissions of the above script file to an executable:
chmod +x /etc/init.d/webanno -
Update the boot script to include webanno while starting system:
update-rc.d webanno defaults -
Download the Webanno Web archive(.WAR) file:
wget https://github.com/webanno/webanno/releases/download/webanno-3.2.2/webanno-webapp-3.2.2.war -
Moving the .WAR file to /opt/webanno/webapps:
cp webanno-webapp-3.2.2.war /opt/webanno/webapps/webanno.war -
Create a directory
/srv/webannousing following command:
mkdir /srv/webanno -
Open the file settings.properties in the nano editor:
nano /srv/webanno/settings.properties -
Paste the following properties definition:
database.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/webanno?useSSL=false
database.username=webanno
database.password=t0t4llYSecreT
# 60 * 60 * 24 * 30 = 30 days
backup.keep.time=1000000
# 60 * 5 = 5 minutes
backup.interval=1000
backup.keep.number=10
ui.brat.sentences.number = 5You can exit the nano editor with `Ctrl`+`x` , then type `y` at the prompt and hit `Enter`
-
Change the permissions of webanno home directory:
chown -R www-data /srv/webanno -
Finally, Start WebAnno!
service webanno startWebAnno will be up and running at
http://localhost:18080/webanno -
Following commands will display all the active ports with the service name:
netstat -lp
Following are the commands to run ngrok. (No need to run the following commands if we are exposing the Port on web using the instance IP)
40. wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
41. unzip ngrok-stable-linux-amd64.zip
42. apt-get install unzip
43. unzip ngrok-stable-linux-amd64.zip
45. ./ngrok authtoken
46. ./ngrok http 18080
47. nano /root/.ngrok2/ngrok.yml
48. nohup ./ngrok http 18080
49. nano nohup.out
50. ngrok -log=stdout 18080 > ngrok.log &
51. ps -ef | grep ngrok
Official WebAnno Installation guide Installation steps are available on this link but it's not up-to-date and it assumes you have server installed with a user called www-data.