环境准备:
一、系统环境:
1、安装centos7.2系统,最小化安装
2、配置网络
[root@harbor tools]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
UUID=80043d12-fa7d-42b2-a3f0-86848283dd97 ethernet eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
DEFROUTE=yes
IPV6INIT=yes
IPV4_FAILURE_FATAL=no
PEERDNS=yes
NAME=eth0
IPADDR=59.47.71.229
NETMASK=255.255.255.0
GATEWAY=59.47.71.1
DNS1=114.114.114.114
DNS2=8.8.8.8
ZONE=trusted
3、关闭防火墙和selinux
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/enforcing/disabled/g' /etc/sysconfig/selinux
4、设置yum源
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install epel-release
yum clean all
yum makecache
5、安装常用软件
yum -y install vim wget lrzsz net-tools git
6、安装JDK
yum install java-1.8.0-openjdk.x86_64 -y
[root@harbor ~]# java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
7、安装jenkins
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
yum install jenkins -y
systemctl start jenkins
systemctl enable jenkins
8、安装maven
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar zxf apache-maven-3.3.9-bin.tar.gz -C /usr/local/
[root@harbor tools]# vi /etc/profile
#path maven
export MAVEN_HOME=/usr/local/apache-maven-3.3.9
export PATH=$PATH:$MAVEN_HOME/bin
[root@harbor tools]# source /etc/profile
[root@harbor tools]# mvn -v
which: no javac in (/root/perl5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/apache-maven-3.3.9/bin)
Warning: JAVA_HOME environment variable is not set.
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /usr/local/apache-maven-3.3.9
Java version: 1.8.0_212, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-862.el7.x86_64", arch: "amd64", family: "unix"
参考: