As a front-end ER with pursuit, it also aims to free hands, accelerate the pace of automation and promote the continuous integration of projects. Of course, you need to know how to build a persistent integration environment.
Preparing the system Environment
Deploy our Jenkins environment using virtual machines to simulate real server operations
The operating environment
- Computer: MacBook Pro
- System: macOS Mojave 10.14.1
Virtual Machine Environment
- CentOS Linux Release 7.4.1708 (Core)
- The JDK: 1.8.0 comes with
- Jenkins: 2.164.1
Software used
The following software is the one I use, which can be replaced by one with the same function
- Parallels Desktop: Emulator software
- ITerm2: command line tool
- ZSH: shell tool
- Oh My ZSH: ZSH extension
Set up the basic system environment
Install the ZSH
sudo yum install -y zsh
Copy the code
Install git
sudo yum install -y git
Copy the code
Oh – my – ZSH installation
Oh-my-zsh has dependencies on git and ZSH. You need to ensure that both are already installed when installing git.
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
#or
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Copy the code
Installing the Java Environment
Jenkins is strongly dependent on the Java environment, so you must ensure that the Java environment is installed before Jenkins installation.
Query JDK information:
Yum search Java 1.8Copy the code
The JDK installation:
Sudo yum install -y java-1.8.0-openJDK-devel.x86_64Copy the code
Setting environment variables:
The/usr/lib/JVM/Java -- 1.8.0 comes with its - 1.8.0.201. B09-2. El7_6. X86_64 sudo vim/etc/profileCopy the code
Reload the configuration file, which takes effect immediately
source /etc/profile
Copy the code
Test whether the setting is successful:
javac
Copy the code
Install wget
sudo yum install -y wget
Copy the code
Install Jenkins
Importing Resource Sources
#Add the source
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
#Import the secret key
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Copy the code
The installation
Different Jenkins versions depend on different JDK versions, so you need to check before installing Jenkins.
sudo yum install -y jenkins
Copy the code
run
Enabling a Firewall Port
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
sudo firewall-cmd --reload
Copy the code
Run Jenkins
sudo service jenkins start
Copy the code
Jenkins configuration
Open the browser: http://${ip}:8080
View the password :(save the password to the local)
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the code
Choose how to install the plug-in according to your needs, and here I choose the recommended installation.
Creating an Administrator
Example Configuration, do not change, use the recommended address.
The problem
Blank screen Solution: Modify the Jenkins configuration file.
Config file address: /var/lib/jenkins.
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy">
<denyAnonymousReadAccess>true</denyAnonymousReadAccess>
</authorizationStrategy>
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
<disableSignup>true</disableSignup>
<enableCaptcha>false</enableCaptcha>
</securityRealm>
Copy the code
Is amended as:
<authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured">
<denyAnonymousReadAccess>true</denyAnonymousReadAccess>
</authorizationStrategy>
<securityRealm class="hudson.security.SecurityRealm$None">
<disableSignup>true</disableSignup>
<enableCaptcha>false</enableCaptcha>
</securityRealm>
Copy the code
Modified on 29 March 2019
The following processes have been added: front-end ER, Jenkins sustainable integrated Webpack project