Jenkins Ansible安裝部署

2022-09-07 11:09:11 字數 4437 閱讀 4744

一、環境說明

作業系統:centos 7.5 x86_64

j**a版本:jdk-8u181

jenkins版本:jenkins-2.134

ansible版本:ansible-2.3.3.0

二、配置前準備

# systemctl disable firewalld.service

# systemctl stop firewalld.service

# sed -i '

s/selinux=enforcing/selinux=disabled/

' /etc/selinux/config

# setenforce

0# hostnamectl --static set-hostname jenkins-ansible

三、安裝jenkins

1.配置j**a環境變數

# tar -zxvf jdk-8u181-linux-x64.tar.gz -c /opt

# cat > /etc/profile.d/jdk.sh

<# j**a environment configuratione

export j**a_home=/opt/jdk1.8

.0_181

export j**a_bin=/opt/jdk1.8.0_181/bin

export path=$path:$j**a_home/bin

export classpath=.:$j**a_home/lib/dt.jar:$j**a_home/lib/tools.jar

export j**a_home j**a_bin path classpath

eof

# source /etc/profile.d/jdk.sh

2.新增jenkins源並安裝

配置j**a配置檔案

# vi /etc/sysconfig/jenkins

jenkins_j**a_cmd="

/opt/jdk1.8.0_181/bin/j**a

"修改預設埠號:

jenkins_port="

8888

"不可改為1024以下埠

注:jenkins工作的目錄,儲存檔案的位址,外掛程式,生成的檔案都在這個目錄下jenkins_home="/var/lib/jenkins",

jenkins的使用者,擁有$jenkins_home和/var/log/jenkins的許可權

3.啟動jenkins

# systemctl daemon-reload

# systemctl enable jenkins

# systemctl start jenkins

# systemctl status jenkins

4.安裝git、m**en、gradle

安裝git

yum -y install git

# unzip gradle-4.6-all.zip

# vi /etc/profile.d/gradle.sh

# gradle environment configuratione

export gradle_home=/opt/gradle-4.6

export gradle_bin=/opt/gradle-4.6/bin

export path=$path:$gradle_home/bin

export classpath=.:$gradle_home/lib

# source /etc/profile.d/gradle.sh

# gradle -v

# tar -zxvf apache-m**en-3.5.2-bin.tar

.gz#

mv apache-m**en-3.5.2-bin /opt/m**en3.5.2

# vi /etc/profile.d/m**en.sh

# m**en environment configuratione

export m2_home=/opt/m**en3.5.2

export path=$m2_home/bin:$

# source /etc/profile.d/m**en.sh

# mvn -version

四、安裝ansible

1.安裝依賴包

yum

install zlib-devel bzip2-devel openssl-devel gcc python-devel

# unzip setuptools-38.5.1.zip

# cd setuptools-38.5.1

# python setup.py

install

# tar -zxvf pycrypto-2.6.1.tar

.gz# cd pycrypto-2.6.1

# python setup.py

install

4.安裝pyyaml模組

訪問http://

# tar -zxvf yaml-0.1.7.tar

.gz# cd yaml-0.1.7

# ./configure --prefix=/usr/local

# make --jobs=`grep processor /proc/cpuinfo | wc -l` #設定為多核工作模式

# make

install

訪問https:

//# tar -zxvf pyyaml-3.12.tar

.gz# cd pyyaml-3.12

# python setup.py

install

5.安裝jinja2模組

訪問https://

# tar -zxvf markupsafe-1.0.tar

.gz# cd markupsafe-1.0

# python setup.py

install

訪問https:

//# tar -zxvf jinja2-2.10

.ta.gz

# cd jinja2-2.10

# python setup.py

install

6.安裝paramiko模組

訪問https://

# tar -zxvf ecdsa-0.13.tar

.gz# cd ecdsa-0.13

# python setup.py

install

訪問https:

下paramiko

# tar -zxvf paramiko-2.4.0.tar

.gz# cd paramiko-2.4.0

# python setup.py

install

# tar -zxvf ******json-3.13.2.tar

.gz# cd ******json-3.13.2

# python setup.py

install

# mkdir /etc/ansible

# tar -zxvf ansible-2.3.3.0.tar

.gz# cd ansible-2.3.3.0

# python setup.py

install

# cp -r examples/*

/etc/ansible/

9.配置ansible環境變數

# cat > /etc/profile.d/ansible.sh

<# ansible environment configuratione

export path=$ansible_home/bin:$

eof

測試是否安裝成功

# ansible --version

# ansible-doc -l

注:jenkins建議在tomcat中使用utf-8編碼,配置tomcat下conf目錄的server.xml檔案

如果job的控制台中文輸出亂碼,請將uriencoding=」utf-8」更改為usebodyencodingforuri="true"

mongodb els memcached安全漏洞

elasticsearch漏洞 漏洞 cve 2014 3120 命令執行 cve 2015 3337 目錄穿越 cve 2014 3120 命令執行 啟動 docker compose build docker compose up d cve 2015 3337 目錄穿越 在安裝了具有 site...

pureftp mysql pureftp安裝部署

ftp 檔案傳輸 pure ftpd ftp軟體 作用 通過對映登入傳送和接收檔案。wget 2 解壓包 tar jxvf pure ftpd 1.0.43.tar.bz2 3 進入解壓目錄 cd pure ftpd.4 初始化安裝環境 先建立安裝目錄mkdir usr local pureftpd...

thinkphp nginx phpcgj安裝配置

環境 mysql 5.6.26 nginx 1.9.4.tar.gz php 5.6.13 程式框架thinkphp 客戶要求必須使用nginx php 1.首先安裝nginx mysql php 2.安裝擴充套件php擴充套件 pdo mysql 1 cd usr local src php 5....