Go to main content

手册页部分 8:系统管理命令

退出打印视图

更新时间: 2018年8月8日 星期三
 
 

sysconfig(8)

名称

sysconfig - 取消配置或重新配置 Solaris 实例

用法概要

/usr/sbin/sysconfig
/usr/sbin/sysconfig configure | reconfigure [
-s]
[-c config_profile.xml | 
dir] [--destructive] [-g 
grouping,grouping]
/usr/sbin/sysconfig unconfigure [-s] [
--destructive]
     [-g grouping,grouping
]
/usr/sbin/sysconfig unconfigure [-s] [
-g system] [--destructive]
     --remove-profiles
/usr/sbin/sysconfig create-profile [-o 
output_file [-l logfile]
     [-v verbosity] [-b] [
-g grouping,grouping]

描述

sysconfig 实用程序是用于取消配置和重新配置 Solaris 实例的界面。Solaris 实例定义为全局区域或非全局区域中的导环境。用户无法取消配置特定的预定义子系统。系统的可配置子系统称为功能分组。功能分组是在执行该实用程序时所配置或取消配置的一个或一组服务。

使用 sysconfig 实用程序可执行三种操作:取消配置、配置和配置文件创建。

使用 unconfigure 子命令调用 sysconfig 时,将取消系统配置并将其置于未配置状态。

系统配置可以采用交互方式或非交互方式执行。如果调用 configure 子命令时未指定配置文件,则会立即取消配置系统,并在控制台中激活交互式界面,该界面可引导用户完成系统配置过程。如果调用 configure 子命令时指定了配置文件,则配置时会读取该配置文件,并采用非交互方式执行配置。以上任一种情况都会导致请求的功能分组建立新配置。

配置与重新配置的含义相同。reconfigure 子命令是 configure 子命令的别名。

sysconfig 命令还可用于生成配置文件,即使用 create-profile 子命令。生成的配置文件可与 sysconfig configure 子命令一起使用,从而以非交互方式配置功能分组。有效的配置文件名称包含 .xml 扩展名。

系统配置可以使用交互式系统配置 (System Configuration Interactive, SCI) 工具以交互方式执行,也可以使用系统配置文件以非交互方式执行。

SCI 工具使用文本用户界面以交互方式配置目标系统。它还可用于收集用户生成的描述目标系统所需配置的信息。然后该工具会生成包含所需系统配置的系统配置文件。

SCI 工具支持对全新安装或未配置的系统进行配置。该工具用于为新创建的非全局区域和在文本安装期间提供系统配置。如果需要使用 SCI 工具对已配置系统的配置进行修改,则必须先取消此系统的配置,然后才能运行 SCI 工具。

sysconfig 除了用于执行系统配置外,还可用于重新配置和取消配置单个功能分组。可以在系统上配置的功能分组包括 networknaming_serviceslocationusersidentitysupportkeyboard。系统分组将配置或取消配置所有功能分组。还可以取消配置分组并将其置于未配置状态。处于未配置状态的分组的缺省值如下所示。

以下分组是可配置的。

Grouping | Components            | Unconfigured Stat
------------------------------------------------------------
identity        | system nodename       | unknown
------------------------------------------------------------
keyboard        | Keyboard              | U.S. English
------------------------------------------------------------
naming_services | DNS, NIS and LDAP     | No network naming
                | clients, nsswitch     | services
------------------------------------------------------------
network         | network               | No network
------------------------------------------------------------
location        | timezone              | UTC
                | locale                | C locale
------------------------------------------------------------
support         | ASR                   | ASR disabled
------------------------------------------------------------
system          | all groupings         | all groupings
                |                       | unconfigured
------------------------------------------------------------
users           | root                  | Empty root password
                | initial user account  | Remove user account
------------------------------------------------------------

sysconfig 实用程序使用 Solaris 管理工具 (Solaris Management Facility, SMF) 将配置信息集中化。系统配置操作生成的数据是对 SMF 系统信息库的管理定制,缺省情况下,该数据存储在 SMF 系统信息库的 sysconfig-profile 层。使用 sysconfig configure -c <dir> 时,通过将配置文件放在 dir: <dir>/enterprise、<dir>/site 和 <dir>/node 中的相应子目录,可以在 enterprise-profilesite-profilenode-profile SMF 层应用各个配置文件。

使用 sysconfig 配置系统时,将删除管理层中存在的屏蔽了 sysconfig 所设置的值的任何值。这仅适用于可以使用交互模式配置的值。

子命令

以下部分介绍了支持的子命令及其关联选项。

unconfigure [–s] [– g grouping] [–-destructive]

取消配置系统,将其置于 unconfigured 状态。

–s

在取消配置完成后关闭系统。

–g grouping

要取消配置的分组。如果未指定 –g,则会取消配置所有分组,从而导致取消配置系统。在取消配置系统前,会要求用户进行确认。

–-destructive

在取消配置时,不保留通常保留的系统数据。通过指定此标志,用户可向所有取消配置的分组指示其通常保留的数据可能会被删除。

unconfigure [–s] [– g system] –-remove-profiles
–-remove-profiles

此选项仅对 unconfigure 子命令有效。

此标志将取消配置系统,并从 enterprise-profilesite-profilenode-profilesysconfig-profileadmin SMF 层中删除配置数据。不会删除由软件包安装的配置文件。这可以有效地将系统返回到安装程序所提供的原始系统配置状态。

此过程将删除存储在 /etc/svc/profile/enterprise/etc/svc/profile/site/etc/svc/profile/node/etc/svc/profile/sysconfig 目录中的任何未打包的配置文件。将删除 admin 层的管理定制。

由于此操作涉及面较大,删除的 XML 配置文件将归档在 /etc/svc/profile/backup 目录下名为 profiles-<timestamp>.tar 的 tar 文件中。

此选项仅对系统分组有效。调用此选项时,可选择使用 –g system

configure|reconfigure [– s] [–g grouping] [–c config_profile.xml | dir] [–-destructive ]

配置或取消配置分组。configure 子命令可以访问与 unconfigure 子命令相同的选项。它还包含以下附加选项。

–c config_profile.xml | dir

提供要在配置期间应用的配置文件或配置文件目录。如果应用配置文件,则以非交互方式执行配置步骤。如果未提供配置文件,则使用交互式系统配置工具来配置分组。

所有配置文件必须具有 .xml 文件扩展名。

如果您为 –c 提供了目录,则该目录中的所有配置文件都必须是有效(格式正确)的配置文件。

create-profile [–o output_file [–l logfile] [–v verbosity] [–b] [–g grouping,...]

运行 SCI 工具并创建系统配置文件。该配置文件的缺省位置为 /system/volatile/profile/sc_profile.xml。生成的配置不会应用于系统。

–o output_directory

将配置文件的缺省位置替换为 output_directory

–l logfile, – -log-location=logfile

日志文件的位置。缺省值为 /var/tmp/install/sysconfig.log

–v verbosity, – -log-level=verbosity

详细程度,值可以是 errorwarninfodebuginput 之一。以上值按详细程度从低到高的顺序排列。缺省值为 info

–b

黑白版本的 SCI 工具。

示例

示例 1 取消配置并关闭

以下命令取消配置系统并将其置于 unconfigured 状态。缺省情况下,如果未指定任何分组,会取消配置整个系统的分组。

# sysconfig unconfigure -s
示例 2 取消配置系统

以下命令取消配置系统并将其置于 unconfigured 状态。

# sysconfig unconfigure -g system
示例 3 使用 SCI 工具重新配置系统

以下命令启动 SCI 工具重新配置系统。

# sysconfig configure
示例 4 使用配置文件重新配置

以下命令使用配置文件重新配置系统。

# sysconfig configure -c some_profile.xml
示例 5 创建和使用配置文件

以下命令序列创建配置文件,然后使用该配置文件重新配置系统。

# sysconfig create-profile -o /tmp/myprofile.xml
# sysconfig configure -g system -c /tmp/myprofile.xml
示例 6 在区域中配置系统

以下命令在区域中配置系统。

# zlogin ZONENAME
root@ZONENAME# sysconfig configure -g system
示例 7 以交互方式配置功能分组

以下命令重新配置网络和命名服务功能分组。将调用 SCI 工具,并以交互方式重新配置分组。

# sysconfig configure -g network,naming_services
示例 8 以非交互方式配置功能分组

以下命令序列为网络和命名服务创建配置文件,然后使用该配置文件以非交互方式重新配置分组。

# sysconfig create-profile -g network,naming_services \ 
       -o /tmp/my_sysconfig_directory/ 
# sysconfig configure -g network,naming_services \ 
       -c /tmp/my_sysconfig_directory/sc_profile.xml
示例 9 取消配置系统和恢复分组

以下命令取消配置系统并将分组恢复到缺省安装状态。

# sysconfigure unconfigure --include-site-profile

退出状态

0

成功。

>0

失败。

属性

有关下列属性的说明,请参见 attributes(7)

属性类型
属性值
可用性
system/core-os
system/install
system/install/configuration
system/library/install
接口稳定性
Committed(已确定)

另请参见

svcprop(1)attributes(7)attributes(7)svcadm(8)svccfg(8)