#!/bin/bash
PROXY_IP="x.x.x.x"
interface="ens192"
# 配置DNS
nmcli con mod ${interface} ipv4.dns "223.5.5.5"
# 配置代理
export http_proxy="http://${PROXY_IP}:8118"
export https_proxy="http://${PROXY_IP}:8118"
# 配置yum源
mv /etc/yum.repos.d /etc/yum.repos.d_bak
cp -r ./yum.repos.d /etc/
yum clean all;yum makecache
yum update -y
yum install -y git wget vim net-tools bind-utils
# 在线安装docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
mkdir -p /etc/systemd/system/docker.service.d
cat >> /etc/systemd/system/docker.service.d/http-proxy.conf <<EOF
[Service]
Environment="HTTP_PROXY=http://${PROXY_IP}:1080"
EOF
systemctl enable docker && systemctl restart docker