Centos 7.6 Docker + Jenkins + tomcat build automated deployment environment

Recently during the project needs an automated build environment jenkins, with the first, in order to simplify the front and rear ends, and secondly to facilitate the deployment, simplify deployment, so the research work carried out jenkins few days, there are some gains, I would like this paper to take notes, my colleagues also share out we want to help!

Science is not deep, hope that big brother could exhibitions!

For jenkins this term when I initially unfamiliar, but the work required, must still go to learn, life-long learning thing, so I started learning to jenkins's.

First of all, in my opinion, to learn a skill or learn to use the same tool, you need to get to know a few questions:

  1. What is it
  2. What he can do
  3. It helps me solve what
  4. How he used

This positioning of the three questions, we can begin to explore it step by step, and the best way to explore these three questions, I personally think it is Tell me what network to look at the document, the address is: https: / /jenkins.io/zh/doc/,

 

 

 After reading it, I was suddenly because they have a vague understanding, he told me, jenkins is a variety of automated tasks, including build, test and deploy software, it supports a variety of operating modes, by system package, Docker or by a stand-alone Java program.

In this case, we know, this is a include build, test and deploy software, can be deployed by a stand-alone Java program to help us eliminating tedious manual procedures Docker deployment package through the system or, finally, let us look at see how he uses it.

According to the official website explained, jenkins has a variety of department Department of way, you can download the war package, you can also use the Docker image for deployment to start a run way I first introduced here (I think it is also the most convenient way): Centos + Docker + Jenkins Jenkins ways up and running on the server.

I am here is to re-install a virtual machine to operate in a clean environment, as follows:

  1. Install a virtual machine system, using centos7.6 version (need to install wget and other tools after installed)
  2. Download jdk, use the command wget --no-Cookies --no-the Check-Certificate --header "Cookie: gpw_e24 = HTTP% 3A% 2F% 2Fwww.oracle.com% 2F; oraclelicense the Accept-securebackup-the cookie =" " HTTP : //download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz ", configure jdk environment, the steps of:
    1. Enter / usr folder, create java folder (mkdir java), so far the jdk download, unzip and then replace the specified name
    2. Configure the environment variables, vim / etc / profile open profile, then add the following code: (JAVA_HOME = / usr / java / jdk1.8.0_60 CLASSPATH = $ JAVA_HOME / lib / PATH = $ PATH: $ JAVA_HOME / bin export PATH JAVA_HOME CLASSPATH )
    3. With immediate effect profile (source / etc / profile)
 
Once configured jdk, docker start the installation environment (Reference: https://www.w3cschool.cn/docker/centos-docker-install.html ), the following steps:
  1. Docker system requirements CentOS kernel version higher than 3.10, see this page prerequisite to verify your CentOS version supports Docker. By viewing your current kernel version (uname -r 3.10.0-327.el7.x86_64) uname -r command
  2. Docker packages and dependencies have been included in the default CentOS-Extras source software, the installation command is as follows: yum -y install docker
  3. Docker start background service, service docker start

At this point, the system environment is ready, then let us enter Jenkins installation steps:

Use Docker Jenkins installation environment, the following steps:
  1. Jenkins pull-down image (specified version) docker pull jenkins / jenkins: 2.196 (designated version 2.196)
  2. Jenkins create a mount directory, mkdir / home / advance / jenkins
  3. Assign permissions: chown -R 1000: 1000 jenkins /    here must be 1000
  4. Jenkins run, the following command: sudo docker run -itd -p 8080: 8080 -p 50000: 50000 --name jenkins -u advance --privileged = true -v / home / advance / jenkins: / var / jenkins_home { id} mirroring , note that the above instructions I used at the time to do the test, in which the path and port needs to be configured according to their own circumstances , detailed reference Docker commands, URL ( https://www.w3cschool.cn/docker/docker-nx3g2gxn.html )
  5. 此处便已经运行成功,再次启动时可以根据容器id启动,命令(docker start ${containerId})
  6. 浏览器访问路径http://ip:8080/jenkins即可开始配置(如果报错的话,直接访问http://ip:8080/即可
  7. 配置需要先获取初始化的jenkins密码,界面上会展示路径,根据路径可以查看密码,获取命令为 (cat ${path}),
  8. 点击下一步,进行插件安装时需要注意,首先访问路径http://${host}:${port}/pluginManager/advanced,将插件更新地址修改为http://mirror.serverion.com/jenkins/updates/current/update-center.json,防止下一步插件安装失败
  9. 开始插件安装,按照指示,便可进入工作台界面了

以上便是小弟记录下的安装过程,基本来说是没什么问题的,出现问题耐心查找一下,毕竟学习是一个过程,细心点马上就会成功的。

后面还记录了一下jenkins在windows环境下war部署的方式以及jenkins的使用,才疏学浅,望各位大佬指教!

 

Guess you like

Origin www.cnblogs.com/advanceBlog/p/11707286.html
Recommended