此内容没有您所选择的语言版本。

B.3. Red Hat Network Configuration Manager


Unlike the Red Hat Network Configuration Client, the Red Hat Network Configuration Manager (rhncfg-manager) is designed to maintain RHN's central repository of config files and channels, not those located on client systems. This tool offers a command line alternative to the configuration management features within the RHN website, as well as the ability to script some or all of the related maintenance.
It is intended for use by Config Administrators and requires an RHN username and password that has the appropriate permission set. The username may be specified in /etc/sysconfig/rhn/rhncfg-manager.conf or in the [rhncfg-manager] section of ~/.rhncfgrc.
When the Red Hat Network Configuration Manager is run as root, it attempts to pull in needed configuration values from the Red Hat Update Agent. When run as a user other than root, you may have to make configuration changes within the ~/.rhncfgrc file. The session file is cached in ~/.rhncfg-manager-session to prevent logging in for every command.
The default timeout for the Red Hat Network Configuration Manager is 30 minutes. To alter this, add the server.session_lifetime option and new value to the /etc/rhn/rhn.conf file on the server running the manager, like so:
 server.session_lifetime = 120 
Copy to Clipboard Toggle word wrap
The Red Hat Network Configuration Manager offers these primary modes: add, create-channel, diff, diff-revisions, download-channel, get, list, list-channels, remove, remove-channel, revisions, update, and upload-channel.
Each mode offers its own set of options, which can be seen by issuing the following command:
 rhncfg-manager mode --help  rhncfg-manager mode --help  rhncfg-manager mode --help 
Copy to Clipboard Toggle word wrap
Replace mode with the name of the mode to be inspected:
rhncfg-manager diff-revisions --help
Copy to Clipboard Toggle word wrap
You can see such a list of options for the add mode at Table B.4, “rhncfg-manager add options”.

B.3.1. Creating a Config Channel

To create a config channel for your organization, issue the command:
 rhncfg-manager create-channel channel-label rhncfg-manager create-channel channel-label
Copy to Clipboard Toggle word wrap
If prompted for your RHN username and password, provide them. The output resembles the following:
 Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created  Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created  Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created  Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created  Red Hat Network username: rhn-user Password: Creating config channel channel-label Config channel channel-label created 
Copy to Clipboard Toggle word wrap
Once you have created a config channel, use the remaining modes listed above to populate and maintain that channel.

B.3.2. Adding Files to a Config Channel

To add a file to a config channel, specify the channel label as well as the local file to be uploaded, such as:
 rhncfg-manager add --channel=channel-label /path/to/file rhncfg-manager add --channel=channel-label /path/to/file rhncfg-manager add --channel=channel-label /path/to/file rhncfg-manager add --channel=channel-label /path/to/file
Copy to Clipboard Toggle word wrap
In addition to the required channel label and the path to the file, you may use the available options for modifying the file during its addition. For instance, you may alter the path and file name by including the --dest-file option in the command, like:
 rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file rhncfg-manager add --channel=channel-label--dest-file=/new/path/to/file.txt/path/to/file
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Pushing to channel example-channel Local file >/path/to/file -> remote file /new/path/to/file.txt 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager add:
Expand
Table B.4. rhncfg-manager add options
Option Description
-cCHANNEL --channel=CHANNEL Upload files in this config channel
-dDEST_FILE --dest-file=DEST_FILE Upload the file as this path
--delim-start=DELIM_START Start delimiter for variable interpolation
--delim-end=DELIM_END End delimiter for variable interpolation
-h, --help show help message and exit

Note

By default, the maximum file size for confiugration files is 128KB. If you need to change that value, find or create the following line in the /etc/rhn/rhn.conf file:
web.maximum_config_file_size=128
Copy to Clipboard Toggle word wrap
Change the value from 128 to whatever limit you want in bytes.

B.3.3. Differentiating between Latest Config Files

To view the differences between the config files on disk and the latest revisions in a channel, issue the command:
 rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file rhncfg-manager diff --channel=channel-label --dest-file=/path/to/file.txt \ /local/path/to/file
Copy to Clipboard Toggle word wrap
You should see output resembling:
 /tmp/dest_path/example-config.txt /home/test/blah/hello_world.txt --- /tmp/dest_path/example-config.txt config_channel: example-channel revision: 1 +++ /home/test/blah/hello_world.txt 2003-12-14 19:08:59.000000000 -0500 @@ -1 +1 @@ -foo +hello, world 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager diff:
Expand
Table B.5. rhncfg-manager diff options
Option Description
-cCHANNEL, --channel=CHANNEL Get file(s) from this config channel
-rREVISION, --revision=REVISION Use this revision
-dDEST_FILE, --dest-file=DEST_FILE Upload the file as this path
-tTOPDIR, --topdir=TOPDIR Make all files relative to this string
-h, --help Show help message and exit

B.3.4. Differentiating between Various Versions

To compare different versions of a file across channels and revisions, use the -r flag to indicate which revision of the file should be compared and the -n flag to identify the two channels to be checked. Refer to Section B.3.11, “Determining the Number of File Revisions” for related instructions. Specify only one file name here, since you are comparing the file against another version of itself. For example:
 rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt rhncfg-manager diff-revisions -n=channel-label1-r=1-n=channel-label2-r=1/path/to/file.txt
Copy to Clipboard Toggle word wrap
The output resembles the following:
 --- /tmp/dest_path/example-config.txt 2004-01-13 14:36:41 \ config channel: example-channel2 revision: 1 --- /tmp/dest_path/example-config.txt 2004-01-13 14:42:42 \ config channel: example-channel3 revision: 1 @@ -1 +1,20 @@ -foo +blaaaaaaaaaaaaaaah +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.0.6 (GNU/Linux) +Comment: For info see http://www.gnupg.org + +iD8DBQA9ZY6vse4XmfJPGwgRAsHcAJ9ud9dabUcdscdcqB8AZP7e0Fua0NmKsdhQCeOWHX +VsDTfen2NWdwwPaTM+S+Cow= +=Ltp2 +-----END PGP SIGNATURE----- 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager diff-revisions:
Expand
Table B.6. rhncfg-manager diff-revisions options
Option Description
-cCHANNEL, --channel=CHANNEL Use this config channel
-rREVISION, --revision=REVISION Use this revision
-h, --help Show help message and exit

B.3.5. Downloading All Files in a Channel

To download all the files in a channel to disk, create a directory and issue the following command:
	 rhncfg-manager download-channel channel-label --topdir .  rhncfg-manager download-channel channel-label --topdir .  rhncfg-manager download-channel channel-label --topdir . 
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Copying /tmp/dest_path/example-config.txt -> \ blah2/tmp/dest_path/example-config.txt 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager download-channel:
Expand
Table B.7. rhncfg-manager download-channel options
Option Description
-tTOPDIR, --topdir=TOPDIR Directory all the file paths are relative to. This option must be set.
-h, --help Show help message and exit

B.3.6. Getting the Contents of a File

To direct the contents of a particular file to stdout, issue the command:
 rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt  rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt  rhncfg-manager get --channel=channel-label \ /tmp/dest_path/example-config.txt 
Copy to Clipboard Toggle word wrap
You should see the contents of the file as output.

B.3.7. Listing All Files in a Channel

To list all the files in a channel, issue the command:
 rhncfg-manager list channel-label rhncfg-manager list channel-label
Copy to Clipboard Toggle word wrap
You should see output resembling:
 Files in config channel `example-channel3': /tmp/dest_path/example-config.txt 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager get:
Expand
Table B.8. rhncfg-manager get options
Option Description
-cCHANNEL, --channel=CHANNEL Get file(s) from this config channel
-tTOPDIR, --topdir=TOPDIR Make all files relative to this string
-rREVISION, --revision=REVISION Get this file revision
-h, --help Show help message and exit

B.3.8. Listing All Config Channels

To list all of your organization's configuration channels, issue the command:
 rhncfg-manager list-channels 
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Available config channels: example-channel example-channel2 example-channel3 config-channel-14 config-channel-17 
Copy to Clipboard Toggle word wrap
Note that this does not list local_override or server_import channels.

B.3.9. Removing a File from a Channel

To remove a file from a channel, issue the command:
 rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt rhncfg-manager remove --channel=channel-label /tmp/dest_path/example-config.txt
Copy to Clipboard Toggle word wrap
If prompted for your RHN username and password, provide them. You should see output resembling:
 Red Hat Network username: rhn-user Password: Removing from config channel example-channel3 /tmp/dest_path/example-config.txt removed 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager remove:
Expand
Table B.9. rhncfg-manager remove options
Option Description
-cCHANNEL, --channel=CHANNEL Remove files from this config channel
-tTOPDIR, --topdir=TOPDIR Make all files relative to this string
-h, --help Show help message and exit

B.3.10. Deleting a Config Channel

To destroy a config channel in your organization, issue the command:
rhncfg-manager remove-channel channel-label rhncfg-manager remove-channel channel-label rhncfg-manager remove-channel channel-label 
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Removing config channel example-channel Config channel example-channel removed 
Copy to Clipboard Toggle word wrap

B.3.11. Determining the Number of File Revisions

To find out how many revisions (revisions go from 1 to N where N is an integer greater than 0) of a file/path are in a channel, issue the following command:
 rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt  rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt  rhncfg-manager revisions channel-label /tmp/dest_path/example-config.txt 
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Analyzing files in config channel example-channel \ /tmp/dest_path/example-config.txt: 1 
Copy to Clipboard Toggle word wrap

B.3.12. Updating a File in a Channel

To create a new revision of a file in a channel (or add the first revision to that channel if none existed before for the given path), issue the following command:
 rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file rhncfg-manager update \ --channel=channel-label --dest-file=/path/to/file.txt /local/path/to/file
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Pushing to channel example-channel: Local file example-channel/tmp/dest_path/example-config.txt -> \ remote file /tmp/dest_path/example-config.txt 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager update:
Expand
Table B.10. rhncfg-manager update options
Option Description
-cCHANNEL, --channel=CHANNEL Upload files in this config channel
-dDEST_FILE, --dest-file=DEST_FILE Upload the file as this path
-tTOPDIR, --topdir=TOPDIR Make all files relative to this string
--delim-start=DELIM_START Start delimiter for variable interpolation
--delim-end=DELIM_END End delimiter for variable interpolation
-h, --help Show help message and exit

B.3.13. Uploading Multiple Files at Once

To upload multiple files to a config channel from local disk at once, issue the command:
 rhncfg-manager upload-channel --topdir=topdir channel-label rhncfg-manager upload-channel --topdir=topdir channel-label rhncfg-manager upload-channel --topdir=topdir channel-label rhncfg-manager upload-channel --topdir=topdir channel-label
Copy to Clipboard Toggle word wrap
The output resembles the following:
 Using config channel example-channel4 Uploading /tmp/ola_world.txt from blah4/tmp/ola_world.txt 
Copy to Clipboard Toggle word wrap
The following table lists the options available for rhncfg-manager upload-channel:
Expand
Table B.11. rhncfg-manager upload-channel options
Option Description
-tTOPDIR, --topdir=TOPDIR Directory all the file paths are relative to
-cCHANNEL, --channel=CHANNEL List of channels the config info will be uploaded into. Channels delimited by ','. Example: --channel=foo,bar,baz
-h, --help Show help message and exit
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat