Centos minimal 特点:小巧、纯净、安装快、启动快、适合安装服务器作自动部署
下载镜像:http://www.centos.org/
1、修改主机名
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=www
GATEWAY=192.168.3.1
注:NETWORKING 表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络,而且很多系统服务程序将无法启动
2、修改hosts
# vi /etc/hosts
3、修改网卡
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR=......
ONBOOT="yes"
UUID=......
IPADDR=192.168.1.102
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=202.102.192.68
DNS2=8.8.8.8
重启网卡:
# service network restart
或
# /etc/init.d/network restart
重启网卡后会自动更新 /etc/resolv.conf
如果ifcfg-eth0没有配置DNS,需要手动设置DNS
# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
如果是克隆的虚拟机由于mac地址问题需要解决“Device eth0 does not seem to be present, delaying initialization.”。
# sudo rm -fr /etc/udev/rules.d/70-persistent-net.rules
# sudo reboot
# sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 修改网卡中的mac地址(注意大小写与/etc/udev/rules.d/70-persistent-net.rules中mac一致)
# sudo service network restart
4、自动同步时间
查看
# date -R
设置时区
# cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
设置时间
# date -s "2012-08-01 00:00:00"
同步时间
# sudo ntpdate us.pool.ntp.org
# crontab -e
0-59/10 * * * * /usr/sbin/ntpdate us.pool.ntp.org | logger -t NTP
# sudo service crond restart
5、更新系统
# yum update -y
6、安装常用软件和开发库(根据你的需要哦)
yum install gcc gcc-c++ make automake autoconf213 autoconf bison ncurses cmake libtool bison flex perl git subversion mercurial python-setuptools -y
yum install openssl-devel pcre-devel zlib-devel libjpeg-devel libpng-devel freetype-devel ImageMagick-devel boost-devel libevent-devel libuuid-devel readline-devel bzip2-devel libxml2-devel libxslt-devel openssl-devel kernel-devel pcre-devel boost-devel python-devel libpcap-devel sqlite-devel ncurses-devel libaio -y
yum install wget vim lsof tcpdump screen p7zip unrar unzip sudo redhat-lsb ntpdate traceroute -y
7、添加用户
# useradd web
# passwd
# visudo -f /etc/sudoers
在下面一行加上新增的用户,x存!
root ALL=(ALL) ALL
web ALL=(ALL) ALL
测试是否成功,显示root表示成功
# sudo whoami
8、修改CentoOS GRUB 开机预设等待时间
# sudo vim /boot/grub/menu.lst
timeout=5
修改成
timeout=0
9、修复wget刷屏问题
# yum install gettext -y
# msgunfmt /usr/share/locale/zh_CN/LC_MESSAGES/wget.mo -o - |sed 's/eta(英国中部时间)/ETA/'|msgfmt - -o/tmp/zh_CN.mo
# cp /tmp/zh_CN.mo /usr/share/locale/zh_CN/LC_MESSAGES/wget.mo
10、重启系统
# reboot
(完)