Centos下rpm包如何製作?

來源:互聯網
上載者:User

   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 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 %description "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/

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.