centos7 Jenkins 安装与卸载

一、docker安装Jenkins

1、下载

docker pull jenkinsci/blueocean

如果报错:

error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/22/22476e79830032971a4f57c436824ff9bedc0572c136b0f51592f45d00698e12/data?verify=1551754266-%2FyjesjNPacJjWGGW79f78MnynBQ%3D: net/http: TLS handshake timeout

修改:

1、将拉取地址改为国内镜像仓库
vim /etc/docker/daemon.json

修改为:

{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

:wq 保存并退出

2、重启docker

systemctl restart docker

2、启动jenkins容器 在centos7下创建 /home/jenkins_home目录

docker run  -u root --rm --name jenkins -d  -p 8080:8080 -p 50000:50000  -v /home/jenkins_home:/var/jenkins_home  -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean 

3、运行jenkins

http://自己服务器的ip地址:8080

查看初始密码:vim /home/jenkins_home/secrets/initialAdminPassword

二、docker 卸载

1、先停止容器

docker stop jenkins

2、删除容器

docker rm jenkins

三、yum包安装

1、获取jenkins安装源文件

wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

2、导入公钥

rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

3、安装Jenkins

yum install -y jenkins

4、配置文件修改(可选: 这里默认端口为8080)

vim /etc/sysconfig/jenkins

5、日志信息查看(可选)

/var/libs/jenkins/logs
/var/log/jenkins/jenkins.log

6、启动: http://{IP地址}:8080

service jenkins start

四、yum包卸载

yum remote -y jenkins

猜你喜欢

转载自blog.csdn.net/u011477914/article/details/88170074