-
Notifications
You must be signed in to change notification settings - Fork 0
Home
$ sudo apt-get update
$ sudo apt-get install mysql-server
$ sudo mysql_secure_installation
$ sudo mysql_install_db
Edit mysql config file:
$ sudo nano /etc/mysql/my.cnf
Comment out following lines:
#bind-address = 127.0.0.1
#skip-networking
and then
$ sudo service mysql restart
Change GRANT privilege:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
$ sudo apt-add-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
For security purposes, Tomcat should be run as an unprivileged user (i.e. not root) so create a new user and group that will run the Tomcat service. Create a new tomcat
group and a user tomcat
. Make the user a member of the tomcat group, with a home directory of Tomcat where Tomcat installed e.g. /opt/tomcat
, and with a shell of /bin/false
so nobody can log into the account:
$ sudo groupadd tomcat
$ sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
Go to the Tomcat home and creat target/lucenefiles/
for deployment use later, then give tomcat
user write access to it and the conf
directory, also read access to the files in the path:
$ sudo chgrp -R tomcat conf target
$ sudo chmod g+rwx conf
$ sudo chmod g+r conf/*
$ sudo chmod +rw target/*
Make sure 'tomcat' user the owner of the work, temp, and logs directories:
$ sudo chown -R tomcat work/ temp/ logs/
Create a Upstart script:
$ sudo nano /etc/init/tomcat.conf
Paste in the following script:
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid tomcat
setgid tomcat
env JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
env CATALINA_HOME=/opt/tomcat
# Modify these options as needed
env JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
env CATALINA_OPTS="-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
exec $CATALINA_HOME/bin/catalina.sh run
# cleanup temp directory after stop
post-stop script
rm -rf $CATALINA_HOME/temp/*
end script
Save and exit.
Edit tomcat-users.xml
file:
$ sudo nano /opt/tomcat/conf/tomcat-users.xml
Copy and paste in the following content:
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="password" roles="tomcat,role1,admin-gui,manager-gui/>
</tomcat-users>
Now Tomcat is ready to be run. Start it with the following command: sudo initctl start tomcat
.
Go to the Tomcat Manager App via the link http://localhost:8080/manager/html
.
In the Deploy section, WAR file to deploy subsection, click on Browse. The WAR file can be found in target
directory after HAPI-FHIR-JPASERVER built by using mvn -X install
please check the official document for details.
Hit Deploy button and done.
Now the server can be accessed at the following URL: http://localhost:8080/hapi-fhir-jpaserver/