标签:完整的部署文档
下载
Jdk8:jdk-8u121-linux-x64.tar.gz
Tomcat9:wget http://apache.fayea.com/tomcat/tomcat-9/v9.0.0.M20/bin/apache-tomcat-9.0.0.M20.tar.gz
Ant:https://www.apache.org/dist/ant/binaries/apache-ant-1.10.1-bin.tar.gz
Maven:wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
Jenkins:wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
Linux环境下安装
1 下载并安装JDK
JDK下载地址:
http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html
安装JDK
tar -xvf /work/source/jdk-8u121-linux-x64.tar.gz -C /work/opt/ mv /work/opt/jdk1.8.0_121/ /work/opt/jdk
|
2 安装并安装tomcat
下载tomcat:
在linux命令行中输入以下指令下载apache-tomcat-7.0.63.tar.gz
wget http://apache.fayea.com/tomcat/tomcat-9/v9.0.0.M20/bin/apache-tomcat-9.0.0.M20.tar.gz |
安装tomcat
tar -xvf /work/source/apache-tomcat-9.0.0.M20.tar.gz -C /work/opt/ mv /work/opt/apache-tomcat-9.0.0.M20 /work/opt/tomcat 解释:tar –xvzf tar.gz包名 –C 目标目录 |
3 配置环境变量
修改/etc/profile
vi /etc/profile
添加以下内容
设置环境变量,把下面内容追加到 /etc/profile 中 ##java export JAVA_HOME=/work/opt/jdk export JAVA_BIN=$JAVA_HOME/bin export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_BIN:$PATH |
4 将下载jenkin的war包放在/tomcat/websapp/目录
cp -rf /work/source/jenkins.war /work/opt/tomcat/webapps/ |
5 配置ant
tar -xvf /work/source/apache-ant-1.10.1-bin.t mv /work/opt/apache-ant-1.10.1 /work/opt/ant |
6 配置maven
tar -xvf /work/source/apache-maven-3.5.0-bin.tar.gz -C /work/opt/ mv /work/opt/apache-maven-3.5.0/ /work/opt/maven |
7 启动tomcat即可访问,默认访问地址:http://xxx.xx.xx.xx:8080/jenkins。
出现下面页面
这个时候你进入服务器
root@gaogd-test-jenkins:~# cat /root/.jenkins/secrets/initialAdminPassword 34c42f4c96fe4af6aae76c56292dd1c9 root@gaogd-test-jenkins:~# 把这个文件的内容输入到密码框,即可进行下一步 |
下一步出现下面页面,选择 Install suggested plugins 即可
安装完成之后,需要你创建一个用户,根据自己的要求创建即可,我下面创建的用户是admin,密码:admin
安装所需插件
有很多插件都是选择的默认的安装的,所以现在需要我们安装的插件不多,Git plugin和Maven Integration plugin(这个插件必须安装,如果不安装的话无法创建maven项目,在可选插件中安装这个插件即可),以下是我的插件列表:
在可选插件中选择上面的插件安装,如下
安装完成如下:
进行系统配置
此处省略jdk(请注意服务器上需要安装jdk,而不是jre)、maven、git的安装
在系统管理中找到Global Tool Configurations,其中包含jdk、git、maven等工具的配置
到这来你的jenkins基础环境就部署完成了
附带 Jenkins的dockerfile
FROM ubuntusshd MAINTAINER gaogd RUN apt-get install wget -y RUN mkdir -p /work/opt && mkdir -p /work/source COPY apache-ant-1.10.1-bin.tar.gz /work/source/apache-ant-1.10.1-bin.tar.gz COPY apache-tomcat-9.0.0.M20.tar.gz /work/source/apache-tomcat-9.0.0.M20.tar.gz COPY jdk-8u121-linux-x64.tar.gz /work/source/jdk-8u121-linux-x64.tar.gz COPY apache-maven-3.5.0-bin.tar.gz /work/source/apache-maven-3.5.0-bin.tar.gz ADD jenkins.war /work/source/jenkins.war ADD run.sh /run.sh WORKDIR /work/source RUN tar -xvf /work/source/apache-tomcat-9.0.0.M20.tar.gz -C /work/opt/ RUN mv /work/opt/apache-tomcat-9.0.0.M20 /work/opt/tomcat RUN tar -xvf /work/source/apache-ant-1.10.1-bin.tar.gz -C /work/opt/ RUN mv /work/opt/apache-ant-1.10.1 /work/opt/ant RUN tar -xvf /work/source/jdk-8u121-linux-x64.tar.gz -C /work/opt/ RUN mv /work/opt/jdk1.8.0_121/ /work/opt/jdk RUN tar -xvf /work/source/apache-maven-3.5.0-bin.tar.gz -C /work/opt/ RUN mv /work/opt/apache-maven-3.5.0/ /work/opt/maven ENV JAVA_HOME /work/opt/jdk ENV ANT_HOME /work/opt/apache-ant-1.10.1 ENV CLASSPATH .:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ENV PATH $JAVA_HOME/bin:$ANT_HOME/bin:$PATH RUN cp -rf /work/source/jenkins.war /work/opt/tomcat/webapps/ #RUN wget -P /work/opt/tomcat/webapps http://mirrors.jenkins-ci.org/war/latest/jenkins.war RUN apt-get install git -y #CMD /work/opt/tomcat/bin/catalina.sh run CMD ["/run.sh"] EXPOSE 8080
## wget https://www.apache.org/dist/ant/binaries/apache-ant-1.10.1-bin.tar.gz ## wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war ## wget http://apache.fayea.com/tomcat/tomcat-9/v9.0.0.M20/bin/apache-tomcat-9.0.0.M20.tar.gz ## wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz ##root@ubuntu:/work/docker/dockerfile/jenkins# cat run.sh #!/bin/sh ##/work/opt/tomcat/bin/catalina.sh start ##/usr/sbin/sshd -D |
附带ubuntusshd 的dockerfile
FROM ubuntu:14.04 MAINTAINER gaogd<gaogd@qq.com> RUN rm -rf /var/lib/apt/lists RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak ADD sources.list /etc/apt/sources.list RUN apt-get clean RUN apt-get update RUN apt-get install -y openjdk-7-jdk RUN apt-get install -y openssh-server RUN apt-get install -y vim tree lrzsz RUN echo ‘root:rela@2017‘ |chpasswd RUN useradd -m ubuntu -s /bin/bash RUN echo "ubuntu:rela@2017" | chpasswd RUN echo ‘%ubuntu ALL=(ALL:ALL) NOPASSWD: ALL‘ >> /etc/sudoers ADD sshd_config /etc/ssh/sshd_config WORKDIR /home/ubuntu/ USER ubuntu RUN pwd;ls -a; RUN mkdir /home/ubuntu/.ssh RUN ssh-keygen -t rsa -P ‘‘ -f /home/ubuntu/.ssh/id_rsa ADD authorized_keys /home/ubuntu/.ssh/authorized_keys USER root RUN chmod 600 /home/ubuntu/.ssh/authorized_keys ;chown -R ubuntu.ubuntu /home/ubuntu/ RUN mkdir /var/run/sshd RUN sed -ri ‘s/^PermitRootLogin\s+.*/PermitRootLogin yes/‘ /etc/ssh/sshd_config RUN sed -ri ‘s/UsePAM yes/#UsePAM yes/g‘ /etc/ssh/sshd_config CMD ["/usr/sbin/sshd","-D"] EXPOSE 4201 # root@ubuntu:/work/docker/dockerfile# cat ssh/sources.list # deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse # deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse # deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse # deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse # deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse |
本文出自 “奋斗吧” 博客,请务必保留此出处http://lvnian.blog.51cto.com/7155281/1931436
标签:完整的部署文档
原文地址:http://lvnian.blog.51cto.com/7155281/1931436