码迷,mamicode.com
首页 > 其他好文 > 详细

reset69.sh

时间:2018-06-02 12:20:33      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:lis   sshd_conf   ora   format   package   mat   install   chkconfig   figure   

################################
# reset69.sh
################################
# Step1. configure temporary yum repo
mount /dev/sr0 /mnt
rm -f /etc/yum.repos.d/*.repo
cat > /etc/yum.repos.d/base.repo << EOF
[base]
name=CentOS6.9 DVD
baseurl=file:///mnt/
gpgkey=file:///mnt/RPM-GPG-KEY-CentOS-6
EOF
yum clean all
yum repolist

# Step2. install packages
yum install -y vim lrzsz autofs ntp tree

# Step3. configure autofs service (available on startup)
chkconfig autofs on
service autofs start
umount /mnt

# Step4. configure ntpd service (available on startup)
ntpdate 172.20.0.1
cat >> /etc/ntp.conf << EOF
server 172.20.0.1
EOF
chkconfig ntpd on
service ntpd start

# Step5. modefy local yum repo
cat > /etc/yum.repos.d/base.repo << EOF
[base]
name=CentOS6.9 DVD
baseurl=file:///misc/cd/
gpgkey=file:///misc/cd/RPM-GPG-KEY-CentOS-6
EOF
yum clean all
yum repolist

# Step6. configure prompt format
echo "PS1=‘\[\e[1;32m\][\u@\h \W]\\$\[\e[0m\]‘" > /etc/profile.d/env.sh
source /etc/profile.d/env.sh

# Step7. configure localhost name
hname=CentOS69.magedu.com
cat > /etc/sysconfig/network <<EOF
NETWORKING=yes
HOSTNAME=`echo ${hname}`
EOF
cat >> /etc/hosts << EOF
`echo -e "127.0.0.1\t${hname}"`
EOF

# Step8. configure alias
cat >> ~/.bashrc << EOF
alias cdnet="cd /etc/sysconfig/network-scripts/;pwd"
alias vie0="vim /etc/sysconfig/network-scripts/ifcfg-eth0"
alias rn="service network restart;ifconfig eth0|head -n2"
EOF
source ~/.bashrc

# Step9. configure sshd access arguments
sed -r -i ‘s/(GSSAPIAuthentication )yes/\1no/‘ /etc/ssh/sshd_config
sed -i ‘s/#UseDNS yes/UseDNS no/‘ /etc/ssh/sshd_config
service sshd restart

reset69.sh

标签:lis   sshd_conf   ora   format   package   mat   install   chkconfig   figure   

原文地址:https://www.cnblogs.com/GymUManAlvin/p/9125007.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!