CentOS 5系统管理
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

2.3 安装后的基本配置

内容提要

1.用Setup Agent配置防火墙。

2.使用国内镜像更新源更新系统。

3.用yum安装必要的软件包。

2.3.1 运行SetupAgent

当安装系统结束,取出安装DVD,重新启动系统,首先进入如图2-28所示的GRUB界面。

图2-28 GRUB启动界面

引导Linux系统后,经过一系列的启动过程,将运行如图2-29所示的Setup Agent界面。

配置防火墙

在Setup Agent界面中选择“Firewall Configuration”,然后单击“Run Tool”,进入图2-30所示的配置界面。

图2-29 Setup Agent

图2-30 配置防火墙

选择禁用防火墙和selinux,然后单击“OK”。

提示:1.通常用户会使用自己的防火墙,所以需要禁用系统的防火墙

2.本书不涉及selinux的内容。

添加一个普通用户账号

使用如下命令添加一个普通用户账号,并为其设置口令:

        #  useradd osmond
        #  passwd osmond
        Changing password for user osmond.
        New UNIX password:
        Retype new UNIX password:
        passwd: all authentication tokens updated successfully.
        #

2.3.2 使用更新源的国内镜像

当CentOS安装完毕,首先应该修改更新源,并升级到最新的系统。

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

● http://mirror.be10.com/centos/

● http://centos.candishosting.com.cn/

● http://ftp.sjtu.edu.cn/centos/

● http://ftp.hostrino.com/pub/centos/

● http://mirrors.ta139.com/centos/

● http://ftp.iasi.roedu.net/mirrors/centos.org/centos/

首先,编辑yum的配置文件。

        #  vi /etc/yum.repos.d/CentOS-Base.repo
        [base]
        name=CentOS-$releasever -Base
        #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearc
  h&repo=os
        #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
        baseurl=http://centos.candishosting.com.cn/$releasever/os/$basearch/
        http://mirrors.ta139.com/centos/$releasever/os/$basearch/
        http://mirror.be10.com/centos/$releasever/os/$basearch/
        http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/
        http://ftp.hostrino.com/pub/centos/$releasever/os/$basearch/
        gpgcheck=1
        gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
        #released updates
        [updates]
        name=CentOS-$releasever -Updates
        #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearc
  h&repo=updates
        #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
        baseurl=http://centos.candishosting.com.cn/$releasever/updates/$basearch/
        http://mirrors.ta139.com/centos/$releasever/updates/$basearch/
        http://mirror.be10.com/centos/$releasever/updates/$basearch/
        http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/
        http://ftp.hostrino.com/pub/centos/$releasever/updates/$basearch/
        gpgcheck=1
        gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
        #packages used/produced in the build but not released
        [addons]
        name=CentOS-$releasever -Addons
        #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearc
  h&repo=addons
        #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
        baseurl=http://centos.candishosting.com.cn/$releasever/addons/$basearch/
        http://mirrors.ta139.com/centos/$releasever/addons/$basearch/
        http://mirror.be10.com/centos/$releasever/addons/$basearch/
        http://ftp.sjtu.edu.cn/centos/$releasever/addons/$basearch/
        http://ftp.hostrino.com/pub/centos/$releasever/addons/$basearch/
        gpgcheck=1
        gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
        #additional packages that may be useful
        [extras]
        name=CentOS-$releasever -Extras
        #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearc
  h&repo=extras
        #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
        baseurl=http://centos.candishosting.com.cn/$releasever/extras/$basearch/
        http://mirrors.ta139.com/centos/$releasever/extras/$basearch/
        http://mirror.be10.com/centos/$releasever/extras/$basearch/
        http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/
        http://ftp.hostrino.com/pub/centos/$releasever/extras/$basearch/
        gpgcheck=1
        gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
        #additional packages that extend functionality of existing packages
        [centosplus]
        name=CentOS-$releasever -Plus
        #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearc
    h&repo=centosplus
        #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
        baseurl=http://centos.candishosting.com.cn/$releasever/centosplus/$basearch/
        http://mirrors.ta139.com/centos/$releasever/centosplus/$basearch/
        http://mirror.be10.com/centos/$releasever/centosplus/$basearch/
        http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/
        http://ftp.hostrino.com/pub/centos/$releasever/centosplus/$basearch/
        gpgcheck=1
        enabled=0
        gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
        #contrib -packages by Centos Users
        [contrib]
        name=CentOS-$releasever -Contrib
        #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearc
    h&repo=contrib
        #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
        baseurl=http://centos.candishosting.com.cn/$releasever/contrib/$basearch/
        http://mirrors.ta139.com/centos/$releasever/contrib/$basearch/
        http://mirror.be10.com/centos/$releasever/contrib/$basearch/
        http://ftp.sjtu.edu.cn/centos/$releasever/contrib/$basearch/
        http://ftp.hostrino.com/pub/centos/$releasever/contrib/$basearch/
        gpgcheck=1
        enabled=0
        gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

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

        #  rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
        #  yum upgrade

2.3.3 安装必要的软件包

安装必要的软件工具:

        #  yum install wget bzip2 unzip zip nmap tree lynx fileutils ncftp lftp

若需要在本机编译源代码的软件,请安装开发工具组的软件包

        #  yum groupinstall "Development Tools"

有关yum的用法的详细介绍请参见6.2节。