yum安装Jenkins报错Error in PREIN scriptlet in rpm package jenkins-2.204.5-1.1.noarch

解决方案:

[root@jenkins data]# rm -f /etc/sysconfig/jenkins

解决思路:
1.通过Yum安装Jenkins提示如下报错

[root@jenkins data]# yum install jenkins-2.204.5-1.1.noarch.rpm 
stat: cannot stat ‘/var/cache/jenkins’: No such file or directory
stat: cannot stat ‘/var/log/jenkins’: No such file or directory
stat: cannot stat ‘/var/lib/jenkins’: No such file or directory
error: %pre(jenkins-2.204.5-1.1.noarch) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package jenkins-2.204.5-1.1.noarch
  Verifying  : jenkins-2.204.5-1.1.noarch                                                                    1/1 

Failed:
  jenkins.noarch 0:2.204.5-1.1 

2.报错关键:PREIN scriptlet
就是 preinstall scriptlet,这是rpm在安装前执行的一段shell脚本,那么就查看执行的脚本是否能定位问题

[root@jenkins data]# rpm --scripts -qp jenkins-2.204.5-1.1.noarch.rpm > jenkins.log
[root@jenkins data]# ls
jenkins-2.204.5-1.1.noarch.rpm  jenkins.log

3.接下来查看报错的安装脚本,具体定位问题:

[root@jenkins data]# cat jenkins.log 
preinstall scriptlet (using /bin/sh):
...
  if [ -f "/etc/sysconfig/jenkins" ]; then
      logger -t jenkins.installer "Found previous config file /etc/sysconfig/jenkins"
      . "/etc/sysconfig/jenkins"
      stat --format=%U "/var/cache/jenkins" > "/tmp/jenkins.installer.cacheowner"
      stat --format=%U "/var/log/jenkins"  >  "/tmp/jenkins.installer.logowner"
      stat --format=%U ${JENKINS_HOME:-/var/lib/jenkins}  > "/tmp/jenkins.installer.workdirowner"
  else
      logger -t jenkins.installer "No previous config file /etc/sysconfig/jenkins found"
  fi

这段的意思:如果/etc/sysconfig/jenkins文件存在,执行下面一系列操作(stat …),应该是为了重复安装写的。

4.通过 ls /etc/sysconfig/jenkins查看文件是否真的存在,结果再次安装时确实存在,因此rm删除此文件再重新安装即可.

参考自:https://blog.csdn.net/weixin_33812433/article/details/91487445

你可能感兴趣的:(linux)