暗中观察

CentOS 安装 Jenkins
1.更换源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repo...
扫描右侧二维码阅读全文
11
2018/08

CentOS 安装 Jenkins

1.更换源

  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  yum makecache

2.安装组件

  yum install -y  net-tools vim wget zip unzip lrzsz pcre pcre-devel curl openssl openssl-devel openssh-server openssh-clients gcc-c++ zlib1g-dev zlib zlib-devel curl-devel expat-devel gettext-devel opgcc perl-ExtUtils-MakeMaker

3.安装java

4.yum 安装jenkins

  sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
  sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  sudo yum install jenkins
  systemctl restart jenkins.service
  systemctl status jenkins.service

tips: https://pkg.jenkins.io/redhat/

5.配置jenkins

  a. 修改运行用户和端口

jenkins-install-01.jpg

  b. 设置java路径
  vi /etc/init.d/jenkins
  #如下图加入
  /usr/local/java/jdk1.8.0_171/bin/java

jenkins-install-02.jpg

  c. 防火墙放行
  firewall-cmd --zone=public --add-port=8888/tcp --permanent
  systemctl daemon-reload
  systemctl restart firewalld
  systemctl restart jenkins

6.访问jenkins

http://ip:8888/

  #查找安装密码,然后一路下一步
  cat /var/lib/jenkins/secrets/initialAdminPassword

7.jenkins备份插件

ThinBackup
https://blog.51cto.com/innocence/2316315?source=dra

8.jenkins清理工作空间

 磁盘空间基本被workspace(工作空间)和jobs(任务)占完了。
 workspace中的内容可以直接删掉,删完之后的第一次构建会比较久,因为很多包需要重新拉取。
 jobs中的内容不建议删除,如果不小心误删,切记,删完之后,严禁重启jenkins,严禁重启jenkins,严禁重启jenkins。
 重启会导致所有的jobs全部消失。此时应该把所有的jobs都构建一遍,完了随便你重启都没关系。
Last modification:March 30th, 2021 at 10:54 am
If you think my article is useful to you, please feel free to appreciate

One comment

  1. May

    赞ヾ(≧∇≦*)ゝ

Leave a Comment Cancel reply