Fork me on GitHub
Suzf  Blog

Archive Linux

How To Install Jenkins on Ubuntu 16.04


Jenkins是一个用Java编写的开源持续集成工具。在与Oracle发生争执后,项目从Hudson项目复刻。 Jenkins提供了软件开发的持续集成服务。它运行在Servlet容器中(例如Apache Tomcat)。它支持软件配置管理(SCM)工具(包括AccuRev SCMCVSSubversionGitPerforceClearcase和和RTC),可以执行基于Apache AntApache Maven的项目,以及任意的Shell脚本和Windows批处理命令。Jenkins的主要开发者是川口耕介。[2]Jenkins是在MIT许可证下发布的自由软件[3] 可以通过各种手段触发构建。例如提交给版本控制系统时被触发,也可以通过类似Cron的机制调度,也可以在其他的构建已经完成时,还可以通过一个特定的URL进行请求。


Minimum Recommended Configuration: Java 7 256MB free memory 1GB+ free disk space Recommended Configuration for Small Team: Java 8 1GB+ free memory 50GB+ free disk space



On Debian-based distributions, such as Ubuntu, you can install Jenkins through apt.

Recent versions are available in an apt repository. Older but stable LTS versions are in this apt repository.

# Install Jenkins
wget -q -O - | sudo apt-key add -
sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

# Install OpenJDK
# --
# -- The openjdk-8-jre package contains just the Java Runtime Environment. 
# -- If you want to develop Java programs then please install the openjdk-8-jdk package.
sudo apt-get install openjdk-8-jre openjdk-8-jdk

# make sure the jdk install success
java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

# now jdk installed, Let's add JAVA_HOME Env variable
cat > /etc/profile.d/ < < EOF

source /etc/profile.d/

This package installation will:

  • Setup Jenkins as a daemon launched on start. See /etc/init.d/jenkins for more details.
  • Create a jenkins user to run this service.
  • Direct console log output to the file /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
  • Populate /etc/default/jenkins with configuration parameters for the launch, e.g JENKINS_HOME
  • Set Jenkins to listen on port 8080. Access this port with your browser to start configuration.
  • INFO
  • If your /etc/init.d/jenkins file fails to start Jenkins, edit the /etc/default/jenkins to replace the line ----HTTP_PORT=8080---- with ----HTTP_PORT=8081---- Here, "8081" was chosen but you can put another port available.

Create Admin User and Password for Jenkins

Jenkins最初配置为在首次启动时是安全的。 如果没有用户名和密码,Jenkins将无法再访问,并且开放端口有限。 在初始运行Jenkins期间,将生成一个安全令牌并将其打印在控制台日志中:


Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:


This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword


上面每个平台的安装说明包括您可以找到此日志输出的默认位置。 首次打开Jenkins UI时,必须在“安装向导”中输入此令牌。 如果您跳过安装向导中的用户创建步骤,则此令牌也将用作用户admin的默认密码。


安装向导还将安装此Jenkins服务器的初始插件。 推荐的可用插件集是基于最常见的用例。 您可以在安装向导期间添加更多内容,或者根据需要稍后安装。 [0] [1]

Jenkins ver. 2.32.1

How-to expand GlusterFS replicated clusters by one server

This has come up several times in the last week. "I have 2n servers with 2 or 4 bricks each and I want to add 1 more server. How do I ensure the new server isn't a replica of itself?" This isn't a simple thing to do. When you add bricks, replicas are added with each set of bricks in the replica count. For "replica 2", each 2 new bricks added forms a replica pair. To prevent your two new bricks on the new server from being replicas of themselves, you'll need to move an old brick to the new server. This is done with the replace-brick command. replica_expansion So first we move server1:/data/brick2 to server3:/data/brick2
gluster volume replace-brick $volname $from $to start
Monitor for completion
watch gluster volume replace-brick $volname $from $to status
Once it's completed then commit the change
gluster volume replace-brick $volname $from $to commit
Check your data to ensure it's all working right. If not, panic! Well, I suppose you could come join us in the IRC channel to help you figure out why, but it really should just work. First thing we're going to tell you is to check the logs, so might as well do that too. Ok, now that your data's all moved, your volume is completely operational and all it's circuits are functioning perfectly, you're ready to add your two new bricks. Save yourself some time and just format the brick store that's mounted at server1:/data/brick2. You'll have to wipe it and it's xattrs anyway, so that's much quicker.
gluster volume add-brick $volname server1:/data/brick2 server3:/data/brick1
gluster volume rebalance $volname start
And you're all set.

How-to configure a proxy for maven




  1. 编辑 ${user.home}/.m2/settings.xml 文件,如果该目录下没有该文件,复制 $MAVEN_HOME/conf/setting.xml
  2. 找到<proxies>节点,设置代理信息
  3. 完成上述配置,仍然还是会有问题
    [ERROR] Failed to execute goal on project xiaov: Could not resolve dependencies for project org.b3log:xiaov:war:2.2.0: Failed to collect dependencies at org.b3log:latke:jar:2.3.5 -> Failed to read artifact descriptor for Could not transfer artifact from/to central ( PKIX path building failed: unable to find valid certification path to requested target -> [Help 1]
    原因就是Maven走的是https,使用代理连接才会出现上述SSL认证问题。 更多解决办法:点击查看推荐使用下面的解决办法
  4. 最简洁的Maven配置请将下述配置信息覆盖settings.xml
    <?xml version="1.0" encoding="UTF-8"?>
     <settings xmlns=""


这里推荐使用阿里Maven仓库镜像(Nexus仓库),希望能稳定存活。 修改Maven的settings.xml文件,配置mirrors的子节点,添加如下mirror:

    <name>Nexus aliyun</name>
上文来源 Abinnz's blog

以下是我个人 Jenkins Maven proxy 设置

:/usr/local/apache-maven-3.3.9# diff  -ruN conf/settings.xml.old  conf/settings.xml 
--- conf/settings.xml.old	2017-02-21 16:59:07.996000000 +0800
+++ conf/settings.xml	2017-02-21 17:01:15.496000000 +0800
@@ -88,6 +88,10 @@
    | specification in this list marked as active will be used.
+    <proxy>
+      <host></host>
+      <port>3128</port>
+    </proxy>
     <!-- proxy
      | Specification for one proxy, to be used in connecting to the network.


[译] Percona Server In-Place Upgrading Guide From 5.6 to 5.7

就地升级是使用服务器中的现有数据来完成。 一般来说,就是停止服务器,安装新的服务器版本并使用之前的数据文件启动它。 虽然它可能不适合于高复杂性的环境,但它们可能适用于许多场景。 以下是5.7系列中相关的改变的总结。 强烈建议您阅读以下指南,因为它们包含可能导致自动升级失败的不兼容更改的信息:

  1. Changed in Percona Server 5.7
  2. Upgrading MySQL
  3. Upgrading from MySQL 5.6 to 5.7

How-to start my first project on GitLab

1. login as Administrator and create  test group/project/user

create test group - test create test user   - test change test user to test group and change `Project access` role to owner create a demo project -- -- Visibility Level can chose public for test at the end, click Create project button

2. use the test user - test login and and an SSH key

click avatar img --> profile setting --> SSH keys on linux git client generate a ssh key for gitlab

cd $HOME
ssh-keygen -t rsa -C "[email protected]" -f .ssh/gitlab_rsa

reslove multi ssh key issue

cat  >> $HOME/.ssh/config << EOF
    IdentityFile ~/.ssh/gitlab_rsa
    User git
    Port 22

paste the ssh keys public public, the example file is .ssh/ now `cat  .ssh/` and then copy the output to Key area. set up an title for this ssh key.

3. test the git connection

^_^[15:49:55][[email protected] ~]$ssh -T Welcome to GitLab, zfsu!

4. checkout and commit

Git global setup

git config --global "Administrator"
git config --global "[email protected]"

Create a new repository

git clone [email protected]:test/demo.git
cd demo
git add
git commit -m "add README"
git push -u origin master

Existing folder or Git repository

cd existing_folder
git init
git remote add origin [email protected]:test/demo.git
git add .
git commit
git push -u origin master




How-to quick install GitLab via omnibus

由于 The Geate Wall 过于强大,有些时候不得不科学上网。 通过 rubygems & 官方 omnibus 也会出现种种问题。 踩坑无数,喜出望外的是发现了 清华大学 TUNA 镜像源 [] # cat /etc/issue Ubuntu 16.04.1 LTS 这里以 Ubuntu 16.04.1 LTS 为例 其他版本可自行到 tsinghua tuna mirror 查看 首先信任 GitLab 的 GPG 公钥:

GlusterFS 集群文件系统介绍

来源: 作者:久坐尘埃


GlusterFS是Scale-Out存储解决方案Gluster的 核心,它是一个开源的分布式文件系统,具有强大的横向扩展能力,通过扩展能够支持数PB存储容量和处理数千客户端。GlusterFS借助TCP/IP或 InfiniBand RDMA网络将物理分布的存储资源聚集在一起,使用单一全局命名空间来管理数据。GlusterFS基于可堆叠的用户空间设计,可为各种不同的数据负载提 供优异的性能。


图1 GlusterFS统一的挂载点

GlusterFS 支持运行在任何标准IP网络上标准应用程序的标准客户端,如图2所示,用户可以在全局统一的命名空间中使用NFS/CIFS等标准协议来访问应用数据。 GlusterFS使得用户可摆脱原有的独立、高成本的封闭存储系统,能够利用普通廉价的存储设备来部署可集中管理、横向扩展、虚拟化的存储池,存储容量 可扩展至TB/PB级。

How-to fix failed to load ZFS module

在debian 8  使用的过程中 发现 zfs 无法加载

# uname -r
# modprobe zfs
modprobe: FATAL: Module zfs not found.


$ dpkg -l | grep zfs
ii  debian-zfs                          7~jessie                    amd64        Native ZFS filesystem metapackage for Debian.
ii  libzfs2                               amd64        Native ZFS filesystem library for Linux
ii  zfs-dkms                              all          Native ZFS filesystem kernel modules for Linux
ii  zfsonlinux                          8                           all trust package
ii  zfsutils                              amd64        command-line tools to manage ZFS filesystems
x 是一个正整数


$ dkms  status
spl, 0.6.5.x, 3.x.0-4-amd64, x86_64: installed
zfs, 0.6.5.x, 3.x.0-4-amd64, x86_64: installed


# dkms remove -m zfs -v 0.6.5.x --all
# dkms remove -m spl -v 0.6.5.x --all
# dkms add -m spl -v 0.6.5.x
# dkms add -m zfs -v 0.6.5.x
# dkms install -m spl -v 0.6.5.x
# dkms install -m zfs -v 0.6.5.x

If you get the same error, then reinstall the headers package:

# apt-get install --reinstall linux-headers-$(uname -r)


$ sudo modprobe zfs
$ lsmod  | grep zfs
zfs                  2793472  1 
zunicode              331776  1 zfs
zcommon                53248  1 zfs
znvpair                90112  2 zfs,zcommon
spl                   102400  3 zfs,zcommon,znvpair
zavl                   16384  1 zfs
$ dkms status
spl, 0.6.5.x, 3.x.0-4-amd64, x86_64: installed
spl, 0.6.5.x, 4.x.0-0.bpo.1-amd64, x86_64: installed
zfs, 0.6.5.x, 3.x.0-4-amd64, x86_64: installed
zfs, 0.6.5.x, 4.x.0-0.bpo.1-amd64, x86_64: installed