CentOS系统配置与数据存储管理指南
立即解锁
发布时间: 2025-08-25 00:10:30 阅读量: 8 订阅数: 9 

# CentOS系统配置与数据存储管理指南
## 1. 服务配置
系统在不同运行级别执行的进程就是系统提供的服务。用户可以使用基于文本和图形的工具来定制在不同运行级别运行的服务。
### 1.1 图形工具
图形工具名为 `system-config-services`,可从命令行或通过 `System Administration Server Services` 调用,弹出服务配置窗口。在窗口左侧选择服务,通过点击相应按钮可启动、停止和重启服务。若要管理特定运行级别运行的服务,可选择 `Edit Runlevel`,从菜单中选择要编辑的运行级别,勾选要在该级别启动的服务对应的复选框,点击 `Save` 保存更改,重启后服务将在相应级别运行。
### 1.2 命令行工具
#### 1.2.1 查看服务及运行级别
使用 `chkconfig --list` 命令可列出服务及其对应的运行级别,示例如下:
```plaintext
[root@server ~]# chkconfig --list
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
NetworkManagerDispatcher 0:off 1:off 2:off 3:off 4:off 5:off 6:off
acpid 0:off 1:off 2:off 3:on 4:on 5:on 6:off
anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off
apmd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
avahi-daemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
avahi-dnsconfd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
bluetooth 0:off 1:off 2:on 3:on 4:on 5:on 6:off
capi 0:off 1:off 2:off 3:off 4:off 5:off 6:off
```
第一列是服务名称,后面是 0 - 6 的运行级别,以空格分隔。若运行级别后为 `:on`,则服务将在该级别运行。运行级别 0 和 6 分别用于关机和重启,不应在这两个级别启动服务。通常,CentOS 只在运行级别 3 和 5 运行。
#### 1.2.2 添加或移除服务
添加服务到特定运行级别,使用命令 `chkconfig --level runlevels servicename on`。例如,要让蓝牙服务在级别 3 和 5 运行,执行 `chkconfig --level 35 bluetooth on`。从特定运行级别移除服务,使用命令 `chkconfig --level runlevels servicename off`,如 `chkconfig --level 35 bluetooth off`。可再次使用 `chkconfig --list` 命令验证设置。
#### 1.2.3 启动、停止或重启服务
通过命令行启动、停止或重启服务,使用 `service` 命令,格式为 `service servicename start|stop|restart`。例如,重启蓝牙服务,执行 `service bluetooth restart`。直接运行 `service servicename` 可查看该命令支持的选项列表,很多服务支持的选项不止启动、停止和重启。
## 2. 键盘设置
更改键盘布局的常见方法有两种:从命令行运行 `system-config-keyboard` 或通过 `System Administration Keyboard` 调用。该命令也可在基于文本的用户界面中使用,配置工具将以文本模式显示。在列表中选择布局并点击 `OK`,键盘设置将立即生效。此外,还可在图形用户界面的 `Keyboard Preferences`、`Keyboard Shortcuts`、`Keyboard Accessibility options` 中找到更多键盘配置设置。
## 3. 语言设置
更改操作系统的整体语言设置,可运行 `system-config-language` 命令或通过 `System Administration Language` 调用。该工具也有文本模式,从列表中选择语言并点击 `OK`,更改将在下次登录时生效。
## 4. 日期和时间设置
使用 `Time/Date Properties` 工具更新系统日期、时间和时区,可通过运行 `dateconfig` 命令或通过 `System Administration Date & Time` 调用。
### 4.1 日期和时间更新
在 `Date & Time` 选项卡中,左列用于更新日期,右列用于更新时间,点击 `OK` 按钮可将更改更新到系统日期和时间。
### 4.2 网络时间协议(NTP)
在 `Network Time Protocol` 选项卡中,勾选 `Enable Network Time Protocol` 选项可允许系统通过 NTP 自动更新日期和时间。默认提供三个时间服务器 `0.centos.pool.ntp.org`、`1.centos.pool.ntp.org` 和 `2.centos.pool.ntp.org`,用户可添加其他网络上可用的时间服务器,使用 `Add`、`Edit` 和 `Delete` 按钮更新时间服务器条目。点击 `Show Advanced Options` 可查看高级 NTP 选项,如 `Synchronize System Clock Before Starting Service` 可在 NTP 服务启动前将系统时间与 NTP 服务器同步,适用于始终连接有线网络的系统;`Use Local Time Source` 可优先使用系统硬件时钟,适用于有精确时钟(如 GPS 无线电)的服务器。
### 4.3 时区设置
`Time Zone` 选项卡用于设置系统的时区,这也是 NTP 确定系统日期和时间所必需的。用户可从世界地图或下拉框中选择城市来更改时区,`System Clock Uses UTC (Universal Time Coordinated)` 选项可在夏令时期间自动更新时间。
## 5. 网络设置
在安装阶段,用户只能配置系统的网卡。若有其他网络连接方式,如使用 ISDN、调制解调器、xDSL、令牌环、CIPE 和无线设备,可通过 `System Administration Network` 调用网络配置
0
0
复制全文
相关推荐










