Centos7 初始化

systemctl disable firewalld
sed -ri '/^[^#]*SELINUX=/s#=.+$#=disabled#' /etc/selinux/config
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup/
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y wget telnet vim sysstat lrzsz lsof zip unzip bash-completion ntp
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
cp /usr/share/bash-completion/completions/docker /etc/bash_completion.d/
echo "set paste" >> /etc/vimrc
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config 
sed -i 's#\#Port 22#port 22201#g' /etc/ssh/sshd_config
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/g'  /etc/ssh/sshd_config
useradd centos
echo centos:Lcsmy123 | chpasswd
cat<<EOF > /etc/sysctl.d/docker.conf
# 要求iptables不对bridge的数据进行处理
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 1
EOF

sysctl --system

cat<<EOF>> /etc/security/limits.conf
root soft nofile 65535
root hard nofile 65535
EOF

cat<<EOF>> /etc/rc.local
ulimit -SHn 65535 
EOF

chmod +x /etc/rc.d/rc.local

reboot

猜你喜欢

转载自www.cnblogs.com/fsckzy/p/10830960.html