DeepOps的Jenkins小笔记-搭建jenkins

官网中文站的教程

https://www.jenkins.io/zh/doc/pipeline/tour/getting-started/

方式1:下载并运行 Jenkins

注意运行jenkins的jdk版本8或11

  1. 下载 Jenkins.
  2. 打开终端进入到下载目录.
  3. 运行命令 java -jar jenkins.war --httpPort=8080.
  4. 打开浏览器进入链接 http://localhost:8080.
  5. 按照说明完成安装.

http://localhost:8080/jks

方式2: docker安装jenkins

https://www.jenkins.io/doc/book/installing/

按顺序一路操作即可,如果有权限问题,加上sudo

docker network create jenkins
docker volume create jenkins-docker-certs
docker volume create jenkins-data
docker container run \
  --name jenkins-docker \
  --rm \
  --detach \
  --privileged \
  --network jenkins \
  --network-alias docker \
  --env DOCKER_TLS_CERTDIR=/certs \
  --volume jenkins-docker-certs:/certs/client \
  --volume jenkins-data:/var/jenkins_home \
  --publish 2376:2376 \
  docker:dind
docker container run \
  --name jenkins-blueocean \
  --rm \
  --detach \
  --network jenkins \
  --env DOCKER_HOST=tcp://docker:2376 \
  --env DOCKER_CERT_PATH=/certs/client \
  --env DOCKER_TLS_VERIFY=1 \
  --publish 8080:8080 \
  --publish 50000:50000 \
  --volume jenkins-data:/var/jenkins_home \
  --volume jenkins-docker-certs:/certs/client:ro \
  jenkinsci/blueocean

初始化jenkins

Unlocking Jenkins

When you first access a new Jenkins instance, you are asked to unlock it using an automatically-generated password.

  1. Browse to http://localhost:8080 (or whichever port you configured for Jenkins when installing it) and wait until the Unlock Jenkins page appears.

Unlock Jenkins

To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find it?) and this file on the server:

最主要的就是找到这个密码,然后输入。另外根据提示下载插件,创建用户算是完成了基本设置。

使用war包安装:/var/jenkins_home/secrets/initialAdminPassword

使用docker 安装 :/var/lib/docker/volumes/jenkins-data/_data/secrets/initialAdminPassword

Please copy the password from either location and paste it below.Administrator password

Leave a Comment

Your email address will not be published.