跳至主要内容

Installing Jenkins OS X Homebrew

原文链接

Homebrew is the easiest way to install and manage applications on OS X. Let\’s go through how we
install and configure Jenkins.

Installation

Follow the instructions at http://brew.sh/ if you have not had Homebrew installed. Then, let\’s proceed to install Jenkins

$ brew update && brew install jenkins

Jenkins is a Java web application. Download and install the latest Java Runtime Environment manually, or use Homebrew Cask to install it

$ brew cask install java


Starting Jenkins

After Jenkins is installed successfully, follow the instructions to start Jenkins on login

$ ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents

If you want to configure Jenkins to launch on system startup, for all users on OS X, then copy the plist file to the system Launchd location instead

$ sudo cp -fv /usr/local/opt/jenkins/*.plist /Library/LaunchDaemons
$ sudo chown `whoami` /Library/LaunchDaemons/homebrew.mxcl.jenkins.plist

You can always start Jenkins manually with

$ /usr/local/bin/jenkins

or if you have set up your PATH correctly when installing Homebrew, simply

$ jenkins


Restarting Jenkins

If you have an older version of Jenkins and you are upgrading it, then you can restart it this way:

$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist


Jenkins Options

The default Jenkins startup command in ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist is very simple.

      /usr/bin/java
      -Dmail.smtp.starttls.enable=true
      -jar
      /usr/local/opt/jenkins/libexec/jenkins.war
      --httpListenAddress=127.0.0.1
      --httpPort=8080


Launchd starts a java command, listening on only the loopback network interface and using the port 8080 and listen to SMTP connection over TLS.

Network Port

8080 is a common network port for web development. Tomcat defaults to 8080. On my machine, I run Gitbucket on 8080. Let\’s change it to “8181”

--httpPort=8080


Java Options

If you have any additional Java runtime options, add them to the configuration file. For example, we want to set:
  • Initial and maximum VM size to 1G
  • Use CMS garbage collector for more responsive system
  • Garbage collect PermGen classes – more details here
  • Limit PermGen size

    -Xms1G
    -Xmx1G

    -XX: UseConcMarkSweepGC
    -XX: CMSClassUnloadingEnabled
    -XX:MaxPermSize=256m

 Jenkins Plugins

A fresh Jenkins installation is ready to be used, especially if you only need to manage Java projects. There are many Jenkins plugins that can make Jenkins much more powerful. To access Plugin Manager, go to Jenkins ⇒ Dashboard ⇒ Plugin Manager or the url http://jenkins:8181/pluginManager/available.
The easiest way to install a plugin is to view the list of all published plugins in the Plugin Manager, click and Install and restart Jenkins. To install a plugin manually, copy the plugin-name.hpi file to Jenkin\’s directory. In the Homebrew installation, that will be $HOME/.jenkins/plugins. Restart Jenkins and the plugin will be installed.
These are the plugins I have installed:

Jenkins configuration

Besides the launchd configuration file explained above, all other Jenkins configuration is stored in $HOME/.jenkins. The main configuration file is config.xml. You really should not edit the configuration files by hand. Use the Jenkins web interface to make changes http://jenkins:8181/manage

Upgrading Jenkins

As a continuous integration server, Jenkins itself is frequently updated. You can check if a new version of Jenkins is available

$ brew update && brew outdated jenkins

Upgrading jenkins is as easy as


$ brew upgrade jenkins

Homebrew\’s default behaviour is to keep older versions. If you don\’t need the older versions of Jenkins anymore, you can remove them

$ brew cleanup jenkins

Preserve Configuration And Plugins

You don\’t want to set up Jenkins all over again on every upgrade. The good news is, Jenkins server files and your configuration are in separate locations. Your new Jenkins installation will automatically pick up your existing configurations and plugins at “$HOME/.jenkins”
启动执行脚本目录所在:
安装包所在:
服务项所在:
可以通过命令开始停止:
// 方法一:
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist 启动  
   
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist 停止
如果要修改端口,比如7070,可在第8步重启jenkins前执行以下命令修改端口参数
defaults write /Library/Preferences/org.jenkins-ci httpPort 7070
Jenkins默认安装目录:
/users/share/  
或者更改目录:
cd 到 /Library/LaunchDaemons 编辑 org.jenkins-ci.plist  更改jenkinshome和username
重启Jenkins即可 
然后链接 launchd 配置文件
// 方法二(1): 
$ln -sfv /usr/local/opt/jenkins/*.plist ~/Library/LaunchAgents
可以更改此 plist 来进行一些自定义的配置,详细列表可以参考https://wiki.jenkins-ci.org/display/JENKINS/Starting%20and%20Accessing%20Jenkins
如果要其他机器也可以访问,把 plist 里的--httpListenAddress=127.0.0.1删掉即可
修改完后,在终端执行
// 方法二(2)
$launchctl load ~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
即可启动 Jenkins
接着用浏览器访问localhost:8080(默认配置),就可以看到 Jenkins 的 web 界面了
# 这种方式安装的Jenkins默认目录是/usr/local/Cellar/jenkins/1.651/libexec/....
#所以想让其他局域网用户访问则需要修改/etc/apache2/httpd.conf的ServerRoot 路径  
改为/usr/local/Cellar/ 即可 
进入 系统管理-启用安全-访问控制-Jenkins专有用户数据库-安全矩阵 添加一个用户:
保存之后会在Jenkins安装目录下生成config.xml文件.
<useSecurity>trueuseSecurity>  这个节点表示使用安全管理,也就是需要用户登录才能操作  
用刚才添加的用户进行注册,不使用密码登录可以
<useSecurity>falseuseSecurity>   
即可.

评论

此博客中的热门博文

Resolving errSecInternalComponent errors during code signing

原文链接 One code signing issue I commonly see, both here on DevForums and in my Day Job™ with DTS, is that the codesign command fails with errSecInternalComponent. This issue crops up in a wide variety of circumstances and the correct fix depends on the specific problem. This post is my attempt to clarify the potential causes of this error and help folks resolve it. If you have any questions or comments about this, please start a new thread, tagging it with Code Signing so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Resolving errSecInternalComponent errors during code signing In some circumstances the codesign command might fail with the error errSecInternalComponent. For example: % codesign -s "Apple Development" "MyTrue" MyTrue: errSecInternalComponent This typically affects folks who are signing code in a nonstandard environm...

iOS:检测使用VPN或Proxy

参考链接: https://www.jianshu.com/p/c3b950dbf86a https://gist.github.com/PramodJoshi/4faad4c91f7dcb4eb9b06be8390c01db http://noodlecode.net/2018/04/check-if-ios-app-is-connected-to-vpn 第一种方法 需要导入框架CFNetwork 然后,这个方法是mrc的:需要添加-fno-objc-arc的flag 代码如下: + ( BOOL )getProxyStatus { NSDictionary *proxySettings = NSMakeCollectable ([( NSDictionary *) CFNetworkCopySystemProxySettings () autorelease]); NSArray *proxies = NSMakeCollectable ([( NSArray *) CFNetworkCopyProxiesForURL (( CFURLRef )[ NSURL URLWithString: @"http://www.google.com" ], ( CFDictionaryRef )proxySettings) autorelease]); NSDictionary *settings = [proxies objectAtIndex: 0 ]; NSLog ( @"host=%@" , [settings objectForKey:( NSString *)kCFProxyHostNameKey]); NSLog ( @"port=%@" , [settings objectForKey:( NSString *)kCFProxyPortNumberKey]); NSLog ( @"type=%@" , [settings objectForKey:( NSString *)kCFProxyTypeKey]); if ([[settings object...

去广告DNS设置,国内ADGuard DNS方案,手机电脑iOS去广告,保护隐私

 原文链接 之前分享过使用mac系统搭建adguard home,这几个月用下来零零散散基本上也被弃用了。主要原因是因为需要保持电脑一直开机。但是我的电脑是笔记本,存在移动各个地域的情况,也就是说只能够屏蔽电脑自身,对于手机而言不太现实。今天偶然发现dnspod推出了高级版的公共解析。dnspod背靠腾讯云,肯定是合法合规的公共解析服务,这个高级版用起来不错。 国内自己搭建解析服务是违法行为,所以这也是为什么使用dnspod的原因。 后台截图 开始使用 首先我们先进入dnspod的公共解析页面,点击开始使用。 专业版公共解析 dnspod会提供几种预设,我们选择「开发者」即可 开发者 然后你就成功的申请到自己个人使用的dns了! 更新拦截规则 我们可以将常见的广告过滤规则加入到dns中。我们在顶部选项卡中选择「拦截规则」。 拦截规则设置 打开adguard adguard 绑定iOS设备 推荐使用描述文件的方式,删除配置时删除描述文件即可。 描述文件 绑定macOS 推荐使用描述文件的方式,删除配置时删除描述文件即可。 描述文件 mac需要在「系统偏好设置」的「网络」中查看是否正在运行。 代理 如果没有运行需要点击「···」来启动服务。 启动服务 绑定路由器 找到自己路由器的DHCP设置,修改dns,然后记得绑定自己的ip。 修改dns 绑定ip 费用 目前有300万次/月的免费额度,但没有超出之后的价格。300万次一个人比较难用完,可以放心使用。 我个人使用iOS设备两台、智能家居、电脑两台,日均请求数大致2万/日。 判断是否搭建成功 可以通过查看日志的方式,日志大概有半小时到一小时的延迟,请耐心等待。