Jenkins安装 CentOS 7.2

安装过程直接参考官网, 默认安装稳定版 2.32.2-1.1。

需要安装java

yum -y install java-1.8.0-openjdk* --skip-broken

开机启动

systemctl enable jenkins.service

启动

systemctl start jenkins.service

建议修改默认工作目录,避免目录权限导致的问题

vi /etc/sysconfig/jenkins
JENKINS_HOME="/data/jenkins"

Jenkins--Run shell command in jenkins as root user?

You need to modify the permission for jenkins
user so that you can run the shell commands. You can install the jenkins as as service (download the rpm package), You might need to change the ports because by default it runs http on 8080 and AJP on 8009 port. Following process is for CentOS

  1. Open up the this script (using VIM or other editor):
    vim /etc/sysconfig/jenkins

  2. Find this $JENKINS_USER and change to “root”:
    $JENKINS_USER="root"

  3. Then change the ownership of Jenkins home, webroot and logs:

chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
  1. Restart Jenkins and check the user has been changed:
service jenkins restart
ps -ef | grep jenkins

Now you should be able to run the Jenkins jobs as the root user and all the shell command will be executed as root
.

你可能感兴趣的:(Jenkins安装 CentOS 7.2)