#!/bin/bash
path=$(pwd)
binPath=${path}/bin

echo "替换yum源"
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak
curl -o /etc/yum.repos.d/CentosBase.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all
yum makecache

cd ${binPath}

echo "安装sshd"
yum install openssh-server -y

echo "修改sshd配置开放22端口"
sed -i "s/#Port 22/Port 22/g" /etc/ssh/sshd_config
sed -i "s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g" /etc/ssh/sshd_config
sed -i "s/#ListenAddress ::/ListenAddress ::/g" /etc/ssh/sshd_config

echo "安装service服务"
yum install initscripts -y

echo "开启ssh服务"
service sshd start

echo "检查服务是否开启"
ps -e | grep sshd

# yum安装ssh客户端
yum -y install openssh-clients

echo "安装net-tools"
yum install net-tools -y

echo "安装wget"
yum install wget -y

echo "安装gcc环境"
yum -y install gcc gcc-c++ kernel-devel
yum -y install automake autoconf libtool make



