
Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 1/24 PhenotypeDatabase / GSCF How to install dbNP/GSCF with java 8, tomcat 8, Apache, PostgreSQL 9.5 On CentOS 7 / RHEL 7 This tutorial builds heavily on the instructions that can be found on the PhenotypeDatabase github page https://github.com/PhenotypeFoundation/PhenotypeDatabase#installation Finn Sandø Department of Nutrition, Exercise and Sports (NEXS) University of Copenhagen Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 2/24 PhenotypeDatabase / GSCF Introduction In this tutorial it is assumed that you are logged in to a freshly installed CentOS 7 or RHEL 7 server (Redhat Enterprise Linux - RHEL). l will go through installing and configuring: Java 8 – I will show how to install java both from the distribution repository and directly from Oracle Tomcat 8 – java application server Apache – web server (will act as web facing front end) mod_jk – a necessary component for Apache not natively supported by Redhat that needs to be compiled PostgreSQL 9.5 – The latest version of postgres Virtual hosts – the dbNP website (mostly copy-paste from the PhenotypeDatabase github page) dbNP/GSCF – the main java application itself Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 3/24 PhenotypeDatabase / GSCF Installing a few utilities First a few utilities are needed. In order to download files I will use the program ”wget” and in order to edit text files I will use the text editor ”nano”. Most of the commands in this tutorial need to be executed as ”root”, so the easiest is to just ”become root” by this: sudo su To install progams in CentOS/Redhat you use the package manager ”yum” Type this to install ”wget” and ”nano” yum install wget nano When using the nano editor use ctrl+o to save and ctrl+x to leave Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 4/24 PhenotypeDatabase / GSCF Installing java 8 – from repository To install from the repository is simple yum install java-1.8.0-openjdk yum install java-1.8.0-openjdk-devel To check the installation java -version whereis java which java Installing java 8 – from Oracle It may sometimes be needed to use one of the versions provided directly from Oracle First go to Oracle’s website to find the latest version of java http://www.oracle.com/technetwork/java/javase/downloads Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 5/24 PhenotypeDatabase / GSCF Scroll down, find and click the ”jre” button Accept the licence agreement Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 6/24 PhenotypeDatabase / GSCF Find the linux-x86 "rpm" version This is the version for RHEL and CentOS. Note the address, in this case http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jre-8u92-linux-x64.rpm To download java into the current folder use wget, type (or copy) the following to the command line wget --no-cookies --no-check-certificate \ --header "Cookie: gpw_e24=http://www.oracle.com/; \ oraclelicense=accept-securebackup-cookie" \ "http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.rpm" After the file is successfully downloaded type this to install rpm -ivh jdk-8u92-linux-x64.rpm Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 7/24 PhenotypeDatabase / GSCF Installing Tomcat 8 In this part I wil Find and download latest version of Tomcat from the Tomcat site Install Tomcat into the /opt folder Prepare the system for Tomcat Configure Tomcat First, in order to get the lastest version go to the tomcoat.org site http://tomcat.apache.org/download-80.cgi Scroll down to the latest version, not the address in this case http://ftp.download-by.net/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.tar.gz To download tomcat files into the current folder wget http://ftp.download-by.net/apache/tomcat/tomcat-8/v8.0.33/bin/apache-tomcat-8.0.33.tar.gz Unpack (this will unpack the downloaded file into a folder "apache-tomcat-8.0.33") tar xzf apache-tomcat-8.0.33.tar.gz Move the Tomcat files into the /opt folder mv apache-tomcat-8.0.33 /opt/ Go the /opt folder, in order to standardize access to Tomcat create a symbolic link to the Tomcat folder cd /opt ln -s apache-tomcat-8.0.33 tomcat List the content of /opt ls –l Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 8/24 PhenotypeDatabase / GSCF drwxr-xr-x. 10 tomcat tomcat 4096 Apr 27 18:30 apache-tomcat-8.0.33 lrwxrwxrwx 1 root root 20 Apr 26 18:39 tomcat -> apache-tomcat-8.0.33 Prepare the system for Tomcat First we need to add a tomcat user and a tomcat group, tell the system that this user’s home dir is /opt/tomcat and, for security reasons, disallow this user login rights. add tomcat user groupadd tomcat sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat Next the permissions on the /opt/tomcat folder need to be set Under normal operation the Tomcat user only needs to be able to change a few config files. Therefore the most secure setup is to make ”root” owner of everything execpt for these few files. Set all files in the /opt folder to be owned by root cd /opt chown root:root . -R Allow the tomcat user to change a few config files cd tomcat chgrp -R tomcat conf chmod g+rwx conf chmod g+r conf/* chown -R tomcat webapps/ work/ temp/ logs/ Sometimes during setup, however, this can be a problem making it necessary to give tomcat full rights cd /opt chown tomcat:tomcat . -R Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 9/24 PhenotypeDatabase / GSCF Next we need to create startup scripts so the CentOS/RHEL server can start Tomcat This wil create a systemd unit script to start Tomcat nano /etc/systemd/system/tomcat.service The content of the tomcat.service file # Systemd unit file for tomcat [Unit] Description=Apache Tomcat Web Application Container After=syslog.target network.target [Service] Type=forking Environment=JAVA_HOME=/usr/lib/jvm/jre Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/bin/kill -15 $MAINPID User=tomcat Group=tomcat [Install] WantedBy=multi-user.target To start Tomcat, first reload the systemd daemon, start Tomcat (to see that it actually starts). If successful, make the startup happen automatically in the future (enable). systemctl daemon-reload systemctl start tomcat systemctl enable tomcat Finally we need to open the firewall for port 80 and port 8080 firewall-cmd --add-port=80/tcp --permanent firewall-cmd --add-port=8080/tcp --permanent firewall-cmd --reload Tomcat is now installed and running and should be reachable on ”your-domain:8080” Finn Sandø – Department of Nutrition, Exercise and Sports (NEXS) – University of Copenhagen Tutorial: Install dbNP on CentOS/RHEL 7 (v3) 10/24 PhenotypeDatabase / GSCF Configuring Tomcat Next step is to configure tomcat. Tomcat will work fine without further configuration but an administrator may find it useful to have access to Tomcat’s manager interface (”manager-gui” or ”Manager App”). To get access to the Manager App you need to add a user with admin rights to the manager-gui. Edit the ”tomcat-users.xml” file nano /opt/tomcat/conf/tomcat-users.xml Create a user with suitable permissions by adding these lines between the <tomcat-users ...> ... </tomcat-users> markups. In this case I have created a user ”tomcat” (the name is not important and could be anything) <role rolename="manager-gui" /> <role rolename="manager-script" /> <role rolename="manager-jmx" /> <role rolename="manager-status" /> <role rolename="admin" /> <user username="tomcat" password="secret" roles="admin,manager-gui,manager-script" /> The complete the ”tomcat-users.xml” file <?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <tomcat-users xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0"> <!-- NOTE: By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user - the username and password are arbitrary.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages24 Page
-
File Size-