1、安装JDK
从官网下载jdk安装包
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
安装jdk
yum install jdk-8u162-linux-x64.rpm
|---|-------------------------------------| | 1 | yum install jdk-8u162-linux-x64.rpm |
2、二进制安装Tomcat
cd /usr/local/src wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.0.50/bin/apache-tomcat-8.0.50.tar.gz tar -xf apache-tomcat-8.0.50.tar.gz -C /usr/local/ ln -sv /usr/local/apache-tomcat-8.0.50/ /usr/local/tomcat
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 | cd /usr/local/src wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.0.50/bin/apache-tomcat-8.0.50.tar.gz tar -xf apache-tomcat-8.0.50.tar.gz -C /usr/local/ ln -sv /usr/local/apache-tomcat-8.0.50/ /usr/local/tomcat |
3、下载jenkins.war
cd /usr/local/tomcat/webapps wget http://mirrors.jenkins.io/war-stable/2.89.4/jenkins.war mv jenkins.war ROOT.war rm -rf /usr/local/tomcat/webapps/ROOT
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 | cd /usr/local/tomcat/webapps wget http://mirrors.jenkins.io/war-stable/2.89.4/jenkins.war mv jenkins.war ROOT.war rm -rf /usr/local/tomcat/webapps/ROOT |
4、启动服务
/usr/local/tomcat/bin/startup.sh
|---|----------------------------------| | 1 | /usr/local/tomcat/bin/startup.sh |
访问http://IP:8080
直接默认安装
创建管理员用户
5、使用Nginx反代tomcat(我这里直接yum装了)
yum install nginx
|---|-------------------| | 1 | yum install nginx |
配置nginx
server { listen 80; server_name 192.168.0.33; location / { proxy_pass http://127.0.0.1:8080; } }
|---------------|--------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 | server { listen 80; server_name 192.168.0.33; location / { proxy_pass http://127.0.0.1:8080; } } |
nginx -t systemctl restart nginx
|-----|----------------------------------| | 1 2 | nginx -t systemctl restart nginx |
6、访问http://IP