Ubuntu system Jenkins + nodejs + webPack front-end automated deployment

First, prepare the environment (java, maven, nodejs, webpack )
environment short skip what is missing part dependent on what is apt
[root @ 13 ~] # tar zxvf jdk-8u91-linux-x64.tar.gz -C / opt /

[Root @ 13 ~] # tar xvf apache-maven-3.5.0-bin.tar.gz -C / opt /

[root@13 ~]#wget http://cdn.npm.taobao.org/dist/node/v10.15.1/node-v10.15.1-linux-x64.tar.xz

[root@13 ~]# tar xvf node-v10.15.1-linux-x64.tar.xz -C /opt/

[root@13 ~]# mv /opt/node-v10.15.1-linux-x64 /opt/nodejs


Configuration environment variable / etc / profile

[root@13 ~]# vi /etc/profile

Add the following configuration at the end of

#set java environment

JAVA_HOME=/opt/jdk1.8.0_91

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

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME CLASSPATH PATH

#set maven environment

MAVEN_HOME=/opt/apache-maven-3.5.0

export MAVEN_HOME

export PATH=${PATH}:${MAVEN_HOME}/bin

export NODE_HOME=/opt/nodejs

export PATH=$PATH:$NODE_HOME/bin

export NODE_PATH=$NODE_HOME/lib/node_modules

[root@13 ~]# source /etc/profile


[root@13 ~]# ln -s /opt/nodejs/bin/npm /usr/bin/

[root@13 ~]# ln -s /opt/nodejs/bin/node /usr/bin/

[root@13 ~]# ln -s /opt/nodejs/bin/webpack /usr/bin/

By npm install webpack

[root@13 ~]# npm install webpack -g

[root@13 ~]# npm install vue-cli -g

[root@13 ~]# npm install webpack-cli -g

[root@13 ~]# npm install -g concurrently

[root@13 ~]# npm install -g lite-server

[root @ 13 ~] # npm install -g typescript
Ubuntu system Jenkins + nodejs + webPack front-end automated deployment
Second, the installation Jenkins

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

The Jenkins daemon is started started. Check /etc/init.d/jenkinsfor more details

Creating a 'jenkins' user to run this service

Directly to the console log output to a file /var/log/jenkins/jenkins.log. If you are Jenkins solve the problem, please check this document

/ Etc / default / jenkins` to start filling configuration parameters, e.g. JENKINS_HOME

Jenkins will be set to listen on port 8080. Use a browser to access this port to begin the configuration

If your /etc/init.d/jenkinsfile can not start Jenkins, edit /etc/default/jenkins, modify ---- HTTP_PORT = 8080 ---- 为----HTTP_PORT=8081----Here, "8081" can be replaced with other available ports.
# Other environmental installation jenkins Please refer to the official documentation: https://jenkins.io/zh/doc/book/installing/
installed on the server, including how to use direct Tell me what network usage here not as the focus

Third, install the plug-
click system management
Ubuntu system Jenkins + nodejs + webPack front-end automated deployment
add NodeJS Git & SVN
Ubuntu system Jenkins + nodejs + webPack front-end automated deployment
configure global variables (can be configured according to their own installation path, careful not to check automatically installed)
Ubuntu system Jenkins + nodejs + webPack front-end automated deployment
to build the project
Ubuntu system Jenkins + nodejs + webPack front-end automated deployment
to fill npm run build and so packaged and deployed command
Ubuntu system Jenkins + nodejs + webPack front-end automated deployment

Guess you like

Origin blog.51cto.com/13120271/2413098
Recommended