系统初始化

一般系统安装好后,按照自己习惯定义

#alias
echo "alias cdyum='cd /etc/yum.repos.d/'" >> /root/.bashrc 
echo "alias cdnet='cd /etc/sysconfig/network-scripts/'" >> /root/.bashrc 
source /root/.bashrc


#set hosts
#interFace=·ifconfig | awk -F: 'NR==1{print $1}'·
#ipAddress=`ip add show $interFace |grep 'inet '|awk -F'[ /]+' '{print $3}'`
ipAddress=`hostname -I`
hostName=`hostname`
echo "$ipAddress   $hostName" >> /etc/hosts
tail -1 /etc/hosts


#ssh dns
grep UseDNS /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS no/UseDNS no/' /etc/ssh/sshd_config
grep UseDNS /etc/ssh/sshd_config


#firewall
iptables -F
iptables -L -n
systemctl stop firewalld
systemctl disable firewalld


#selinux
[ `getenforce` != "Disabled" ] && setenforce 0 &> /dev/null && sed -i s/"^SELINUX=.*$"/"SELINUX=disabled"/g /etc/selinux/config
getenforce
grep SELINUX= /etc/selinux/config


#set yum repo
cat << EOF > /etc/yum.repos.d/rhel.repo
[rhel] 
name=rhel
baseurl=file:///mnt
enabled=1
gpgcheck=0
EOF
mount /dev/cdrom /mnt
yum clean all
yum install vsftpd createrepo bash-completion vim net-tools  lrzsz -y
systemctl start vsftpd;systemctl enable vsftpd

  

  

posted @ 2019-03-31 09:11  Reid21  阅读(237)  评论(0编辑  收藏  举报