Installing Apache Tomcat on UNIX / Linux Machine
The following topics are included in this section:
Installing Apache Tomcat from Repository
Tomcat7 isn't available as a package and brew install tomcat just installs version 8. Brew install homebrew/versions/tomcat7 is available but fails when I try it. Looks like the reason is that 7.0.57 has been pulled from the mirrors and the formula hasn't been updated for. Brew install tomcat As per the initial install, Homebrew links the keg which results in a handful of generically named scripts being added to your path. We'll need to unlink it. If you try to unlink with brew unlink tomcat you'll get Error: tomcat has multiple installed versions.
Note: All commands should be entered into a terminal window using an account with sudo
privileges.
This section describes how to install Apache Tomcat from repository as a service on Ubuntu 12.x.
Proceed as follows:
Open a terminal window and enter the following:
Start Tomcat with the next command:
To ensure that Tomcat works properly, open the browser and enter http://localhost:8080.
In case 404 Error appears, try to restart Tomcat:
Or stop Tomcat by entering the following command:
sudo apt-get install tomcat7
sudo /etc/init.d/tomcat7 start
All necessary folders should be located in /var/lib/tomcat7
.
If all is correct, Apache Tomcat displays welcome page with a message similar to the following: If you're seeing this, you've successfully installed Tomcat. Congratulations!
sudo /etc/init.d/tomcat7 restart
sudo /etc/init.d/tomcat7 stop
Start Tomcat again as described above.
Installing Apache Tomcat from ZIP File
This section describes how to install Apache Tomcat on Ubuntu 12.04 and Centos 6.3. The instructions are valid for other Linux distributions with small changes.
Proceed as follows:
Download the appropriate Tomcat archive file, ZIP or
tar.gz
archive, from its official website: http://tomcat.apache.org/download-70.cgi () to the required user folder.Open a terminal window and change directory to the folder containing the Tomcat archive.
Extract the archive by entering in the terminal the following command. Tomcat version can be changed as required:
Change directory to the tomcat/bin:
Make sure all
*.sh
files are executable, i.e. they haver
in all positions to the left of the file name, for example,-rwxr-xr-x
. For that, enter in terminal the following:If some
sh
files are not executable, enter the following command:Run the
sturtup.sh
file:In the browser, enter the following URL: http://localhost:8080
In this example, Tomcat 7.0.39 is used, and download it to the following folder:
/home/myuser
tar -zxvf apache-tomcat-7.0.39.tar.gz
The apache-tomcat-7.0.39 folder appears. For example:
/home/myuser/apache-tomcat-7.0.39
cd apache-tomcat-7.0.39/bin
ls –la
Persuasive memo. The following displays:
Figure 1: OpenL Tablets package is added
chmod +x ./*.sh
sh ./startup.sh
If the installation completed successfully, the Apache Tomcat welcome screen appears. The next thing to be done is to configure JVM options for Tomcat.
Configuring JVM Options for Tomcat on UNIX / Linux Machine
To configuring JVM options for Tomcat on a UNIX / Linux machine, proceed as follows
For UNIX, create
TOMCAT_HOME/bin/setenv.sh
file and writeLocate the
TOMCAT_HOME/conf/server.xml
file and add theURIEncoding='UTF-8'
attribute for allelements.
export JAVA_OPTS='$JAVA_OPTS -Xms256m -Xmx1024m -XX:+UseParallelOldGC -XX:PermSize=128m -XX:MaxPermSize=384m'
For example:
From this point deploy OpenL Tablets WebStudio as described in Step 3: Deploying OpenL Tablets WebStudio.
Skip to end of metadataGo to start of metadata
1.1 Get the code of HAWQ
1.2 Setup an environment with the dependencies installed
Install dependencies on MAC (with xcode installed)
Make sure you have done: xcode-select --install to install developer tools
Please refer to section below titled Running catalog tidycat perl modules for installing perl-JSON module on MAC/
Note for Installing Dependencies
- some dependencies require brew install --universal, if you see HAWQ complains about an already installed package is required, try that.
- El Capitan issues: boost cannot be installed as --universal (command shell will hang), you need follow manul steps http://www.boost.org/doc/libs/1_61_0/more/getting_started/unix-variants.html#easy-build-and-install
- bison version on local MAC is too high. try bison --version to look at the version, if it is later than 3.0, try install bison with a lower version, such as 2.3. And rebuild HAWQ.
- If you see openssl error, try:
brew link --force openssl
- To make it work, here are two options:
1. Install the thirdparty library in system directory, i.e., /usr/local/bin,/usr/bin,/usr/local/lib,/usr/lib,/usr/local/include, etc.
2. Add executables and headers path to system path and export them accordingly.
OS requirement
Use a text editor to edit the /etc/sysctl.conf file. Add or edit each of the following parameter definitions to set the required value.
kern.sysv.shmmax=2147483648
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=524288
kern.maxfiles=65535
Download the appropriate Tomcat archive file, ZIP or
tar.gz
archive, from its official website: http://tomcat.apache.org/download-70.cgi () to the required user folder.Open a terminal window and change directory to the folder containing the Tomcat archive.
Extract the archive by entering in the terminal the following command. Tomcat version can be changed as required:
Change directory to the tomcat/bin:
Make sure all
*.sh
files are executable, i.e. they haver
in all positions to the left of the file name, for example,-rwxr-xr-x
. For that, enter in terminal the following:If some
sh
files are not executable, enter the following command:Run the
sturtup.sh
file:In the browser, enter the following URL: http://localhost:8080
In this example, Tomcat 7.0.39 is used, and download it to the following folder:
/home/myuser
tar -zxvf apache-tomcat-7.0.39.tar.gz
The apache-tomcat-7.0.39 folder appears. For example:
/home/myuser/apache-tomcat-7.0.39
cd apache-tomcat-7.0.39/bin
ls –la
Persuasive memo. The following displays:
Figure 1: OpenL Tablets package is added
chmod +x ./*.sh
sh ./startup.sh
If the installation completed successfully, the Apache Tomcat welcome screen appears. The next thing to be done is to configure JVM options for Tomcat.
Configuring JVM Options for Tomcat on UNIX / Linux Machine
To configuring JVM options for Tomcat on a UNIX / Linux machine, proceed as follows
For UNIX, create
TOMCAT_HOME/bin/setenv.sh
file and writeLocate the
TOMCAT_HOME/conf/server.xml
file and add theURIEncoding='UTF-8'
attribute for allelements.
export JAVA_OPTS='$JAVA_OPTS -Xms256m -Xmx1024m -XX:+UseParallelOldGC -XX:PermSize=128m -XX:MaxPermSize=384m'
For example:
From this point deploy OpenL Tablets WebStudio as described in Step 3: Deploying OpenL Tablets WebStudio.
Skip to end of metadataGo to start of metadata
1.1 Get the code of HAWQ
1.2 Setup an environment with the dependencies installed
Install dependencies on MAC (with xcode installed)
Make sure you have done: xcode-select --install to install developer tools
Please refer to section below titled Running catalog tidycat perl modules for installing perl-JSON module on MAC/
Note for Installing Dependencies
- some dependencies require brew install --universal, if you see HAWQ complains about an already installed package is required, try that.
- El Capitan issues: boost cannot be installed as --universal (command shell will hang), you need follow manul steps http://www.boost.org/doc/libs/1_61_0/more/getting_started/unix-variants.html#easy-build-and-install
- bison version on local MAC is too high. try bison --version to look at the version, if it is later than 3.0, try install bison with a lower version, such as 2.3. And rebuild HAWQ.
- If you see openssl error, try:
brew link --force openssl
- To make it work, here are two options:
1. Install the thirdparty library in system directory, i.e., /usr/local/bin,/usr/bin,/usr/local/lib,/usr/lib,/usr/local/include, etc.
2. Add executables and headers path to system path and export them accordingly.
OS requirement
Use a text editor to edit the /etc/sysctl.conf file. Add or edit each of the following parameter definitions to set the required value.
kern.sysv.shmmax=2147483648
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=524288
kern.maxfiles=65535
kern.maxfilesperproc=65536
- Reboot to apply the change.
Install Xcode and command line tools
After install/update xcode, please run ‘xcode-select --install' to install command line tools, and then open xcode to make sure you have already installed it.
MUST: Turning Off Rootless System Integrity Protection in OS X El Capitan 10.11+
If not do this, you may encounter some tricky LIBRARY_PATH problems. e.g. HAWQ-513
Following below instructions: ( refer to http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x )
- Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode
- When the 'OS X Utilities' screen appears, pull down the ‘Utilities' menu at the top of the screen instead, and choose 'Terminal'
- Type the following command into the terminal then hit return: csrutil disable; reboot
Install dependencies on Rad Hat/CentOS 7.X
Dependencies
OS requirement
use a text editor to edit the /etc/sysctl.conf file. Add or edit each of the following parameter definitions to set the required value.
- Execute the following command to apply your updated /etc/sysctl.conf file to the operating system configuration:
- Use a text editor to edit the /etc/security/limits.conf file. Add the following definitions in the exact order that they are listed
( Please make sure fs.nr_open = 3000000 is applied before edit limits.conf, else you may not able to ssh to your instance.)
- Bison version: run bison --version to look at the version, if it is later than 3.0, try install bison with a lower version, such as 2.3. And rebuild HAWQ.
Build dependencies yourself ( tested on Red Hat 6.X).
Dependencies
There are several dependencies (see the following table) you must install before building HAWQ. To build Apache HAWQ, gcc and some dependencies are needed. The libraries are tested on the given versions. Most of the dependencies can be installed through yum. Other dependencies should be installed through the source tarball. Typically you can use './configure && make && make install' to install from source tarball.
Libraries that must be installed using source tarball.
Name | Version | Download URL |
---|---|---|
http://sourceforge.net/projects/boost/files/boost/1.56.0/boost_1_56_0.tar.bz2 | ||
http://archive.apache.org/dist/thrift/0.9.1/thrift-0.9.1.tar.gz (require boost 1.56) | ||
https://github.com/google/protobuf/tree/v2.5.0 | ||
https://curl.haxx.se/download/curl-7.44.0.tar.gz | ||
maven | http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo | |
cmake | >=3.0 | https://cmake.org/files/ |
You might need to run 'ldconfig -p ' after installing them.
For thrift build, you might need '--without-tests' for configure.
Install maven:
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
Install pip:
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
Brew Tomcat Install Directory
Libraries that can be installed through yum.
Name | Version |
---|---|
epel-release | 6-8 |
make | |
lcov | 1.12 |
libesmtp-devel | 1.0.4 |
perl-JSON | 2.15 |
tomcat | 6.0.44 |
Default version of gcc in Red Hat/CentOS 6.X is 4.4.7 or lower, you can quickly upgrade gcc following instructions below:
You will need to install python packages same as those which are required for Red Hat/CentOS 7.
OS requirement
use a text editor to edit the /etc/sysctl.conf file. Add or edit each of the following parameter definitions to set the required value.
- Execute the following command to apply your updated /etc/sysctl.conf file to the operating system configuration:
- Use a text editor to edit the /etc/security/limits.conf file. Add the following definitions in the exact order that they are listed
Build with Prebuilt Docker Image
Apache HAWQ source code contains the Dockerfiles to help developers to setup building and testing environment with docker.
To use the docker image follow the steps on: https://github.com/apache/hawq/tree/master/contrib/hawq-docker
1.3 Compile and Install HAWQ
Once you have an environment with the necessary dependencies installed and Hadoop is ready, the next step is to get the code and build HAWQ
2.1 Install and Start Hadoop
Please follow the steps here: https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SingleCluster.html
Note:
- you might need to build hadoop from source on Red Hat/CentOS 6.x if the downloaded hadoop package has higher glibc version requirement. When that happens, you will probably see the warning below when running start-dfs.sh.' WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform'
- You will also need to set the port for fs.defaultFS to 8020 in etc/hadoop/core-site.xml (The example above set it as 9000.)
- HDFS is a must, but YARN is optional. YARN is only needed when you want to use YARN as the global resource manager.
- must setup passphraseless ssh, otherwisethere will be some problems of 'hawq init cluster' in the following step.
Your need to verify your HDFS works.
2.2 Init/Start/Stop HAWQ
You will need to use PXF to query external hadoop/hive/hbase data. Refer to PXF Build & Install document.
The JSON Perl Module is required to run the set of Perl scripts (src/include/catalog). The versioned JSON formatted catalog files are stored in tools/bin/gppylib/data/.json. In order to install the JSON module, the developer will need to make the module available from CPAN. The following was validated on a Macbook Pro OS X 10.11.6 using the information from the Perl on Mac OSX section (http://www.cpan.org/modules/INSTALL.html). Below you will see the session which performs the following steps:
- Validate JSON module is not in the environment. Receive appropriate error message.
- Run cpan install JSON command to install the JSON Perl module. In the example below, the module is installed locally (local::lib) and not in the system's Perl installation.
- Execute the environment variable updates added to the .bashrc file by the installation process.
- Validate the tidycat.pl command can now be run without receiving error.
Brew Tomcat Logs
Note:
Brew Tomcat Start
- JSON Module version 2.27 and the latest 2.90 have been used to validate they generate the proper catalog JSON formatted file.
- The scripts are essentially validating the evaluation of *require JSON* passes otherwise the error message is displayed:
Fatal Error: The required package JSON is not installed -- please download it from www.cpan.org
Extension | How to enable | Pre-build steps on Mac |
---|---|---|
PL/R | ./configure --with-r | #install R before build brew tap homebrew/science brew install r |
PL/Python | ./configure --with-python | |
PL/Java | ./configure --with-java | |
PL/PERL | ./configure --with-perl | |
pgcrypto | ./configure --with-pgcrypto --with-openssl | |
gporca | ./configure --enable-orca | |
rps | ./configure --enable-rps | brew install tomcat@6 |