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

Build the server of jenkins+ansible on centos7

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

Share

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

Premise: install tomcat first. Please refer to the previous blog post about installing tomcat on centos7.

Http://12395331.blog.51cto.com/12385331/1884980

Install jenkins

1 > download the jenkins package.

Go to the tomcat/webapps/ directory and download the jenkins.war package here. If you have any problems with the download, you can download and upload it to this directory by yourself. During the deployment process, you can download it for half a day and provide an attachment to jenkins.

Wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war

2 > Jekins environment variable settings

[root@localhost bin] sudo vi / etc/profile export JENKINS_HOME=/data/program/tomcat/webapps/Jenkins [root@localhost bin]. / etc/profile # to make the configuration file effective

3 > modify the default port number of tomcat

Vi / usr/local/apache-tomcat/conf/server.xml

Modify the port in the following section to a port other than 8080. Here, change it to 8081. There is another condition: when you modified the rule file of iptables, port 8081 was already opened. If not, please modify it again and restart the service of iptables.

4 > restart tomcat and go to the bin directory under the installation directory of tomcat

[root@localhost bin]. / startup.sh

Tomcat unzips the war package, generates a jenkins folder, and generates a .Jenkins folder under the root directory

5 > Jenkins verification. In the browser, enter the URL: http://localhost:8081/jenkins

6 > enter the password. If you want to enter your password to enter jenkins for the first time

Password location: / root/.jenkins/secrets/initialAdminPassword, if you can't find this file, find. -name Jenkins

7 > install the required plug-ins

When you enter it for the first time, the default plug-in installation is not successful, and the plug-in management list is empty. Click CheckNow under advanced to output the list of available and try several times. In addition to the basic installed plug-ins, the main installed plug-ins are: git, git Client, gitlab hook, ansible, etc.

Install ansible

Prerequisite: to install ansible system, you must install python version 2.7 or above.

1 > Ansible is part of the Extra Packages for Enterprise Linux (EPEL) library, so install EPEL first

[root@localhost ~] yum install epel-release

2 > install ansible directly. Currently, the default installation version is 2.2, and the official update is ongoing.

[root@localhost ~] yum install ansible

3 > to support windows client, install the following package: install the Python Winrm module

Pip install "pywinrm > = 0.1.1"

4 > the underlying communication is based on PowerShell, and the management machine and remote host are based on Kerbero authentication. Additional installation of python-kerbero and MIT krb5 dependent libraries is required.

Step 1. Install python-kerberos dependencies with the following command:

Yum-y install python-devel krb5-devel krb5-libs krb5-workstation

Step 2. Install both python-kerberos,OSX and Linux distributions by default, with the following installation commands:

Pip install Kerberos

Problems encountered and solutions:

1. Port conflict, the port of tomcat was changed to 8081. Port 8080 is the internal port that comes with jenkins, which is the purpose of changing 8081 in the above steps.

2. After tomcat service starts, the page loads abnormally. Solution: systemctl start tomcat.service startup does not work. Go to / usr/local/tomcat/bin,./startup.sh and start tomcat to solve the problem.

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

Internet Technology

Wechat

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

12
Report