新聞中心
安裝jenkins

1> 下載jenkins包。
進入tomcat/webapps/ 目錄下,下載jenkins.war包到這里,如下載有問題,可自行下載傳到這個目錄下,部署的過程中半天都下不下來,提供了jenkins的附件
wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
2> Jekins環(huán)境變量設(shè)置
[root@localhost bin]sudo vi /etc/profile
export JENKINS_HOME=/data/program/tomcat/webapps/Jenkins
[root@localhost bin]. /etc/profile #使配置文件生效
3> 修改tomcat默認端口號
vi /usr/local/apache-tomcat/conf/server.xml
修改下面這段的port修改為不是8080的其它端口,這里修改為8081,還有個條件:在之前修改iptables的規(guī)則文件時已經(jīng)開放了8081的端口,如果沒有請重新修改,重啟iptables的服務(wù)。
4> 重啟tomcat,進入tomcat的安裝目錄下的bin目錄
[root@localhost bin]./startup.sh
tomcat會解壓war包,生成一個jenkins文件夾,而且會在root目錄下生成一個.jenkins的文件夾
5> Jenkins 驗證。在瀏覽器里,輸入網(wǎng)址:http://localhost:8081/jenkins
6> 輸入密碼 .首次進入jenkins如要輸入密碼
密碼位置:/root/.jenkins/secrets/initialAdminPassword,找不到這個文件就find . -name .jenkins
7> 安裝需要的插件
第一次進入,會出現(xiàn)默認插件安裝不成功,進入插件管理列表也為空,點擊advanced下面的CheckNow,即可輸出available的列表,多試幾次。除了基礎(chǔ)安裝的插件外,主要安裝的插件有:git, git Client, gitlab hook, ansible等
安裝ansible
前提:要安裝ansible系統(tǒng)中必須要安裝Python的版本在2.7及以上。
1> Ansible是屬于Extra Packages for Enterprise Linux (EPEL)庫的一部分,因此要先安裝EPEL
[root@localhost ~]yum install epel-release
2> 直接安裝ansible,目前默認安裝的版本是2.2,官方持續(xù)在更新
[root@localhost ~]yum install ansible
3> 為支持windows client,要安裝以下的包:安裝Python Winrm模塊
pip install “pywinrm>=0.1.1”
4> 底層通信基于PowerShell,管理機和遠程主機基于Kerbero認證,需額外安裝python-kerbero和MIT krb5依賴庫。
步驟1、 安裝python-kerberos依賴,命令如下:
yum -y install python-devel krb5-devel krb5-libs krb5-workstation
步驟2 、安裝python-kerberos,OSX和Linux發(fā)行版均默認安裝,安裝命令如下:
pip install Kerberos
遇到的問題及解決辦法:
1. 端口沖突,tomcat的端口改成8081. 8080端口是jenkins自帶的內(nèi)部端口,這也是上面步驟中改8081的目的。
2. tomcat service啟動之后,頁面加載不正常。解決辦法:systemctl start tomcat.service 啟動不行。進入到/usr/local/tomcat/bin,./startup.sh這樣啟動tomcat就可以解決。
網(wǎng)站標題:CentOS7上搭建Jenkins+Ansible服務(wù)
文章源于:http://m.5511xx.com/article/dhojjgp.html


咨詢
建站咨詢
