> CentOS > CentOS入门 >

CentOS 安装后基本配置

1.网络配置

(1)命令配置

# ifconfig eth0 192.168.0.2 netmask 255.255.255.0   //ip地址、子网掩码

# route add default gw 192.168.0.1 dev eth0   //网关

# hostname centos   //计算机名

(2)文件配置

<1>修改IP地址

修改对应网卡的IP地址的配置文件

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0 (描述网卡对应的设备别名,例如 ifcfg-eth0的文件中它为 eth0)

BOOTPROTO=static (设置网卡获得 ip地址的方式,可能的选项为static,dhcp或 bootp,分别对 应静态指定的 ip地址,通过 dhcp协议获得的 ip地址,通过 bootp协议获得的 ip地址)

BROADCAST=192.168.0.255 (对应的子网广播地址)

HWADDR=00:07:E9:05:E8:B4  (对应的网卡物理地址)

IPADDR=12.168.1.2 (如果设置网卡获得 ip地址的方式为静态指定,此字段就指定了网卡对应的 ip 地址)

IPV6INIT=no  (开启或关闭 IPv6;关闭 no,开启 yes)

IPV6_AUTOCONF=no  (开启或关闭 IPv6自动配置;关闭 no,开启 yes)

NETMASK=255.255.255.0 (网卡对应的网络掩码)

NETWORK=192.168.1.0 (网卡对应的网络地址)

ONBOOT=yes (系统启动时是否设置此网络接口,设置为 yes时,系统启动时激活此设备)

<2>修改网关

修改对应网卡的网关的配置文件

# vi /etc/sysconfig/network

NETWORKING=yes (表示系统是否使用网络,一般设置为 yes。如果设为no,则不能使用网络, 而且很多系统服务程序将无法启动 )

HOSTNAME=centos (设置本机的主机名,这里设置的主机名要和 /etc/hosts中设置的主机名对应 )

GATEWAY=192.168.1.1 (设置本机连接的网关的 IP地址。例如,网关为 10.0.0.2)

<3>修改DNS

修改对应网卡的DNS的配置文件

# vi /etc/resolv.conf

nameserver 202.101.224.68 (域名服务器 )

nameserver 202.101.224.69 (域名服务器 )

<4>重新启动网络配置

# service network restart

# /etc/init.d/network restart

 

2.软件源配置

国内速度较快的常用更新源如下:

http://mirrors.163.com/centos/ 163-网易

http://mirrors.ta139.com/centos/中国移动通信(山东移动)

http://centos.ustc.edu.cn/centos/中国科学技术大学

http://mirror.neu.edu.cn/centos/东北大学

编辑 yum配置文件:

#vi /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
http://mirrors.ta139.com/centos/$releasever/os/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
http://mirror.neu.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
http://mirrors.ta139.com/centos/$releasever/updates/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
http://mirror.neu.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
http://mirrors.ta139.com/centos/$releasever/addons/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
http://mirror.neu.edu.cn/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
http://mirrors.ta139.com/centos/$releasever/extras/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
http://mirror.neu.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
http://mirrors.ta139.com/centos/$releasever/centosplus/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
http://mirror.neu.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
http://mirrors.ta139.com/centos/$releasever/contrib/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/
http://mirror.neu.edu.cn/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

然后使用如下命令更新到最新系统:

#rpm –import /etc/pki/rpm-gpg-key*

#yum upgrade

3.安装语言包

从安装盘进行安装,找到对应 rpm包:

fonts-chinese-3.02-9.6.el5.noarch.rpm

fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm

可以通过 yum进行安装,安装办法为:

#yum groupinstall <language>-support

在上面的命令中, <language>是下列之一 : assamese, bengali, chinese, gujarati, hindi, japanese, kannada, korean, malayalam, marathi, oriya, punjabi, sinhala, tamil, thai,或 telegu。

4、解压缩软件

#yum install unrar unzip p7zip-full

5、中文输入法

#yum install Fcitx SCIM Sunpinyin

(责任编辑:IT)