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

centos6系统初始化

时间:2018-07-22 11:12:26      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:sysstat   name   otp   6.2   关闭   eof   ifcfg   code   bsp   

系统:centos6

作用:配置ip、yum源、ntp、关闭selinux、iptables

#!/bin/bash
# configure network
cat >/etc/sysconfig/network-scripts/ifcfg-eth0<<EOF
DEVICE=eth0
NAME="eth0"
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.126.10
PREFIX=24
GATEWAY=192.168.126.2
DNS1=114.114.114.114
EOF

# configure yum
[ -e /yum ]|| mkdir /yum
[ -e /dev/cdrom ]&& mount /dev/cdrom /yum
echo "/dev/cdrom              /yum                    iso9660 defaults        0 0" >>/etc/fstab
mkdir /etc/yum.repos.d/bak 
mv /etc/yum.repos.d/Cen* /etc/yum.repos.d/bak/
cat > /etc/yum.repos.d/local.repo <<EOF
[local]
name=local
baseurl=file:///yum
enabled=1
gpgcheck=0
EOF

yum clean all
yum makecache
yum -y install lsof wget sysstat vim lftp man ntp xorg-x11-xauth

# configure ssh
sed -i s/^GSSAPIAuthentication yes/GSSAPIAuthentication no/ /etc/ssh/sshd_config
sed -i /UseDNS/c\UseDNS no /etc/ssh/sshd_config

# configure iptables selinux
sed -i /^SELINUX=/c\SELINUX=disabled /etc/selinux/config
chkconfig iptables off
chkconfig ip6tables off

# configure ntp
sed -i s/^server/#server/ /etc/ntp.conf
echo "server time1.aliyun.com iburst" >> /etc/ntp.conf
echo "server time2.aliyun.com iburst" >> /etc/ntp.conf
chkconfig ntpd on

reboot

 

centos6系统初始化

标签:sysstat   name   otp   6.2   关闭   eof   ifcfg   code   bsp   

原文地址:https://www.cnblogs.com/fcing/p/9349082.html

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