本文介绍如何在 openSUSE Tumbleweed 操作系统上安装 Jenkins,提供 Snap 以及 通用安装两种方法。
Install by snaps
本文乃笔者亲自操作尝试确认可行后所写,使用了 snappy 来安装、使用 Jenkins。
参考文献: https://snapcraft.io/install/jenkins/opensuse
Enable snapd
Snap can be installed from the command line on openSUSE Leap 42.3
, openSUSE Leap 15
, openSUSE Tumbleweed
.
You need first add the snappy
repository from the terminal. Leap 15 users, for example, can do this with the following command:
sudo zypper addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.0 snappy
Swap out openSUSE_Leap_15.0
for either openSUSE_Leap_42.3
or openSUSE_Tumbleweed
if you’re using a different version of openSUSE.
For example, as for Tumebleweed:
sudo zypper ar --refresh https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed snappy
With the repository added, import its GPG key:
sudo zypper --gpg-auto-import-keys refresh
Finally, upgrade the package cache to include the new snappy repository:
sudo zypper dup --from snappy
Snap can now be installed with the following:
sudo zypper install snapd
You then need to either reboot, logout/login or source /etc/profile
to have /snap/bin added to PATH. Additionally, enable and start both the snapd and the snapd.apparmor services with the following commands:
sudo systemctl enable snapd
sudo systemctl start snapd
Tumbleweed users also need to run the following:
sudo systemctl enable snapd.apparmor
sudo systemctl start snapd.apparmor
Install jenkins
To install jenkins, simply use the following command:
sudo snap install jenkins --classic
Using jenkins
Config Location
/var/snap/jenkins/{number}
Replace updateCenter URL
sudo vim /var/snap/jenkins/1091/hudson.model.UpdateCenter.xml
# replace URL to https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
Basic commands
sudo snap restart jenkins
sudo snap stop jenkins
sudo snap restart jenkins
Show logs
sudo snap logs -f jenkins
Show info
sudo snap info jenkins
More commands
sudo snap --help
Install by official document
Reference: https://www.jenkins.io/doc/book/installing
For openSUSE
To use this repository, run the following command:
WARNING: The gpg key use to sign our packages has been updated on 16th of April 2020, therefore you need to reimport it if you imported before this date.
sudo zypper addrepo -f https://pkg.jenkins.io/opensuse/ jenkins
With that set up, the Jenkins package can be installed with:
sudo zypper install jenkins
You will need to explicitly install a Java runtime environment, because Oracle's Java RPMs are incorrect and fail to register as providing a java dependency. Thus, adding an explicit dependency requirement on Java would force installation of the OpenJDK JVM.
- 2.164 (2019-02) and newer: Java 8 or Java 11
- 2.54 (2017-04) and newer: Java 8
- 1.612 (2015-05) and newer: Java 7
With that set up, the Jenkins package can be installed with:
See the installation guide for more information, including how Jenkins is run and where the configuration is stored, etc.