1. 程式人生 > >centos6系統初始化

centos6系統初始化

prefix yun base prot ethernet style ntpd iyu sys

系統: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系統初始化