Tags:Jenkins

Category: DevOps

how to install Jenkins in Linux Server( use yum to install)

  1. add Jenkin repo in yum
// bash
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
  1. Install Jenkins in yum
//bash
yum install Jenkins -y
  1. Self configure Jenkins
// bash modify jenkins config file
vi /etc/sysconfig/jenkins
// modify Jenkins running port 
JENKINS_USER="root" // default is jenkins, change to root
JENKINS_PORT="8081" // default is 8080 change it to the port you want to use
  1. Run Jenkins
// bash
service jenkins start
// other usage
service jenkins restart
service jenkins stop
  1. Open Jenkins console in browser, input http://yourdomain.com:JENKINS_PORT
    the first step is get the admin password from jenkin initial config
//bash 
tail /var/lib/jenkins/secrets/initialAdminPassword
  • Then install suggested plugins
  • create a new admin user of jenkins or just use default admin and skip it

problems you may meet

  • Jenkins can not connect to the Internet from server in China.
    Solved: change the Jenkins checkUrl in /var/lib/jenkins/updates/default.json
    change the connectionCheckUrl from 'http://www.google.com' to any valid website can view in China Then restart Jenkins
//bash
service jenkins restart

Reference

在linux服务器上安装Jenkins
jenkins部署时遇到“似乎无法联网”,导致无法安装默认插件的解决方案