标签: rpm

RPM 提取 jar 文件

我想创建仅用于提取 jar 文件的 RPM 包:

Name:           pack-agent
Version:        1.0
Release:        1%{?dist}
Summary:        Linux Agent installation script
Group:          Utilities
License:        license
Source0:        pack-agent-1.0.tar.gz
BuildArch:      x86_64
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description

%prep
%setup -q -n opt

%build

%install
#install -m 0755 -d $RPM_BUILD_ROOT/agent
#cp -ap agent/* $RPM_BUILD_ROOT/agent/

install -m 0755 -d %{buildroot}/opt
#cp -a * %{buildroot}/agent
cp -a * %{buildroot}/opt

%clean
rm -rf $RPM_BUILD_ROOT

%files
/opt
%defattr(-,root,root,-)

%doc
%changelog
Run Code Online (Sandbox Code Playgroud)

事实证明,在 RPM 安装后,一些文件被损坏,因为有一种特殊的方法可以从 jar 文件中提取文件。我想也许在构建过程中使用了简单的 extract 命令。

有什么办法可以解决这个问题吗?我现在得到这个错误:

org.osgi.framework.BundleException: The bundle file:/opt/agent/deploy/System_Install-1.0.jar does not …
Run Code Online (Sandbox Code Playgroud)

jar rpm rpmbuild rpm-spec

1
推荐指数
1
解决办法
4248
查看次数

如何制作可重定位的rpm?

我有带有 pom.xml 的 java 应用程序。我正在制作带有前缀标签的 rpm 包。

当我查询 rpm 的前缀标签时:

sudo rpm -qp --queryformat "%{prefixes}\n" java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm 
Run Code Online (Sandbox Code Playgroud)

我得到了 ==> /var

如果我运行以下命令:

rpm -qi java-hbase-processor | grep Relocations
Run Code Online (Sandbox Code Playgroud)

我得到:重定位:/opt /tmp 重定位:/var /tmp

以上都表明 rpm 是可重定位的。但是如果运行安装命令

sudo rpm -i --prefix=/home/sohanvir/ java-hbase-processor-1.0-SNAPSHOT20160330060627.noarch.rpm
Run Code Online (Sandbox Code Playgroud)

它会给出错误消息:

错误:包 java-hbase-processor 不可重定位

提前致谢 。

java rpm maven

1
推荐指数
1
解决办法
8330
查看次数

使用内部 rpm 规范文件时,date 命令给出错误的输出

在安装软件包之前,我必须执行一些必要的步骤,例如备份以前的数据存储快照。为此,我使用 %pre 脚本,如下所示。

%pre
#!/bin/sh
--------
--------
stamp=`date +%Y%m%d%H%M%S`
echo ${stamp}
-------------
-------------
Run Code Online (Sandbox Code Playgroud)

输出如下: 20161103123325OURCE 它正在打印一些随机字符和日期。“OURCE”不存在于我的规范文件中的任何位置。

相同的脚本可以完美地独立运行。平台是CentOS7。

linux specifications rpm rpmbuild rpm-spec

1
推荐指数
1
解决办法
782
查看次数

%config(noreplace) 是否足以指示 RPM 在升级中不要触及配置文件?

在我的 RedHat 7.4 上,我正在使用 CMake 创建一个 RPM,我想要给 RPM 的指令之一是 - 单独保留某个配置文件,以防操作是升级。

我想我可以在我的 CMakeLists.txt 中使用(mcve)来完成此任务:

cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)                                                                                                                                                                  
project(MyKibana)

set(kibana_version 6.2.2)
set(kibana_dir /usr/share/mykibana)

list(APPEND CPACK_RPM_USER_FILELIST                                                                                                                                                
  "%config(noreplace) ${kibana_dir}/config/kibana.yml"
  )
Run Code Online (Sandbox Code Playgroud)

然而,当我这样做时sudo yum upgrade /tmp/my-kibana-6.2.2-577-g7cca696.el7.my.x86_64.rpm -y,我发现 处的文件/usr/share/mykibana/config/kibana.yml被RPM 中的文件覆盖。

除了指令之外我还需要做些什么吗%config(noreplace)

redhat rpm cmake

1
推荐指数
1
解决办法
1842
查看次数

CentOS 7 - 将本地包正确添加到 yum 存储库

我正在尝试向其中添加本地 RPM 包yum并安装它。要将它添加到yum存储库,我运行:yum-config-manager --add-repo file:///path/to/local/package.rpm然后yum install package安装它。但是,我得到了这个输出:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.rrzn.uni-hannover.de
 * epel: mirror.23media.de
 * extras: centos.mirrors.psw.services
 * nux-dextop: mirror.li.nux.ro
 * updates: mirror.ratiokontakt.de
harbottle.gitlab.io_harbottle-main_7_x86_64_                                                          | 2.9 kB  00:00:00     
file:///path/to/local/package.rpm/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /path/to/local/package.rpm/repodata/repomd.xml"
Trying other mirror.


 One of the configured repositories failed (added from: file:/path/to/local/package.x86_64.rpm),
 and yum doesn't have enough cached data to continue. At this point the only …
Run Code Online (Sandbox Code Playgroud)

centos rpm yum package

1
推荐指数
1
解决办法
4473
查看次数

RPM SPEC Systemd 启用并启动

我已经创建了一个 RPM SPEC 文件,但我在启用和启动 Systemd 方面遇到了困难。通过 yum 更新软件包会禁用并停止该服务。发行版是Centos 7.x

我已将该服务安装在/etc/systemd/system下。这就是我尝试过的目的,但它不起作用。

我还没有找到任何关于如何做到这一点的好的工作示例。

我使用此页面作为参考。 https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_systemd https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax

    #Pre installation/upgrade of RPM section
    %pre      
      #Upgrading
      if [ $1 -eq 2 ]; then
        /usr/bin/systemctl stop %{pkgname}.service >/dev/null 2>&1 ||:
      fi

    %post
    %systemd_post %{pkgname}.service

      if [ $1 -eq 1 ]; then        
        /usr/bin/systemctl daemon-reload
        /usr/bin/systemctl start %{pkgname}.service
      fi
      if [ $1 -eq 2 ]; then
        /usr/bin/systemctl daemon-reload
        /usr/bin/systemctl start %{pkgname}.service    
      fi

   %preun
   %systemd_preun %{pkgname}.service
    #old package
    #uninstall
    if [ $1 -eq 0 ]; then
      /usr/bin/systemctl --no-reload disable …
Run Code Online (Sandbox Code Playgroud)

linux rpm centos7

1
推荐指数
1
解决办法
9405
查看次数

我无法在我的 docker 容器中安装 yum

我有一个docker containerkeycloak图像构建的。

我想安装vim在容器中,但我发现我需要yum安装vim. 我试图yum从互联网上下载并使用rpm安装它,但是容器不必sudo让我更改文件权限。

以下是我的 linux 版本:

NAME="Red Hat Enterprise Linux"
VERSION="8.0 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.0"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.0 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.0:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.0
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.0" 
Run Code Online (Sandbox Code Playgroud)

如何在容器中安装任何文本编辑器?

rpm rhel yum docker

1
推荐指数
3
解决办法
8319
查看次数

关于为 Perl 模块捆绑 CentOS RPM 的问题

我试图在 RPM 包中捆绑一堆 Perl 模块以便于部署。我尝试了很多工具,但最终选择了 fpm ( https://github.com/jordansissel/fpm )。

因此,我设法为每个必需的 Perl 模块手动构建和安装每个 RPM。我不确定这是正确的。但是我对 RPM 包没有很多经验。但据我所知,这是正确的行为。每个 RPM 包都包含相应 Perl 模块所需的所有依赖项。

问题是当我尝试使用生成的包来安装我的模块时,我遇到了一些冲突。

sudo yum --disablerepo=* localinstall *.rpm
Run Code Online (Sandbox Code Playgroud)

当它尝试安装时:

Transaction Summary
==============================================================================================================================================================================================================
Install  174 Packages

Total size: 45 M
Installed size: 357 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction test error:
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Exporter-2.2013-1.x86_64 and Moose-2.2013-1.x86_64
  file /usr/local/lib64/perl5/auto/Moose/Moose.so conflicts between attempted installs of Moose-Role-2.2013-1.x86_64 and Moose-Exporter-2.2013-1.x86_64 …
Run Code Online (Sandbox Code Playgroud)

linux perl redhat rpm

1
推荐指数
1
解决办法
89
查看次数

在RPM系统上使用Lua构建nginx

我想用Lua第三方模块构建nginx.该模块需要Lua库.Lua 5.1安装在我的服务器上.但是当我使用nginx lua模块的路径运行./compile时.抛出错误:

checking for Lua library ... not found 
checking for Lua library in /usr/local/ ... not found 
checking for Lua library in /usr/pkg/ ... not found 
checking for Lua library in /opt/local/ ... not found 
checking for Lua library in /usr/local/../lua51/ ... not found 
checking for Lua library in /usr/ ... not found  
./configure: error: ngx_http_lua_module requires the Lua library.
Run Code Online (Sandbox Code Playgroud)

我尝试通过导出给路径,LUA_LIB=/usr/local/lib/但也没有用.

任何帮助,将不胜感激.

lua rpm nginx

0
推荐指数
1
解决办法
4154
查看次数

如何在Artifactory中为RPM存储库生成元数据

我们在日常开发过程中生成RPM,我们将这些RPM部署到生产环境中.

所有这些RPM都将存储在本地yum存储库中,我们只需使用"yum install package"来安装任何RPM.

我们希望使用Artifactory或Nexus(仅OSS版本)来管理我们的包,因为它们都可以用作YUM存储库,我们首先尝试评估它们.

我首先安装了Artifactory OSS版本进行评估.

  • 创建了一个测试回购
  • 将RPM文件上传到该测试仓库
  • 在/etc/yum.repos.d中创建了一个artifactory.repo,其中包含了artifactory存储库路径

但是,当我尝试使用yum install安装该RPM时,我遇到了错误

http://artifactory-server:8080/artifactory/testrepo/repodata/primary.xml.gz: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Error: failure: repodata/primary.xml.gz from artifactory: [Errno 256] No more mirrors to try.
Run Code Online (Sandbox Code Playgroud)

我确实理解了错误,它正在寻找该存储库中的元数据并且它不存在.

我确实看到了自动创建元数据的选项,但这似乎只适用于PRO版本.

这意味着我们不能将Artifactory OSS用作yum存储库吗?我认为应该有一种方法可以将它用作YUM repo,至少具有基本功能.我想我在这里遗漏了一些东西.

我的问题:

  1. 我们不能使用Artifactory OSS版本自动生成元数据吗?任何人都可以让我知道如何使用Artifactory OSS版本作为YUM回购?
  2. 哪一个更符合我的要求Artifactory/Nexus(开源版本)

rpm yum nexus artifactory

0
推荐指数
1
解决办法
2343
查看次数

标签 统计

rpm ×10

linux ×3

yum ×3

redhat ×2

rpm-spec ×2

rpmbuild ×2

artifactory ×1

centos ×1

centos7 ×1

cmake ×1

docker ×1

jar ×1

java ×1

lua ×1

maven ×1

nexus ×1

nginx ×1

package ×1

perl ×1

rhel ×1

specifications ×1