Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CI/CD operation manual in traditional cloud environment (5) configuring jenkins

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Installation Configuration Jenkins

cd /usr/local/src/

tar xvf jdk-7u79-linux-x64.tar.gz

ln -sv /usr/local/src/jdk1.7.0_79 /usr/local/jdk

vim /etc/profile

export JAVA_HOME=/usr/local/jdk

export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

export CLASSPATH=.$ CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar

source /etc/profile && java -version

yum -y install jenkins-2.138.4-1.1.noarch.rpm

vim /etc/sysconfig/jenkins

JENKINS_HOME="/var/lib/jenkins" #Default installation path

JENKINS_USER="root" #Startup user, default is jenkins

JENKINS_PORT="8080" #Start Port

systemctl restart jenkins

chkconfig jenkins on

tail -f /var/log/jenkins/jenkins.log

The first time you log in, you'll be prompted for the location of your initial password.

cat /var/lib/jenkins/secrets/initialAdminPassword

Plugins installed in/var/lib/jenkins/plugins

Secret-free code pulling from gitlab

yum -y install git

ssh-keygen

cat /root/.ssh/id_rsa.pub #root

Configure the pub-key generated above on gitlab:

Click projects---your projects---projects name---gear icon settings

---repository---Deploy Keys---Enter key value---Click Write access allowed

Other projects also use the same key, but manually enable it in the Deploy Keys interface.

Then test the password-free pull code

git clone git@192.168.1.14: group1/project1.git #(yes is required for the first pull)

Configure private key credentials to implement source code management

cat /root/.ssh/id_rsa #root private key

jenkins---Credentials---System---Global Credentials---Add Credentials---Type SSH username with private key--username: root---Add Private Key above

test

New jenkins Pipeline Project---Source Code Management Git---Repository URL: git@192.168.1.14: group1/project1.git--Credentials: root---Build Now

Password-free scp files to tomcat

ssh-copy-id root@192.168.1.17

ssh-copy-id root@192.168.1.18

ssh 192.168.1.17

ssh 192.168.1.18

rm -rf project1

git clone git@192.168.1.14:group1/project1.git

scp project1/ root@192.168.1.17:/data/tomcat/webapps/web01/

scp project1/ root@192.168.1.18:/data/tomcat/webapps/web01/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report