Java 在 Ubuntu 上安装 Jenkins

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24728648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 14:31:42  来源:igfitidea点击:

Installing Jenkins on Ubuntu

javajenkins

提问by suj

I am trying to install Jenkins on ubuntu 11.04

我正在尝试在 ubuntu 11.04 上安装 Jenkins

I have installed Oracle Java

我已经安装了 Oracle Java

$:~$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)
$:~$ javac -version
javac 1.8.0_05
$:~$

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.8.0_05/bin:/usr/lib/hadoop/hadoop-1.2.0/bin/:/usr/lib/pig/pig-0.12.0/bin:/usr/lib/hive/hive-0.11.0/bin:/usr/lib/hbase/hbase-0.94.8/bin
$:~$ echo $JAVA_HOME
/usr/lib/jvm/jdk1.8.0_05

When I try to install, I have some dependency issues..

当我尝试安装时,我有一些依赖性问题..

$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 jenkins : Depends: daemon but it is not installable
           Depends: default-jre-headless but it is not installable or
                    java-runtime-headless but it is not installable
E: Broken packages

回答by GTAWWEKID

Try this:

尝试这个:

sudo apt-get update
sudo apt-get remove default-jre default-jdk

sudo apt-get update
sudo apt-get install default-jre default-jdk

More about java on Ubuntu:
https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get

有关 Ubuntu 上的 Java 的更多信息:https:
//www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get

回答by Edwin Buck

Your installation of Java is likely the Oracle zip / tgz drop. By using it, the package manager (dpkg / apt in this case) is unaware it is installed.

您安装的 Java 很可能是 Oracle zip/tgz drop。通过使用它,包管理器(在本例中为 dpkg / apt)不知道它已安装。

Install the packaged java for the package manager to "know" that the right java is isntalled, or install the zip / tgz drop of jenkins.

为包管理器安装打包的 java 以“知道”正确的 java is nottalled,或者安装 jenkins 的 zip/tgz drop。

In short, if you want managed Jenkins, use the managed Java, and if you don't want it to be managed (sometimes that's a good option if you don't want it to be upgraded), don't use the managed Jenkins or Java. (Keep in mind that unmanaged means you get none of the bug fixes until you manually update, but it also means you get no surprises until you manually update).

简而言之,如果你想要托管的Jenkins,就使用托管的Java,如果你不希望它被托管(如果你不想升级,有时候这是一个不错的选择),不要使用托管的Jenkins或爪哇。(请记住,非托管意味着在您手动更新之前您不会获得任何错误修复,但这也意味着您在手动更新之前不会感到意外)。

回答by Mikel Pascual

Seems like you should run

好像你应该跑

sudo apt-get update
sudo apt-get upgrade

And try again.

然后再试一次。

Anyway, Jenkins users quite frecuently complain about the installer not working.

无论如何,Jenkins 用户经常抱怨安装程序不起作用。

Your life will be easier if you do it manually. It is quite easy and you have complete instructions all around the web: http://clavadetscher.dyndns.org/wiki/en/Install_and_upgrade_Jenkins_CI_Server_on_Ubuntu_12.04_and_Tomcat6

如果您手动操作,您的生活会更轻松。这很简单,您在网络上都有完整的说明:http: //clavadetscher.dyndns.org/wiki/en/Install_and_upgrade_Jenkins_CI_Server_on_Ubuntu_12.04_and_Tomcat6

note: tomcat7 (if you are tempted) has given me some headaches with Jenkins. I always end up installing tomcat6.

注意:tomcat7(如果您受到诱惑)让我对 Jenkins 感到头疼。我总是最终安装tomcat6。

回答by User123456

to work install Jenkins they request Java versions greater than 1.8.0_1. I got hte same error and I updated java to below version

为了安装 Jenkins,他们要求 Java 版本大于 1.8.0_1。我遇到了同样的错误,我将 java 更新到以下版本

java -version
java version "1.8.0_121"

Now jenkins installing without errors Below link worked for 14.04 (hope it works for 11.04 too) Install Java version in ubuntu

现在 jenkins 安装没有错误下面的链接适用于 14.04(希望它也适用于 11.04) 在 ubuntu 中安装 Java 版本

回答by Xander

Pre-made script for install Jenkins and it will also print the access code to the console for the first login as well.

用于安装 Jenkins 的预制脚本,它还将在首次登录时将访问代码打印到控制台。

You should be able to copy and paste

您应该能够复制和粘贴

cd ~/ 
git clone https://github.com/120GBSSD/jenkins-install-xenial.git 
chmod +x ~/jenkins-install-xenial/Ubuntu:16.04-Jenkins.sh 
./Ubuntu:16.04-Jenkins.sh

回答by Mohamed Dernoun

Ended up solving this by running the following command:

通过运行以下命令最终解决了这个问题:

sudo add-apt-repository universe

回答by Shashikant Pandit

Steps to install jenkins and view in browser with IP:-

使用 IP 安装 jenkins 并在浏览器中查看的步骤:-

  1. sudo apt update
  2. sudo apt search jdk --to search jdk
  3. sudo install openjdk-8-jre
  4. sudo install openjdk-8-jre-headless
  5. wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key| sudo apt-key add -

  6. add below line in the file /etc/apt/sources.list: sudo nano /etc/apt/sources.list OR sudo vi /etc/apt/sources.list

    Add this below link at the end of editing document.

    deb https://pkg.jenkins.io/debianbinary/

  7. Update your local package index

    sudo apt-get update

  8. Install jenkins now

    sudo apt install jenkins

  9. start jenkins service

    sudo systemctl start jenkins

  10. Enable the jenkins service

    sudo systemctl enable jenkins

    Now jenkins installed in your system. If are following these steps you are good to go. heat localhost:8080 in the browser. because jenkins works on 8080 by default. you can change it's port to others.

    Now if are using google cloud then there is one more step.

  11. Firewall rule details (Add firewall rule to enable ip and tcp 8080 port) That's that now if you open in browser http://<your-ip>:8080 jenkins will open and ask you to view the password which give location on the ui.
  1. sudo apt 更新
  2. sudo apt search jdk --搜索jdk
  3. 须藤安装 openjdk-8-jre
  4. 须藤安装 openjdk-8-jre-headless
  5. wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key| sudo apt-key 添加 -

  6. 在文件 /etc/apt/sources.list 中添加以下行: sudo nano /etc/apt/sources.list 或 sudo vi /etc/apt/sources.list

    在编辑文档的末尾添加以下链接。

    deb https://pkg.jenkins.io/debianbinary/

  7. 更新您的本地包索引

    sudo apt-get 更新

  8. 立即安装詹金斯

    sudo apt 安装詹金斯

  9. 启动詹金斯服务

    须藤 systemctl 启动詹金斯

  10. 启用詹金斯服务

    须藤 systemctl 启用詹金斯

    现在 jenkins 安装在您的系统中。如果遵循这些步骤,您就可以开始了。在浏览器中加热 localhost:8080。因为 jenkins 默认在 8080 上工作。您可以将其端口更改为其他人。

    现在如果使用谷歌云,那么还有一步。

  11. 防火墙规则详细信息(添加防火墙规则以启用 ip 和 tcp 8080 端口) 现在,如果您在浏览器中打开 http:// <your-ip>:8080 jenkins 将打开并要求您查看在 ui 上给出位置的密码。

For more detail please visit

欲了解更多详情,请访问

https://www.jenkins.io/

https://www.jenkins.io/