- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
02-RPM application hosting | 114.86 KB |
Contents
Communication between RPM applications
Restrictions and guidelines: RPM application hosting
Configuring network parameters for RPM applications
RPM application configuration examples
Example: Installing an RPM application
Appendix rpm command reference
Downloading an RPM package without installing it
Querying information about an RPM package
Running an application that is installed through RPM
Uninstalling an application that is installed through RPM
Querying RPM package information (-qp)
Displaying rpm command help information
Hosting RPM applications
About RPM application hosting
Comware 9 supports installing software that is packaged with Red-Hat Package Manager (RPM). It provides an RPM API for you to easily install, run, and manage RPM applications, simplifying the application management and maintenance.
RPM applications run in Comware and shares the system resources and network parameters with the Comware-native applications.
Communication between RPM applications
RPM applications on one device use an internal interface to communicate with each other.
No source IP address is used for RPM applications on different devices on the same subnet to communicate. The destination device must be reachable from the Comware system.
For RPM applications to communicate with indirectly connected networks, you must configure a source IP address for the RPM applications. They use the IP address of the specified interface as the source IP address for packets that they generate, and a connection must be available between the interface and the destination device.
As shown in Figure 1, the system kernel creates a default route and one direct route for each interface in up state. Because Host A and Port A reside on the same subnet, Host A can use IP address 2.2.2.1 to communicate with the applications RPM1 and RPM2. The similar is true for Host B. Because Host C resides on a different subnet than the device, Host C must use the source IP address specified for the applications to communicate with the applications RPM1 and RPM2.
Figure 1 Network diagram for RPM applications
Restrictions and guidelines: RPM application hosting
Run only secure and trustworthy RPM applications on the device and patch the applications in time. Do not run malicious software.
It is forbidden to reverse engineer RPM applications and Comware.
If an RPM application conflicts with a Comware application, the device prefers to use the Comware application. For example, the device uses the FTP server provided in Comware to respond to FTP clients if the following conditions are met:
· You enable the FTP server provided in Comware and run an FTP server RPM application.
· The two FTP servers use the same IP address and port number.
The device uses the FTP server RPM application only if you disable the FTP server provided in Comware.
Installing an RPM application
About this task
The Comware system integrates the RPM functions. After you log in to the Comware CLI interface, you can issue the rpm command as in Linux to install, run, and manage RPM applications.
Restrictions and guidelines
Comware does not start, stop, or monitor RPM applications.
The parameter requirements for the rmp command are the same as those in Linux. You can enter rpm –-help to view the parameter help information. "Appendix rpm command reference" provides commonly used parameters for the rpm command.
Procedure
1. Download an RPM package through FTP or TFTP.
For more information, see FTP and TFTP configuration in Fundamentals Configuration Guide.
2. Enter system view.
system-view
3. Install an RPM application in Comware.
rpm [ params ]
4. Run an RPM application.
run bash app [ params ]
Configuring network parameters for RPM applications
The following describes network parameter configuration tasks for RPM applications. For more inforamtion, see "Configuring common container and open application parameters."
· Specifying a source IP address for RPM applications
This task is required for RPM applications to communicate with indirectly connected networks.
· (Optional) Reserving port numbers for RPM applications
For the device to correctly forward packets destined for RPM client or server applications that share the network namespace of Comware, you must reserve port numbers for the RPM applications.
· (Optional) Preconditioning incoming IP packets
You can configure the device to procondition RPM application unicast and multicast packets, and send RPM application multicast packets to its CPU.
RPM application configuration examples
Example: Installing an RPM application
Network configuration
Use RPM to install the nano editor in Comware so that users can use the CLI to create and edit files.
Procedure
# Use TFTP to download the nano editor package nano-2.3.1-10.el7.x86_64.rpm.
<Device> tftp 192.168.1.33 get nano-2.3.1-10.el7.x86_64.rpm
Press CTRL+C to abort.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 439k 100 439k 0 0 438k 0 0:00:01 0:00:01 --:--:-- 477k
100 439k 100 439k 0 0 438k 0 0:00:01 0:00:01 --:--:-- 438k
# Query the information about the package nano-2.3.1-10.el7.x86_64.rpm.
<Device> system-view
[Device] rpm -qp --info nano-2.3.1-10.el7.x86_64.rpm
Name : nano
Version : 2.3.1
Release : 10.el7
Architecture: x86_64
Install Date: (not installed)
Group : Applications/Editors
Size : 1715901
License : GPLv3+
Signature : RSA/SHA256, Fri Jul 4 03:53:43 2019, Key ID 24c6a8a7f4a80eb5
Source RPM : nano-2.3.1-10.el7.src.rpm
Build Date : Tue Jun 10 04:47:54 2019
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.nano-editor.org
Summary : A small text editor
Description :
GNU nano is a small and friendly text editor.
# Install the nano editor.
[Device] rpm -i nano-2.3.1-10.el7.x86_64.rpm
# Run the nano editor.
[Device] run bash nano
GNU nano 2.3.1 New Buffer
^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
# In the editor, enter the content Hello world!.
GNU nano 2.3.1 New Buffer Modified
Hello world!
^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell
# Press Ctrl+X to exist editing, and enter Y to save the file.
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
Y Yes
N No ^C Cancel
# Specify the file name as nanotest.
File Name to Write: nanotest
^G Get Help M-D DOS Format M-A Append M-B Backup File
^C Cancel ^ M-M Mac Format M-P Prepend
Verifying the configuration
# View the nanotest file, and the content in the file is the same as what is added.
[Device] quit
<Device> more nanotest
Hello world!
Appendix rpm command reference
This chapter provides the commonly used rpm command parameters and their usage. For more information, execute the rpm –-help command to view the entire help information or see RPM related documents.
Downloading an RPM package without installing it
To download an RPM package, access the software provider website.
Querying information about an RPM package
1. Enter system view.
system-view
2. query information about an RPM package.
rpm -qp --info xxx.rpm
Installing an RPM package
Installing an RPM package (-i)
1. Enter system view.
system-view
2. Install an RPM package.
rpm -i xxx.rpm
Installing an RPM package without the dependency check (--nodeps)
Make sure the package on which the xxx.rpm package depends is installed before the xxx.rpm. If you are sure the required package has already been installed, you can force RPM to install the package by specifying the --nodeps keyword.
To install an RPM package without the dependency check:
1. Enter system view.
system-view
2. Install an RPM package without the dependency check
rpm -i --nodeps xxx.rpm
Installing an RPM package without checking for free disk space (--ignoresize)
system-view
2. Install an RPM package without checking for free disk space.
Running an application that is installed through RPM
Procedure
To run an application that is installed through RPM, execute the following command in system view:
run bash app [ params ]
Example
Run a nano editor.
<Sysname> system-view
[Sysname] run bash nano
Uninstalling an application that is installed through RPM
Procedure
If an application is no longer used, you can remove the software. To remove an application that is installed through RPM, execute the following command in system view:
rpm -e package-name
To get the package name, execute the rpm -qp --info xxxx.rpm command in system view.
Example
# Uninstall an application.
<Sysname> system-view
[Sysname] rpm -qp --info zip-3.0-11.el7.x86_64.rpm
Name : zip
[Sysname] rpm -e zip
Querying RPM package information (-qp)
Querying information about an RPM package (--info)
[Sysname] rpm -qp --info zip-3.0-11.el7.x86_64.rpm
warning: zip-3.0-29.hl202.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 4acc6
132: NOKEY
Name : zip
Version : 3.0
Release : 29.hl202
Architecture: x86_64
Install Date: (not installed)
Group : Unspecified
Size : 764240
License : Info-ZIP
Signature : RSA/SHA1, Thu Jun 30 03:24:27 2022, Key ID 4fe375e84acc6132
Source RPM : zip-3.0-29.hl202.src.rpm
Build Date : Thu Jun 30 03:24:23 2022
Build Host : 477
Relocations : (not relocatable)
Vendor : h3linux
URL : http://www.info-zip.org/Zip.html
Summary : A compression and file packaging/archive utility
Description :
The zip program is a compression and file packaging utility. Zip has one
compression method and can also store files without compression.
Zip automatically chooses the better of the two for each file. Compression
ratios of 2:1 to 3:1 are common for text files.
warning: zip-3.0-29.hl202.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 4acc6
|
NOTE: The package name displayed in the Name field is used for uninstalling the RPM package. |
Listing capabilities this package provides (--provides)
[Sysname] rpm -qp --provides zip-3.0-11.el7.x86_64.rpm
Listing capabilities on which this package depends (--requires)
[Sysname] rpm -qp --requires zip-3.0-11.el7.x86_64.rpm
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Listing the package specific scriptlets that are used as part of the installation and uninstallation processes (--scripts)
[Sysname] rpm -qp --scripts telnet-server-0.17-64.el7.x86_64.rpm
postinstall scriptlet (using /bin/sh):
systemctl preset telnet.socket >/dev/null 2>&1 || :
preuninstall scriptlet (using /bin/sh):
# Package removal, not upgrade
systemctl --no-reload disable telnet.socket > /dev/null 2>&1 || :
systemctl stop telnet.socket > /dev/null 2>&1 || :
postuninstall scriptlet (using /bin/sh):
systemctl daemon-reload >/dev/null 2>&1 || :
# Package upgrade, not uninstall
systemctl try-restart telnet.socket >/dev/null 2>&1 || :
Listing file names with their requires (--filerequire)
[Sysname] rpm -qp --filerequire -v nano-2.3.1-10.el7.x86_64.rpm | awk '{if ($2 != "") {print $0}}'
/usr/bin/nano libc.so.6(GLIBC_2.6)(64bit) libc.so.6(GLIBC_2.11)(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libncursesw.so.5()(64bit) libtinfo.so.5()(64bit) libc.so.6()(64bit) rtld(GNU_HASH)
[Sysname] rpm -qp --filerequire -v telnet-server-0.17-64.el7.x86_64.rpm | awk '{if ($2 != "") {print $0}}'
/usr/sbin/in.telnetd libutil.so.1(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.8)(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.16)(64bit) libc.so.6(GLIBC_2.15)(64bit) libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libutil.so.1()(64bit) libc.so.6()(64bit) rtld(GNU_HASH)
Listing files with their file classes (--fileclass)
[Sysname] rpm -qp --fileclass telnet-server-0.17-64.el7.x86_64.rpm
warning: telnet-server-0.17-64.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
/usr/lib/systemd/system/telnet.socket ASCII text
/usr/lib/systemd/system/[email protected] ASCII text
/usr/sbin/in.telnetd ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=e9071293843c16a2e779eb68aa523c8e1f68834e, stripped
/usr/share/man/man5/issue.net.5.gz troff or preprocessor input, ASCII text (gzip compressed data, from Unix, max compression)
/usr/share/man/man8/in.telnetd.8.gz troff or preprocessor input, ASCII text (gzip compressed data, from Unix, max compression)
/usr/share/man/man8/telnetd.8.gz symbolic link to `in.telnetd.8.gz'
Listing configuration files in an RPM package (-c or --configfiles)
[Sysname] rpm -qpc nano-2.3.1-10.el7.x86_64.rpm
Listing documentation files (-d or --docfiles)
[Sysname] rpm -qpd nano-2.3.1-10.el7.x86_64.rpm
/usr/share/doc/nano-2.3.1/AUTHORS
/usr/share/doc/nano-2.3.1/BUGS
/usr/share/doc/nano-2.3.1/COPYING
/usr/share/doc/nano-2.3.1/ChangeLog
/usr/share/doc/nano-2.3.1/INSTALL
/usr/share/doc/nano-2.3.1/NEWS
/usr/share/doc/nano-2.3.1/README
/usr/share/doc/nano-2.3.1/THANKS
/usr/share/doc/nano-2.3.1/TODO
/usr/share/doc/nano-2.3.1/faq.html
/usr/share/doc/nano-2.3.1/nanorc.sample
/usr/share/man/fr/man1/nano.1.gz
/usr/share/man/fr/man1/rnano.1.gz
/usr/share/man/fr/man5/nanorc.5.gz
/usr/share/man/man1/rnano.1.gz
/usr/share/man/man5/nanorc.5.gz
Listing files in an RPM package (-l or--list)
[Sysname] rpm -qpl telnet-server-0.17-64.el7.x86_64.rpm
/usr/lib/systemd/system/telnet.socket
/usr/lib/systemd/system/[email protected]
/usr/share/man/man5/issue.net.5.gz
/usr/share/man/man8/in.telnetd.8.gz
/usr/share/man/man8/telnetd.8.gz
Listing the RPM package installed for the software (--whatprovides)
[Sysname] rpm -q --whatprovides nano
Displaying rpm command help information
In system view, execute the rpm --help command to obtain the command help information
<Sysname> system-view
[Sysname] rpm --help
Usage: rpm [OPTION...]
Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
…