百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>数据库> Centos下rpm包如何制作?Centos下rpm包制作的方法
分享文章到:

Centos下rpm包如何制作?Centos下rpm包制作的方法

发布时间:01/15 来源: 浏览: 关键词:
很多朋友还不知道Centos下rpm包如何制作?有需要了解的同学进来看一看!

谈论RPM对好多编译安装的朋友来多,RPM安装是傻瓜安装。

呵呵,其实RPM是一种非常有效果的集中部署的解决方案。

yum+RPM是非常快速便捷的大规模部署方案。

下面简单介绍下rpm的制作:

以cronolog为例:

首先下载cronolog的源码包。

解开源码包,tar xzvf cronolog-1.6.2.tar.gz

找到 cronolog.spec 该文件是定制如何生成RPM包的配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
vim cronolog.spec
%define name cronolog
%define version 1.6.2
%define release 1
%define group System Networking/Daemons
Summary:        a flexible logfilerotation programforApache
Name:           %{name}
Version:        %{version}
Release:        %{release}
Copyright:      Apache license
Group:          %{group}
Packager:       Andrew Ford <A.Ford@ford-mason.co.uk>
URL:            http://www.ford-mason.co.uk/resources/cronolog/
Source:         http://www.ford-mason.co.uk/resources/cronolog/cronolog-%version.tar.gz
BuildRoot:     /tmp/%{name}-root
%description
"cronolog"is a simple program that reads log messages from its input
and writes them to asetof output files, the names ofwhichare
constructed using template and the currentdateandtime.  The
template uses the sameformatspecifiers as the Unixdatecommand
(whichare the same as the standard C strftime libraryfunction).
%changelog
%prep
%setup -n %{name}-%{version}
%build
./configure
make
%install
rm-rf $RPM_BUILD_ROOT
mkdir-p $RPM_BUILD_ROOT/usr/share/doc/%{name}-${RPM_PACKAGE_VERSION} -m 755
makeprefix=$RPM_BUILD_ROOT/usrmandir=$RPM_BUILD_ROOT/usr/share/maninstall
install-m 644 README $RPM_BUILD_ROOT/usr/share/doc/%name-${RPM_PACKAGE_VERSION}
#install -m 644 $RPM_SOURCE_DIR/doc/cronolog.1m $RPM_BUILD_ROOT/usr/man/man1/cronolog.1
#install -m 755 $RPM_SOURCE_DIR/src/cronolog $RPM_BUILD_ROOT/usr/sbin/cronolog
#strip  $RPM_BUILD_ROOT/usr/sbin/* || echo Ignored strip on a non-binary file
%post
%preun
%postun
%clean
rm-rf $RPM_BUILD_ROOT
%files
#%attr(-,root,root) /usr/share/doc/%{name}-%{version}/README
%attr(-,root,root)/usr/sbin/cronolog
%attr(-,root,root)/usr/sbin/cronosplit
#%files man
%attr(644,root,root)/usr/share/man/man1/*.1*
%doc README

然后,将源码包复制到 /usr/src/redhat/SOURCES/

cp cronolog-1.6.2.tar.gz /usr/src/redhat/SOURCES/

执行,rpmbuild -ba cronolog.spec

这样RPM包就生成了,^_^

打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有9人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板