Wednesday, September 7, 2016

How To Install Tomcat In OS X

Tomcat Installation

Download the latest binary distribution of tomcat, in my case apache-tomcat-8.0.37.tar.gz, from apache

Extract the file from the tar archive and move the tomcat folder to /opt:

cd Downloads/
tar -xvf apache-tomcat-8.0.36.tar.gz 
mv apache-tomcat-8.0.36 /opt

Set CATALIA_HOME and PATH Environment Variables

$ nano ~/.bash_profile
(~/.bash_profile)

# Set Catalina Home
export CATALINA_HOME=/opt/apache-tomcat-8.0.36
# Export Catalina/bin to path
export PATH=$PATH:$CATALINA_HOME/bin

Common Tomcat Commands

To start tomcat, open a shell Terminal window in any directory and issue the command:

$ startup.sh

Test Tomcat installation by pointing your browser to: http://localhost:8080

To stop tomcat, type on the shell:

$ shutdown.sh

To read the log file:

cd /opt/apache-tomcat-8.0.36/logs
tail -f catalina.out

Manager Web Application

The Manager App is an application that comes with Tomcat and allows you to start, stop, reload and undeploy web applications installed in Tomcat

To allow the access to the Manager App add a manager user to the tomcat users configuration file.

Edit the tomcat-users.xml file:

$ nano /opt/apache-tomcat-8.0.36/conf/tomcat-users.xml

add the following two lines:

<tomcat-users>
...
<role rolename="manager-gui"/>
<user username="manager" password="password" roles="manager-gui"/>
</tomcat-users>

Friday, September 2, 2016

How To Install Maven In OS X

Maven Installation


Download Apache Maven from its website: http://maven.apache.org/bindownload.cgi
Copy the archive file to /opt directory and extract it:
$ cd Downloads
$ cp apache-maven-3.3.9-bin.tar.gz /opt
$ cd /opt
$ tar -xvf apache-maven-3.3.9-bin.tar.gz 

Set M2_HOME and PATH Environment Variables


$ nano ~/.bash_profile
(~/.bash_profile)

# Set Maven Home
export M2_HOME=/opt/apache-maven-3.3.9

# Export Maven bin to path
export PATH=$PATH:$M2_HOME/bin
You can check the PATH by issuing the commands:
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/apache-ant-1.9.7/bin:/opt/apache-maven-3.3.9/bin
You can check Ant installation by issuing the command:
$ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

How to Install Ant in OS X

Ant Installation

Download Apache Ant from its website: http://ant.apache.org/bindownload.cgi

Copy the archive file to /opt directory and extract it:

cd Downloads
cp apache-ant-1.9.7-bin.tar.gz /opt
cd /opt
tar -xvf apache-ant-1.9.7-bin.tar.gz