配置基础环境.md 843 B

#!/bin/bash
set -e

# 关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
# 配置yum源
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all 
yum makecache
# 配置时间同步
yum install ntp -y
systemctl enable ntpd && systemctl start ntpd
timedatectl set-timezone Asia/Shanghai

# 安装必要软件
yum install git vim -y

# 安装java
yum -y remove *java*
yum install -y java-1.8.0-openjdk*

# 安装maven
yum install maven
sed -i '/<mirrors>/,/<\/mirrors>/c\
  <mirrors>\
    <mirror>\
      <id>alimaven</id>\
      <url>https://maven.aliyun.com/repository/public</url>\
      <mirrorOf>central</mirrorOf>\
    </mirror>\
  </mirrors>
' /etc/maven/settings.xml