CentOS 安装 Jenkins

原文:https://www.sunjianhua.cn/archives/centos-jenkins.html

 

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

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

 

posted @ 2018-11-20 18:03  这个名字想了很久~  阅读(114)  评论(0编辑  收藏  举报