Jenkins + jdk installed mac

Jenkins is based on a continuous integration Java development tools for ongoing software release / test project , and monitor the implementation of the work of external calls. In short, automated testing + deployment.

First we need to install jdk , note that currently only supports jenkins jdk8, do not download a later version of jdk

Official website address: https://www.oracle.com/technetwork/java/javase/downloads/index.html

Drop-down selection this version:

u8FqEt.png

Accept the license agreement, and then choose to install this package:

u8kpuj.png

After the download is complete click the installation package, follow the prompts to complete the installation.

Go to the finder/Library/Java/JavaVirtualMachines/???.jdk/Contents/Home

Where ???is your downloaded version, because I'm afraid of the future to update this version did not lead to invalid simply copy my command, so a reminder, replace it with your own downloadable version.

Contents of the document under which the Home folder is the root directory of the JDK.

By vim .bash_profileOpen Startup file commands, add content:

$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home

(Enter vim, press i to enter edit mode addition is complete, press ESC, Enter.. ": Wq" to save and exit)

Import configuration:

$ source .bash_profile

In the input terminal java -version, to verify successful installation:

u8kV8U.png

Jenkins started in two ways:

1. The first method is to use open Tomcat:
official website address: http://tomcat.apache.org/

This version will be able to choose:

u8kKbR.png

Then choose this:

u8kG8O.png

Unzip Tomcat to a directory, it is recommended to unpack /Users/用户/Library, easy to operate, the terminal cdto /Users/用户/Library/Tomcat/binthe next, $ ./startup.shto start Tomcat.

到官网下载Jenkins.war包,官网地址:https://jenkins.io/,点下载然后选这个

u8kUrd.png

将jenkins.war文件放入Tomcat下的webapps目录下,启动Tomcat时,会自动在webapps目录下建立jenkins目录,在地址栏上需要输入localhost:8080/jenkins,就可以访问Jenkins了。

如需停止Tomcat,终端/Users/用户/Library/Tomcat/bin下输入./shutdown.sh

2. 第二种启动方法,下载Jenkins.war包,切换到jenkins.war存放的目录,输入如下命令:

$ java -jar jenkins.war

如果需要修改端口可以使用如下命令:

$ java -jar jenkins.war --httpPort=8081

然后在浏览器中(推荐用火狐/谷歌)输入localhost:8081,localhost可以是本机的ip,也可以是计算机名。就可以打开Jenkins了。

除了用安装包,还可以用终端命令安装Jenkins

首先保证安装过homebrew,没有的话安装方式如下:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

这是他的官网:https://brew.sh/
安装过程中,需要按回车来确定,然后输入密码,之后等一下就好了

# 升级或安装java:
$ brew cask install java
# 安装Jenkins:
$ brew install jenkins
# 启动Jenkins:
# 2.149是指Jenkins的版本号
$ java -jar /usr/local/Cellar/jenkins/2.149/libexec/jenkins.war --httpPort=8080

打开浏览器,输入 localhost:8080 就可看到Jenkins的web界面

然后根据页面提示找到给定的路径下生成的初始密码,粘贴到页面文本框就可以了~
获取密码-终端输入命令:sudo vim /var/root/.jenkins/secrets/initialAdminPassword

选择你需要下载的插件,建议新手选择推荐插件,然后就是一顿等待。。。

u8kyRS.png

安装完成之后创建admin账户

u8k7zF.png

然后设置一下端口(这里根据自己情况而定,默认也可以)

u8kLL9.png

安装成功

u8kjd1.png

According to my login account if the above steps to configure, then that is admin, the password is `sudo vim /var/root/.jenkins/secrets/initialAdminPassword

Guess you like

Origin www.cnblogs.com/x1you/p/11607995.html