18-Application Hosting Configuration Guide

HomeSupportSwitchesS12500R SeriesConfigure & DeployConfiguration GuidesH3C S12500R Switch Router Series Configuration Guides(R51xx)-6W10118-Application Hosting Configuration Guide
02-RPM application hosting
Title Size Download
02-RPM application hosting 95.29 KB

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 2014, Key ID 24c6a8a7f4a80eb5

Source RPM  : nano-2.3.1-10.el7.src.rpm

Build Date  : Tue Jun 10 04:47:54 2014

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, you can follow either of the methods:

·     Access the software provider website.

·     On CentOS 7, execute the following command:

yum install --downloadonly

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)

1.     Enter system view.

system-view

2.     Install an RPM package without checking for free disk space.

rpm -i --ignoresize xxx.rpm

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> system-view

[Sysname] rpm -qp --info zip-3.0-11.el7.x86_64.rpm

Name        : zip

Version     : 3.0

Release     : 11.el7

Architecture: x86_64

Install Date: (not installed)

Group       : Applications/Archiving

Size        : 815173

License     : BSD

Signature   : RSA/SHA256, Sun Nov 20 21:04:58 2016, Key ID 24c6a8a7f4a80eb5

Source RPM  : zip-3.0-11.el7.src.rpm

Build Date  : Sat Nov  5 16:49:55 2016

Build Host  : worker1.bsys.centos.org

Relocations : (not relocatable)

Packager    : CentOS BuildSystem <http://bugs.centos.org>

Vendor      : CentOS

URL         : http://www.info-zip.org/Zip.html

Summary     : A file compression and packaging utility compatible with PKZIP

Description :

The zip program is a compression and file packaging utility.  Zip is

analogous to a combination of the UNIX tar and compress commands and

is compatible with PKZIP (a compression and file packaging utility for

MS-DOS systems).

 

Install the zip package if you need to compress files using the zip program.

 

 

NOTE:

The package name displayed in the Name field is used for uninstalling the RPM package.

 

Listing capabilities this package provides (--provides)

<Sysname> system-view

[Sysname] rpm -qp --provides zip-3.0-11.el7.x86_64.rpm

zip = 3.0-11.el7

zip(x86-64) = 3.0-11.el7

Listing capabilities on which this package depends (--requires)

<Sysname> system-view

[Sysname] rpm -qp --requires zip-3.0-11.el7.x86_64.rpm

libbz2.so.1()(64bit)

libc.so.6()(64bit)

libc.so.6(GLIBC_2.14)(64bit)

libc.so.6(GLIBC_2.2.5)(64bit)

libc.so.6(GLIBC_2.3)(64bit)

libc.so.6(GLIBC_2.3.4)(64bit)

libc.so.6(GLIBC_2.4)(64bit)

libc.so.6(GLIBC_2.7)(64bit)

rpmlib(CompressedFileNames) <= 3.0.4-1

rpmlib(FileDigests) <= 4.6.0-1

rpmlib(PayloadFilesHavePrefix) <= 4.0-1

rtld(GNU_HASH)

rpmlib(PayloadIsXz) <= 5.2-1

Listing the package specific scriptlets that are used as part of the installation and uninstallation processes (--scripts)

<Sysname> system-view

[Sysname] rpm -qp --scripts telnet-server-0.17-64.el7.x86_64.rpm

postinstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then

        # Initial installation

        systemctl preset telnet.socket >/dev/null 2>&1 || :

fi

preuninstall scriptlet (using /bin/sh):

if [ $1 -eq 0 ] ; then

        # Package removal, not upgrade

        systemctl --no-reload disable telnet.socket > /dev/null 2>&1 || :

        systemctl stop telnet.socket > /dev/null 2>&1 || :

fi

postuninstall scriptlet (using /bin/sh):

systemctl daemon-reload >/dev/null 2>&1 || :

if [ $1 -ge 1 ] ; then

        # Package upgrade, not uninstall

        systemctl try-restart telnet.socket >/dev/null 2>&1 || :

fi

Listing file names with their requires (--filerequire)

<Sysname> system-view

[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> system-view

[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/telnet@.service 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> system-view

[Sysname] rpm -qpc nano-2.3.1-10.el7.x86_64.rpm

/etc/nanorc

Listing documentation files (-d or --docfiles)

<Sysname> system-view

[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/info/nano.info.gz

/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/nano.1.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> system-view

[Sysname] rpm -qpl telnet-server-0.17-64.el7.x86_64.rpm

/usr/lib/systemd/system/telnet.socket

/usr/lib/systemd/system/telnet@.service

/usr/sbin/in.telnetd

/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> system-view

[Sysname] rpm -q --whatprovides nano

nano-2.3.1-10.el7.x86_64

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

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网