CentOS How to make the RPM package?
Talking about RPM to many compiled and installed friends, RPM installation is a fool to install.
Oh, in fact, RPM is a very effective centralized deployment of the solution.
YUM+RPM is a very fast and convenient large-scale deployment scenario.
Below is a brief introduction to the production of RPM:
Take Cronolog as an example:
First download the Cronolog source package.
Unlock the source package, tar xzvf cronolog-1.6.2.tar.gz
Find Cronolog.spec The file is a configuration file that customizes how to generate the RPM package
?
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 45 46 47 |
Vim cronolog.spec%define name cronolog%define version 1.6.2%define Release 1%define group System networking/daemons S Ummary:a Flexible log file rotation program for Apache Name:%{name} Version:%{version} release:%{release} copyright:a Pache 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 in its input and writes them to a s Et 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 ry 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 |
Copy the code and then copy the source package to the/usr/src/redhat/sources/
CP cronolog-1.6.2.tar.gz/usr/src/redhat/sources/
execution, Rpmbuild-ba Cronolog.spec
So the RPM package is generated, ^_^
Ls-l/usr/src/redhat/rpms/i386/