Linux install jenkins and install jenkins via docker container

Refer to some precautions for installation: https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions#InstallingJenkinsonRedHatdistributions-ImportantNoteonCentOSJava;

Download the stable version of the jenkinswar package

  • command

后台运行jenkins程序,指定端口8503,这里也可以指定下日历的目录"&>/自己的目录/jenkins.log

nohup java -jar jenkins.war --httpPort=8503 &
查看运行日志
tail -1000f nohup.out

Problem log

  • When I installed it with the server, I re-specified the Jenkins port (8503). I used Huawei Cloud, and added the inbound direction rule for this port in the security group of the server console. I still can't access it, because the firewall of this port has to be set on the server.

firewall-cmd --permanent --new-service=jenkins

firewall-cmd --permanent --service=jenkins --set-short="Jenkins Service Ports"

firewall-cmd --permanent --service=jenkins --set-description="Jenkins service firewalld port exceptions"

firewall-cmd --permanent --service=jenkins --add-port=8503/tcp

firewall-cmd --permanent --add-service=jenkins

firewall-cmd --zone=public --add-service=http --permanent

firewall-cmd --reload



firewall-cmd --list-all

Access in the browser, self-service IP + self-specified port

  • At this point we will enter the initialization page of jenkins, we will do it step by step


docker image install jenkins

Pull mirror

docker pull jenkins/jenkins:lts

start up

  • Start command, jenkins default port is 8080, my local 8080 is occupied, so re-specify a port 8501

本机先创建/var/jenkins_home

docker run -p 8501:8080 --name jenkins -v /var/jenkins_home:/var/jenkins_home -d jenkins/jenkins:lts

access

  • Server ip: 8501

Guess you like

Origin www.cnblogs.com/levcon/p/12731288.html