[root@centos7 ~]# history 1 yum install -y wget 2 cp /etc/yum.repos.d/CentOS-Base.repo{,.bak} 3 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 4 sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo 5 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 6 yum repolist 7 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 8 setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config 9 systemctl stop firewalld && systemctl disable firewalld 10 yum install -y iptables-services 11 iptables -F && service iptables save 12 systemctl list-unit-files --type=service|grep 'enabled' 13 systemctl stop NetworkManager postfix && systemctl disable NetworkManager postfix 14 echo "unset MAILCHECK" >> /etc/profile && source /etc/profile 15 yum install -y ntp 16 systemctl start ntpd && systemctl enable ntpd 17 crontab -e

update time

*/5 * * * * systemctl restart ntpd;/usr/sbin/ntpdate time.nist.gov >/dev/null 2>&1

clean cache

  • /1 * * * yum clean all && rm -rf /var/cache/yum/ >/dev/null 2>&1 18 yum install -y vim lrzsz tree lsof tcpdump screen man unzip ansible 19 yum install -y bash-completion fping gcc-c++ deltarpm net-tools java-11-openjdk 20 rpm -ivh http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64//iksemel-1.4-6.sdl7.x86_64.rpm 21 vim ~/.bashrc PS1="[\e[32;40m][\u@\h \w]\$ [\e[0m]" 22 source ~/.bashrc 23 vim /etc/ssh/sshd_config UseDNS no GSSAPIAuthentication no 24 vim /etc/ssh/ssh_config 25 systemctl restart sshd 26 yum install -y git 27 git config --global user.name "niuyx";git config --global user.email "niuyx@niuyx.cc" 28 yum install -y yum-utils device-mapper-persistent-data lvm2 29 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 30 yum install -y docker-ce 31 curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io 32 vim /etc/docker/daemon.json {"registry-mirrors": ["https://d15trfat.mirror.aliyuncs.com"]} 33 systemctl daemon-reload 34 systemctl start docker && systemctl enable docker 35 vim /etc/sysctl.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 36 sysctl -p 37 docker info 38 vim ~/c7_modify_net.sh 39 chmod 700 ~/c7_modify_net.sh 40 history

#!/bin/bash ##Configure Network ##by Yunzhi.

echo "Getting Started!"

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-ens33 DEVICE=ens33 NAME=ens33 TYPE=Ethernet ONBOOT=yes BOOTPROTO=static IPADDR=10.100.1.x PREFIX=24 GATEWAY=10.100.1.254 DNS1=10.100.1.254 DNS2=223.5.5.5 EOF

read -p "Define your IP addrs:" ip declare -i ip if [[ $ip -le 1 || $ip -ge 254 ]];then echo "It's a wrong number." exit 1 else sed -i "s/IPADDR=10.100.1.x/IPADDR=10.100.1.$ip/g"
/etc/sysconfig/network-scripts/ifcfg-ens33 fi

read -p "Define your hostname:" h hostnamectl set-hostname $h

sleep 1 echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" echo "| Configuration Complete and Restart System |" echo "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+" sleep 1

unlink $0 /usr/sbin/reboot