Centos下rpm包如何制作
添加时间:2019-9-12 17:37:29
添加:
思海网络
下面简单介绍下rpm的制作:
以cronolog为例:
首先下载cronolog的源码包。
解开源码包,tar xzvf cronolog-1.6.2.tar.gz
找到 cronolog.spec 该文件是定制如何生成RPM包的配置文件
vim cronolog.spec
%define name cronolog
%define version 1.6.2
%define release 1
%define group System Networking/Daemons
Summary: a flexible log file rotation program for Apache
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
%deion
"cronolog" is a simple program that reads log messages from its input
and writes them to a set of output files, the names of which are
constructed using template and the current date and time. The
template uses the same format specifiers as the Unix date command
(which are the same as the standard C strftime library function).
%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
make prefix=$RPM_BUILD_ROOT/usr mandir=$RPM_BUILD_ROOT/usr/share/man install
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包就生成了,^_^
ls -l /usr/src/redhat/RPMS/i386/
关键字:Centos、rpm、制作
新文章:
- CentOS7下图形配置网络的方法
- CentOS 7如何添加删除用户
- 如何解决centos7双系统后丢失windows启动项
- CentOS单网卡如何批量添加不同IP段
- CentOS下iconv命令的介绍
- Centos7 SSH密钥登陆及密码密钥双重验证详解
- CentOS 7.1添加删除用户的方法
- CentOS查找/扫描局域网打印机IP讲解
- CentOS7使用hostapd实现无AP模式的详解
- su命令不能切换root的解决方法
- 解决VMware下CentOS7网络重启出错
- 解决Centos7双系统后丢失windows启动项
- CentOS下如何避免文件覆盖
- CentOS7和CentOS6系统有什么不同呢
- Centos 6.6默认iptable规则详解