我的 jenkins 似乎已损坏。安装旧版本后,我尝试升级。当我尝试
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
升级失败。然后我使用以下方法删除了 jenkins
sudo apt-get remove jenkins
我再次尝试安装。它给出
Reading package lists... Done
Building dependency tree
Reading state information... Done
jenkins is already the newest version.
The following packages were automatically installed and are no longer required:
libjna-java libhttpcore-java libxbean-java libargs4j-java libhttpclient-java
libplexus-build-api-java libbackport-util-concurrent-java
libplexus-utils-java libjffi-java libjffi-jni
libmaven-common-artifact-filters-java libjsr305-java libcommons-jexl-java
libplexus-bsh-factory-java libplexus-container-default-java
libganymed-ssh2-java jenkins-cli libplexus-sec-dispatcher-java
libcommons-net2-java libjsoup-java libmaven2-core-java libplexus-cipher-java
libjenkins-remoting-java libeasymock-java libplexus-i18n-java
libmaven-invoker-java libplexus-containers-java libjaffl-java libdoxia-java
libmaven-dependency-tree-java libmodello-java libplexus-archiver-java
libconstantine-java libmaven-scm-java libmaven-enforcer-plugin-java
libplexus-io-java libwagon-java libcommons-vfs-java libanimal-sniffer-java
libgoogle-collections-java libnetbeans-cvsclient-java
libmaven-plugin-testing-java libplexus-classworlds-java libitext1-java
libplexus-interactivity-api-java libcommons-jxpath-java jenkins-common
libplexus-interpolation-java libclassworlds-java
libcommons-configuration-java libjnr-posix-java libplexus-ant-factory-java
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 513 not upgraded.
但service jenkins restart
命令投掷
jenkins: unrecognized service
甚至http://localhost:8080/
不工作。
我想从头开始安装。有什么建议吗?
編輯:
我遵循以下步骤:
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install -f && sudo apt-get autoremove
然后按照上述相同的步骤进行安装。
但仍然是同样的错误。我再次尝试使用删除包
sudo apt-get remove jenkins && sudo apt-get install jenkins
这是部分输出:
The following NEW packages will be installed:
jenkins
0 upgraded, 1 newly installed, 0 to remove and 268 not upgraded.
Need to get 0 B/61.3 MB of archives.
After this operation, 67.4 MB of additional disk space will be used.
Selecting previously unselected package jenkins.
(Reading database ... 224579 files and directories currently installed.)
Unpacking jenkins (from .../archives/jenkins_1.557_all.deb) ...
Processing triggers for ureadahead ...
Setting up jenkins (1.557) ...
但服务仍然无法被识别。
我注意到的另一件事是 /etc/init.d/jenkins
空的。
还有其他方法可以安装相同的 jenkins 包吗?
答案1
好吧,包已被删除,所以它无法启动或运行。运行sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install -f && sudo apt-get autoremove
以后从 ubuntu 存储库之外安装包时要小心。在我看来,你最好从源代码构建或使用 ppa。
从您对问题的描述来看,您的配置文件不知何故被损坏了。简单地删除并重新安装软件包无法解决问题(在 Linux 中很少能解决问题),因为apt-get remove foo
会删除库和二进制文件,但会保留配置文件。然后安装时,apt-get install foo
配置文件会保留下来。
为了解决这个问题,在我看来,最好是清除而不是删除包(尽管如果您愿意,您可以编辑配置文件来修改 apt-get 的行为)。
sudo apt-get purge jenkins
sudo apt-get install jenkins
如果问题仍然存在,您可能需要向詹金斯提交错误报告。