Quick Guide: Install Tomcat, Jenkins, and JDK on macOS
This step‑by‑step tutorial shows how to install Tomcat, add Jenkins inside Tomcat, and set up JDK on macOS, covering environment preparation, required downloads, configuration of environment variables, command‑line startup and shutdown, and port conflict resolution.
Environment Preparation
Before beginning, ensure the following components are ready:
Tomcat
Jenkins (to be deployed inside Tomcat)
JDK
SDK (if needed for your projects)
1. Install and Start Tomcat
Download Tomcat from the official site: http://tomcat.apache.org/download-70.cgi Extract the archive and place the entire apache-tomcat-7.0.77 folder under /usr/local on macOS.
Configure the PATH environment variable by editing .bash_profile: export PATH=${PATH}:/usr/local/apache-tomcat-7.0.77/bin Start Tomcat:
Give execution permission to the startup script: chmod 777 catalina.sh Run the startup command: sh startup.sh If successful, the console will display:
Tomcat started.
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.77
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.77
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.77/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
Using CLASSPATH: /usr/local/apache-tomcat-7.0.77/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.77/bin/tomcat-juli.jarOpen a browser and navigate to http://localhost:8080/. If port 8080 is occupied (e.g., by Jenkins), edit conf/server.xml and change the Connector port, for example to 8088:
<Connector port="8088" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />Tomcat can be stopped with:
sh ./shutdown.sh2. Deploy Jenkins Inside Tomcat
Download the latest Jenkins WAR file: http://mirrors.jenkins-ci.org/war/latest/jenkins.war Copy jenkins.war into Tomcat's webapps directory and restart Tomcat. Access Jenkins at: http://127.0.0.1:8088/Jenkins Use the generated username and password (displayed in the console) to log in.
3. Install JDK and Configure Environment Variables
Follow the JDK installation guide (e.g., http://www.cnblogs.com/quickcodes/p/5127101.html) to install JDK 1.8.
After installation, set the following variables in .bash_profile:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH:.
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.Reload the profile or restart the terminal to apply the changes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
