Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Linux RPM package

2025-04-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use Linux RPM package". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

11 install and package the resource agent

How to include it in your own application package or in the Linux-HA resource proxy library.

11.1 install Resource Agent

If you want to include your resource agent in your own project, you must install it in the correct location. The resource agent should be installed in the / usr/lib/ocf/resource.d/ directory, which is the name of your project or any other name you want.

For example, if your foobar resource agent is packaged as part of your fortytwo project, its full path should be / usr/lib/ocf/resource.d/fortytwo/foobar. Make sure your resource agent has 755 (- rwxr-xr-x) permissions.

When installed in this way, OCF-compliant cluster resource management will correctly locate, parse, and execute your resource agent. For example, Pacemaker cluster management will map the above path to the ocf:fortytwo:foobar resource agent identity.

11.2 packaged Resource Agent

If your resource agent is part of your project, you should pay attention to some of the points mentioned in this section.

Note:

If you want to submit your resource agent to the Linux-HA resource agent library, you can refer to Section 11.3, submit the resource agent.

11.2.1 RPM package

It is recommended that you use the name-resource-agents when packaging your resource agent as RPM. Make sure the package can be placed in the provider directory and rely on the upper directory and script functions. A RPM spec code is as follows:

one

two

three

four

five

six

seven

eight

nine

ten

eleven

twelve

% package resource-agents

Summary: OCF resource agent for Foobar

Group: System Environment/Base

Requires:% {name} =% {version} -% {release}, resource-agents

% description resource-agents

This package contains the OCF-compliant resource agents for Foobar.

% files resource-agents

% defattr (755, 755, root,)

Dir {_ prefix} / lib/ocf/resource.d/fortytwo

% {_ prefix} / lib/ocf/resource.d/fortytwo/foobar

Note:

If the RPM spec file contains a% package declaration, RPM thinks it is a subpackage that inherits upper-level content such as Name,Version,License. Sub-packages is made up of the names of the parent packages followed by their own names. Thus, the Sub-package defined in the above code is named foobar-resource-agents (assuming the name of the package is foobar).

11.2.2 Debian package

For Debian packages, like RPM, it is recommended that you use a separate package to hold your resource proxy, but rely on the cluster-agents package.

Note: it is assumed that debhelper is used to make deb packages.

An example of debian/control code is as follows:

one

two

three

four

five

Package: foobar-cluster-agents

Priority: extra

Architecture: all

Depends: cluster-agents

Description: OCF-compliant resource agents for Foobar

You can also create a separate .install file. Following the example above, install the foobar resource agent, which is a subpackage of fortytwo, and the debian/fortytwo-cluster-agents .install file should contain the following:

one

Usr/lib/ocf/resource.d/fortytwo/foobar

11.3 submit Resource Agent

If you submit the resource agent to the resource agent software repository (ClusterLabsrepository on GitHub) instead of being part of your project, you can follow these steps.

Create a working copy of the upstream warehouse (a Gitclone)

one

Git clone git://github.com/ClusterLabs/resource-agents

Then copy your resource agent to your heartbeat subdirectory

one

two

three

four

Cd resource-agents/heartbeat

Cp / path/to/your/local/copy/of/foobar.

Chmod 0755 foobar

Cd..

Next, modify the Makefile.am file in the resource-agents/heartbeat directory to add your resource agent ocf_SCRIPTS list. This ensures that your resource agent is installed correctly.

Finally, open the Makefile.am file in the resource-agents/doc/man directory and add the ocf_heartbeat_.7 to the man_MANS variable. This will automatically generate the man pages of the resource agent from the resource agent's metadata and install them in the correct location.

Now, add your resource agent, and your modified Makefile:

one

two

three

four

Git add heartbeat/foobar

Git add heartbeat/Makefile.am

Git add doc/man/Makefile.am

Git commit

When submitting a message, it is best to provide a meaningful sentence. such as

one

Git send-email-to=linux-ha-dev@lists.linux-ha.org

The patch set is best provided with a declaration or notification on mailing list.

Git send-email will organize this update in a good format and submit it to the mailing list. For details, please refer to the man page of git-send-mail.

Once your submission is accepted, the upstream developer will push your patch to the upstream repository. At this point, you can update directly from the upstream library and delete your patch set.

one

two

Git reset-hard origin/master

Git pull

11.4 maintenance Resource Agent

If you are an agent for a particular resource, or if you are contributing repeatedly to a piece of code, it is best to open a branch on GitHub.

If you're going to do this:

Create a GitHub account (if you are a new user)

Fork resource-agents software repository

Clone the branch you created to the local working version

If you develop a resource agent, you can submit it often and early. You can often merge your submissions via git rebase i later.

If you make a submission that you want some people to see, review. Add them to your GitHub branch and send an email to the linux-ha-dev mailing list, indicating these people in the email.

After all this has been done and changed as required, you can issue a pull request. There are two ways:

You can use the git request-pull app to get a pre-organized framework that summarizes your changes. You can add the information you want and send it to the mailing list. It's best to prefix the subject of your email with [GIT PULL], so that upstream developers can get the information more easily.

You can also send a request directly to GitHub, and GitHub automatically notifies the upstream developer by email. For more details, please see github:help.

This is the end of the content of "how to use Linux RPM package". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report