免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1798 | 回复: 1
打印 上一主题 下一主题

rpm 包制作 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-12 23:42 |只看该作者 |倒序浏览
rpm 包制作














谈论RPM对好多编译安装的朋友来多,RPM安装是傻瓜安装。
呵呵,其实RPM是一种非常有效果的集中部署的解决方案。
yum+RPM是非常快速便捷的大规模部署方案。
下面简单介绍下rpm的制作:
以cronolog为例:
首先下载cronolog的源码包。
解开源码包,tar xzvf cronolog-1.6.2.tar.gz
找到 cronolog.spec 该文件是定制如何生成RPM包的配置文件
  1. 01. vim cronolog.spec

  2. 02.%define name cronolog

  3. 03.%define version 1.6.2

  4. 04.%define release 1

  5. 05.%define group System Networking/Daemons

  6. 06.Summary:        a flexible log file rotation program for Apache

  7. 07.Name:           %{name}

  8. 08.Version:        %{version}

  9. 09.Release:        %{release}

  10. 10.Copyright:      Apache license

  11. 11.Group:          %{group}

  12. 12.Packager:       Andrew Ford <A.Ford@ford-mason.co.uk>

  13. 13.URL:            http://www.ford-mason.co.uk/resources/cronolog/

  14. 14.Source:         http://www.ford-mason.co.uk/resources/cronolog/cronolog-%version.tar.gz

  15. 15.BuildRoot:      /tmp/%{name}-root

  16. 16.%description

  17. 17."cronolog" is a simple program that reads log messages from its input

  18. 18.and writes them to a set of output files, the names of which are

  19. 19.constructed using template and the current date and time.  The

  20. 20.template uses the same format specifiers as the Unix date command

  21. 21.(which are the same as the standard C strftime library function).

  22. 22.%changelog

  23. 23.%prep

  24. 24.%setup -n %{name}-%{version}

  25. 25.%build

  26. 26../configure

  27. 27.make

  28. 28.

  29. 29.%install

  30. 30.rm -rf $RPM_BUILD_ROOT

  31. 31.mkdir -p $RPM_BUILD_ROOT/usr/share/doc/%{name}-${RPM_PACKAGE_VERSION} -m 755

  32. 32.make prefix=$RPM_BUILD_ROOT/usr mandir=$RPM_BUILD_ROOT/usr/share/man install

  33. 33.install -m 644 README $RPM_BUILD_ROOT/usr/share/doc/%name-${RPM_PACKAGE_VERSION}

  34. 34.#install -m 644 $RPM_SOURCE_DIR/doc/cronolog.1m $RPM_BUILD_ROOT/usr/man/man1/cronolog.1

  35. 35.#install -m 755 $RPM_SOURCE_DIR/src/cronolog $RPM_BUILD_ROOT/usr/sbin/cronolog

  36. 36.#strip  $RPM_BUILD_ROOT/usr/sbin/* || echo Ignored strip on a non-binary file

  37. 37.

  38. 38.%post

  39. 39.%preun

  40. 40.%postun

  41. 41.

  42. 42.%clean

  43. 43.rm -rf $RPM_BUILD_ROOT

  44. 44.

  45. 45.%files

  46. 46.#%attr(-,root,root) /usr/share/doc/%{name}-%{version}/README

  47. 47.%attr(-,root,root) /usr/sbin/cronolog

  48. 48.%attr(-,root,root) /usr/sbin/cronosplit

  49. 49.#%files man

  50. 50.%attr(644,root,root) /usr/share/man/man1/*.1*

  51. 51.%doc README
  52. 复制代码
复制代码
然后,将源码包复制到 /usr/src/redhat/SOURCES/
cp cronolog-1.6.2.tar.gz /usr/src/redhat/SOURCES/
执行,rpmbuild -ba cronolog.spec
这样RPM包就生成了,^_^
ls -l /usr/src/redhat/RPMS/i386/

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
2 [报告]
发表于 2011-12-13 11:01 |只看该作者
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP