Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-02 20:58:42 10月03日 Update

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/

Tags: Credentials configuration password code location source code user first time project test management input global icon manual plug-in file pipeline pipeline interface Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MySQL Linux MariaDB Shulou Technology