基于CentOS 6.3的Web服务器基本环境配置
1.静态地址配置
通过修改 /etc/sysconfig/network-scripts/ifcfg-eth0 文件配置静态IP
- DEVICE=eth0 //网卡ID
- BOOTPROTO=static //设置成静态IP
- TYPE=Ethernet //网络类型
- BROADCAST=192.168.1.255 //广播地址
- HWADDR=00:0C:29:49:E2:90 //网卡Mac地址
- IPADDR=192.168.1.201 //IP 地址
- NETMASK=255.255.255.0 //子网掩码
- GATEWAY=192.168.1.1 //网关
- ONBOOT=yes //开机自动开启网卡
通过修改 /etc/resolv.conf 设置DNS
- nameserver 192.168.1.1
重启网络
- service network restart
查看是否生效
- ifconfig
您可以根据自己的网络情况设置相应的IP和DNS
2.修改yum源为163
- cd /etc/yum.repos.d/
- wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
- mv CentOS-Base.repo CentOS-Base.repo.bak
- mv CentOS6-Base-163.repo CentOS-Base.repo
- yum makecache
3.安装中文语言包
- yum groupinstall chinese-support
4.安装Vim
- yum -y install vim
5.增加用户
- useradd frankwong //注:把frankwong改成你要增加的用户名
- passwd frankwong //注:设置密码
6.安装sudo
- yum -y install sudo
- chmod u+w /etc/sudoers
- vim /etc/sudoers
找到这一行:"root ALL=(ALL) ALL"
在下面添加"*** ALL=(ALL) ALL"(这里的***是你的用户名),然后保存
- chmod u-w /etc/sudoers //注:撤销写权限。
7.安装常用基本工具
- yum -y install wget make gcc gcc-c++ bison ncurses-devel
