#!/bin/bash
#change yum source
#disable selinux
#name=start.sh
echo "========start============="
cd /etc/yum.repos.d/
sed -i s/SELINUX=enforcing/SELINUX=disabled/ /etc/selinux/config
iptables -F
systemctl disable firewalld
systemctl stop firewalld
echo "====chenage colors======"
echo "PS1='\[\e[1;32m\][\u@\h \W ]\$\[\e[0m\]'" >> /root/.bashrc
cat >> /root/.vimrc <<-EOF
set ts=4
set expandtab
set ignorecase
set shiftwidth=4
autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
if expand("%:e") == 'sh'
call setline(1,"#!/bin/bash")
call setline(2,"#")
call setline(3,"#********************************************************************")
call setline(4,"#Author: zzb")
call setline(5,"#QQ: 32586474")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#FileName: ".expand("%"))
call setline(8,"#URL: http://154.9.235.123")
call setline(9,"#Description: The test script")
call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(11,"#********************************************************************")
call setline(12,"")
endif
endfunc
autocmd BufNewFile * normal G
EOF
echo "====dowload nju-repo===="
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirror.nju.edu.cn/centos|g' \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo
echo "====dowload tools========="
yum install -y net-tools vim wget lrzsz bash-com*
echo "====upgrade yum============"
yum clean all
yum makecache
cd ~
echo "=========finish--reboot======="
reboot