最近分享zabbix與ansible好多,大家看煩了,我也沒啥存貨了,現(xiàn)在就介紹一下如何進行rpm打包吧。
創(chuàng)新互聯(lián)是一家專業(yè)提供相城企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計制作、網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計、小程序制作等業(yè)務(wù)。10年已為相城眾多企業(yè)、政府機構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進行中。
rpm打包有2個,一個是自己寫spec,另外要給是使用ruby的fpm,我個人比較傾向于第二種fpm,這個不需要寫spec文件,特簡單,不過為了讓大家看明白,我分別介紹一下這2款軟件是如何進行rpm打包的。
目錄
一、使用spec構(gòu)建rpm
二、使用fpm構(gòu)建rpm
一、使用spec構(gòu)建rpm
在構(gòu)架rpm包的時候,需要經(jīng)過3個過程
1、解壓源碼包
2、編譯環(huán)境configure
3、make
然后再使用check install做rpm包
同時如果在安裝rpm包的時候,你想查看安裝過程可以使用,rpm -qi --scriptsname.rpm查看
如果在構(gòu)架腳本或者其他非源碼包安裝的時候,可以使用rpmbild
1、把腳本目錄給tar
2、構(gòu)架spec
3、rpmbuild
注意的完成最終的工作了。請使用根目錄用戶身份安裝rpmbuild命令。在Red Hat中,請用yum install rpm-build完成這項工作。接下來,請確保所有的文件都呆在正確的地方。Tar存檔文件必須位于創(chuàng)建軟件包的當前用戶帳戶的~/rpmbuild /SOURCES 目錄下,demo.spec文件必須位于~/rpmbuild/SPECS目錄下?,F(xiàn)在你可以用rpmbuild -ba test.spec命令來創(chuàng)建軟件包了。這會在~/rpmbuild/RPMS目錄下創(chuàng)建你的RPM文件。
可以參考
http://www.linuxidc.com/Linux/2012-05/60278.htm
http://blog.csdn.net/cybertan/article/details/5972935
我做的測試是創(chuàng)建一個test-1.0目錄,里有個test.txt文件,內(nèi)容是this is test
A.創(chuàng)建rpm目錄
mkdir -p ~/rpmbuild/{RPMS,SOURCES,SPECS}
B.創(chuàng)建壓縮文件
16:02:25 # cd ~/rpmbuild/SOURCES/ root@ip-10-10-10-10:~/rpmbuild/SOURCES 16:05:09 # mkdir test-1.0 root@ip-10-10-10-10:~/rpmbuild/SOURCES 16:05:32 # echo "this is test">test-1.0/test.txt root@ip-10-10-10-10:~/rpmbuild/SOURCES 16:05:43 # tar zcvf test-1.0.tar.gz test-1.0 test-1.0/ test-1.0/test.txt root@ip-10-10-10-10:~/rpmbuild/SOURCES 16:05:48 # rm -rf test-1.0 root@ip-10-10-10-10:~/rpmbuild/SOURCES 16:05:52 # ll total 4 -rw-r--r-- 1 root root 160 Aug 15 16:05 test-1.0.tar.gz
C.做spec文件內(nèi)容如下
16:06:25 # cat test.spec Summary: Test package for dl528888 blog Name: test Version: 1.0 Release: 1 License: GPL Group: test Source: %{name}-1.0.tar.gz BuildRoot:%{_tmppath}/%{name}-%{version}-%{release}-root Url: http://dl528888.blog.51cto.com Packager: dl528888 Prefix: %{_prefix} Prefix: %{_sysconfdir} %define userpath /tmp/demo %description Justa test rpm suite. %prep %setup -c %install install -d $RPM_BUILD_ROOT%{userpath} cp -a %{name}* $RPM_BUILD_ROOT%{userpath} %clean rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_DIR/%{name}-%{version} %files %defattr(-,root,root) %{userpath}
D.打成rpm包
16:06:36 # rpmbuild -ba test.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.8B9UHi + umask 022 + cd /root/rpmbuild/BUILD + cd /root/rpmbuild/BUILD + rm -rf test-1.0 + /bin/mkdir -p test-1.0 + cd test-1.0 + /usr/bin/gzip -dc /root/rpmbuild/SOURCES/test-1.0.tar.gz + /bin/tar -xvvf - drwxr-xr-x root/root 0 2014-08-15 16:05 test-1.0/ -rw-r--r-- root/root 13 2014-08-15 16:05 test-1.0/test.txt + STATUS=0 + '[' 0 -ne 0 ']' + /bin/chmod -Rf a+rX,u+w,g-w,o-w . + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.IwUiMh + umask 022 + cd /root/rpmbuild/BUILD + cd test-1.0 + install -d /root/rpmbuild/BUILDROOT/test-1.0-1.x86_64/tmp/demo + cp -a test-1.0 /root/rpmbuild/BUILDROOT/test-1.0-1.x86_64/tmp/demo + /usr/lib/rpm/brp-compress + /usr/lib/rpm/brp-strip + /usr/lib/rpm/brp-strip-static-archive + /usr/lib/rpm/brp-strip-comment-note Processing files: test-1.0-1.x86_64 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/test-1.0-1.x86_64 warning: Could not canonicalize hostname: ip-10-10-10-10 Wrote: /root/rpmbuild/SRPMS/test-1.0-1.src.rpm Wrote: /root/rpmbuild/RPMS/x86_64/test-1.0-1.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.IoNP7f + umask 022 + cd /root/rpmbuild/BUILD + cd test-1.0 + rm -rf /root/rpmbuild/BUILDROOT/test-1.0-1.x86_64 + rm -rf /root/rpmbuild/BUILD/test-1.0 + exit 0
E.查看rpm包
16:07:24 # cd ~/rpmbuild/RPMS/ root@ip-10-10-10-10:~/rpmbuild/RPMS 16:07:54 # ll total 4 drwxr-xr-x 2 root root 4096 Aug 15 16:07 x86_64 root@ip-10-10-10-10:~/rpmbuild/RPMS 16:07:54 # cd x86_64/ root@ip-10-10-10-10:~/rpmbuild/RPMS/x86_64 16:07:58 # ll total 4 -rw-r--r-- 1 root root 2020 Aug 15 16:07 test-1.0-1.x86_64.rpm root@ip-10-10-10-10:~/rpmbuild/RPMS/x86_64 16:07:59 # rpm -qpi test-1.0-1.x86_64.rpm Name : test Relocations: /usr /etc Version : 1.0 Vendor: (none) Release : 1 Build Date: Fri 15 Aug 2014 04:07:24 PM CST Install Date: (not installed) Build Host: ip-10-10-10-10 Group : test Source RPM: test-1.0-1.src.rpm Size : 13 License: GPL Signature : (none) Packager : dl528888 URL : http://dl528888.blog.51cto.com Summary : Test package for dl528888 blog Description : Justa test rpm suite.
F.安裝此rpm包
16:08:03 # rpm -ivh test-1.0-1.x86_64.rpm Preparing... ########################################### [100%] 1:test ########################################### [100%] root@ip-10-10-10-10:~/rpmbuild/RPMS/x86_64 16:08:49 # ll /tmp/demo/ total 4 drwxr-xr-x 2 root root 4096 Aug 15 16:08 test-1.0 root@ip-10-10-10-10:~/rpmbuild/RPMS/x86_64 16:08:58 # ll /tmp/demo/test-1.0/ total 4 -rw-r--r-- 1 root root 13 Aug 15 16:05 test.txt root@ip-10-10-10-10:~/rpmbuild/RPMS/x86_64 16:09:00 # cat /tmp/demo/test-1.0/test.txt this is test
可以看到安裝完成,并在tmp的demo里解壓了test-1.0.tar.gz壓縮包。
二、使用ruby的fpm構(gòu)建rpm包
1、centos安裝
yum install rpm-build gem install fpm
2、ubuntu安裝
apt-get install ruby ruby-dev rubygems gem install fpm
在centos里安裝如下
15:34:53 # yum install rpm-build Failed to set locale, defaulting to C Loaded plugins: fastestmirror, keys, protectbase Loading mirror speeds from cached hostfile * base: mirrors.btte.net * extras: mirrors.btte.net * updates: mirrors.btte.net 0 packages excluded due to repository protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package rpm-build.x86_64 0:4.8.0-37.el6 will be installed --> Processing Dependency: elfutils >= 0.128 for package: rpm-build-4.8.0-37.el6.x86_64 --> Processing Dependency: xz for package: rpm-build-4.8.0-37.el6.x86_64 --> Processing Dependency: unzip for package: rpm-build-4.8.0-37.el6.x86_64 --> Processing Dependency: lzma for package: rpm-build-4.8.0-37.el6.x86_64 --> Processing Dependency: file for package: rpm-build-4.8.0-37.el6.x86_64 --> Processing Dependency: /usr/bin/gdb-add-index for package: rpm-build-4.8.0-37.el6.x86_64 --> Running transaction check ---> Package elfutils.x86_64 0:0.152-1.el6 will be installed --> Processing Dependency: elfutils-libs(x86-64) = 0.152-1.el6 for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1(ELFUTILS_0.149)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1(ELFUTILS_0.148)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1(ELFUTILS_0.138)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1(ELFUTILS_0.127)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1(ELFUTILS_0.126)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1(ELFUTILS_0.122)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libasm.so.1(ELFUTILS_1.0)(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libdw.so.1()(64bit) for package: elfutils-0.152-1.el6.x86_64 --> Processing Dependency: libasm.so.1()(64bit) for package: elfutils-0.152-1.el6.x86_64 ---> Package file.x86_64 0:5.04-15.el6 will be installed ---> Package gdb.x86_64 0:7.2-60.el6_4.1 will be installed ---> Package unzip.x86_64 0:6.0-1.el6 will be installed ---> Package xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6 will be installed ---> Package xz-lzma-compat.x86_64 0:4.999.9-0.3.beta.20091007git.el6 will be installed --> Running transaction check ---> Package elfutils-libs.x86_64 0:0.152-1.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: rpm-build x86_64 4.8.0-37.el6 base 127 k Installing for dependencies: elfutils x86_64 0.152-1.el6 base 201 k elfutils-libs x86_64 0.152-1.el6 base 181 k file x86_64 5.04-15.el6 base 46 k gdb x86_64 7.2-60.el6_4.1 base 2.3 M unzip x86_64 6.0-1.el6 base 149 k xz x86_64 4.999.9-0.3.beta.20091007git.el6 base 137 k xz-lzma-compat x86_64 4.999.9-0.3.beta.20091007git.el6 base 16 k Transaction Summary =============================================================================================================================================================================================== Install 8 Package(s) Total download size: 3.1 M Installed size: 7.4 M Is this ok [y/N]: y Downloading Packages: (1/8): elfutils-0.152-1.el6.x86_64.rpm | 201 kB 00:00 (2/8): elfutils-libs-0.152-1.el6.x86_64.rpm | 181 kB 00:00 (3/8): file-5.04-15.el6.x86_64.rpm | 46 kB 00:00 (4/8): gdb-7.2-60.el6_4.1.x86_64.rpm | 2.3 MB 00:06 (5/8): rpm-build-4.8.0-37.el6.x86_64.rpm | 127 kB 00:00 (6/8): unzip-6.0-1.el6.x86_64.rpm | 149 kB 00:00 (7/8): xz-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm | 137 kB 00:00 (8/8): xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm | 16 kB 00:00 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 234 kB/s | 3.1 MB 00:13 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : xz-4.999.9-0.3.beta.20091007git.el6.x86_64 1/8 Installing : xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64 2/8 Installing : file-5.04-15.el6.x86_64 3/8 Installing : gdb-7.2-60.el6_4.1.x86_64 4/8 Installing : elfutils-libs-0.152-1.el6.x86_64 5/8 Installing : elfutils-0.152-1.el6.x86_64 6/8 Installing : unzip-6.0-1.el6.x86_64 7/8 Installing : rpm-build-4.8.0-37.el6.x86_64 8/8 Verifying : unzip-6.0-1.el6.x86_64 1/8 Verifying : xz-lzma-compat-4.999.9-0.3.beta.20091007git.el6.x86_64 2/8 Verifying : elfutils-libs-0.152-1.el6.x86_64 3/8 Verifying : gdb-7.2-60.el6_4.1.x86_64 4/8 Verifying : elfutils-0.152-1.el6.x86_64 5/8 Verifying : rpm-build-4.8.0-37.el6.x86_64 6/8 Verifying : file-5.04-15.el6.x86_64 7/8 Verifying : xz-4.999.9-0.3.beta.20091007git.el6.x86_64 8/8 Installed: rpm-build.x86_64 0:4.8.0-37.el6 Dependency Installed: elfutils.x86_64 0:0.152-1.el6 elfutils-libs.x86_64 0:0.152-1.el6 file.x86_64 0:5.04-15.el6 gdb.x86_64 0:7.2-60.el6_4.1 unzip.x86_64 0:6.0-1.el6 xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6 xz-lzma-compat.x86_64 0:4.999.9-0.3.beta.20091007git.el6 Complete! 15:35:21 # gem install fpm /usr/local/ruby-1.9.3/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. Fetching: json-1.8.1.gem (100%) Building native extensions. This could take a while... Fetching: cabin-0.6.1.gem (100%) Fetching: backports-3.6.0.gem (100%) Fetching: arr-pm-0.0.9.gem (100%) Fetching: clamp-0.6.3.gem (100%) Fetching: ffi-1.9.3.gem (100%) Building native extensions. This could take a while... Fetching: childprocess-0.5.3.gem (100%) Fetching: fpm-1.1.0.gem (100%) Successfully installed json-1.8.1 Successfully installed cabin-0.6.1 Successfully installed backports-3.6.0 Successfully installed arr-pm-0.0.9 Successfully installed clamp-0.6.3 Successfully installed ffi-1.9.3 Successfully installed childprocess-0.5.3 Successfully installed fpm-1.1.0 8 gems installed Installing ri documentation for json-1.8.1... Installing ri documentation for cabin-0.6.1... Installing ri documentation for backports-3.6.0... unable to convert U+00E9 from UTF-8 to US-ASCII for lib/backports/force/string_length.rb, skipping unable to convert U+00E9 from UTF-8 to US-ASCII for lib/backports/1.9.2/stdlib/matrix.rb, skipping Installing ri documentation for arr-pm-0.0.9... Installing ri documentation for clamp-0.6.3... Installing ri documentation for ffi-1.9.3... unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/ffi/library.rb, skipping Enclosing class/module 'moduleFFI' for class StructByValue not known Enclosing class/module 'moduleFFI' for class StructLayout not known Enclosing class/module 'rbffi_StructLayoutClass' for class Field not known Enclosing class/module 'rbffi_StructLayoutClass' for class Number not known Enclosing class/module 'rbffi_StructLayoutClass' for class String not known Enclosing class/module 'rbffi_StructLayoutClass' for class Pointer not known Enclosing class/module 'rbffi_StructLayoutClass' for class Function not known Enclosing class/module 'rbffi_StructLayoutClass' for class Array not known Enclosing class/module 'moduleFFI' for module LastError not known Enclosing class/module 'moduleFFI' for class MemoryPointer not known Enclosing class/module 'rbffi_StructLayoutClass' for class CharArray not known Enclosing class/module "rbffi_StructLayoutCharArrayClass" for alias to_str to_s not known unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for ext/ffi_c/libffi/ChangeLog, skipping unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for ext/ffi_c/libffi/README, skipping Installing ri documentation for childprocess-0.5.3... Installing ri documentation for fpm-1.1.0... Installing RDoc documentation for json-1.8.1... Installing RDoc documentation for cabin-0.6.1... Installing RDoc documentation for backports-3.6.0... unable to convert U+00E9 from UTF-8 to US-ASCII for lib/backports/force/string_length.rb, skipping unable to convert U+00E9 from UTF-8 to US-ASCII for lib/backports/1.9.2/stdlib/matrix.rb, skipping Installing RDoc documentation for arr-pm-0.0.9... Installing RDoc documentation for clamp-0.6.3... Installing RDoc documentation for ffi-1.9.3... unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for lib/ffi/library.rb, skipping Enclosing class/module 'moduleFFI' for class StructByValue not known Enclosing class/module 'moduleFFI' for class StructLayout not known Enclosing class/module 'rbffi_StructLayoutClass' for class Field not known Enclosing class/module 'rbffi_StructLayoutClass' for class Number not known Enclosing class/module 'rbffi_StructLayoutClass' for class String not known Enclosing class/module 'rbffi_StructLayoutClass' for class Pointer not known Enclosing class/module 'rbffi_StructLayoutClass' for class Function not known Enclosing class/module 'rbffi_StructLayoutClass' for class Array not known Enclosing class/module 'moduleFFI' for module LastError not known Enclosing class/module 'moduleFFI' for class MemoryPointer not known Enclosing class/module 'rbffi_StructLayoutClass' for class CharArray not known Enclosing class/module "rbffi_StructLayoutCharArrayClass" for alias to_str to_s not known unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for ext/ffi_c/libffi/ChangeLog, skipping unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for ext/ffi_c/libffi/README, skipping Installing RDoc documentation for childprocess-0.5.3... Installing RDoc documentation for fpm-1.1.0... 15:45:31 # find / -name "fpm" /usr/local/ruby-1.9.3/lib/ruby/gems/1.9.1/doc/fpm-1.1.0/rdoc/lib/fpm /usr/local/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/fpm-1.1.0/lib/fpm /usr/local/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/fpm-1.1.0/bin/fpm /usr/local/ruby-1.9.3/bin/fpm /usr/local/php-5.3.10/share/php/fpm root@e3d3e87fbfd7:~ 15:45:46 # ln /usr/local/ruby-1.9.3/bin/fpm /usr/bin/fpm
下面是安裝腳本內(nèi)容
16:10:45# cat install_for_rpm.sh #!/bin/bash mkdir/tmp/fpm echo"this is test for rpm" >/tmp/fpm/test.txt
下面是在進行rpm安裝的時候,安裝后運行的腳本
root@e3d3e87fbfd7:~ 16:10:48# cat run_rpm.sh #!/bin/bash /bin/bash/tmp/install_for_rpm.sh
也就是說,rpm包安裝后,會運行我這個run_rpm.sh腳本,然后這個腳本會運行install_for_fpm.sh腳本
下面是打包過程
root@e3d3e87fbfd7:~ 16:13:21 # fpm -s dir --prefix /tmp/ -t rpm -n test_rpm --verbose --version '2014' --iteration '1.0' --vendor '244979152@qq.com' --category 'Development/test' --description 'Rpm Install' --url 'qq.com' --license 'BSD' -m 'denglei' --after-install run_rpm.sh install_for_rpm.sh /usr/local/ruby-1.9.3/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. Setting from flags: category=Development/test {:level=>:info} Setting from flags: description=Rpm Install {:level=>:info} Setting from flags: epoch= {:level=>:info} Setting from flags: iteration=1.0 {:level=>:info} Setting from flags: license=BSD {:level=>:info} Setting from flags: maintainer=denglei {:level=>:info} Setting from flags: name=test_rpm {:level=>:info} Setting from flags: url=qq.com {:level=>:info} Setting from flags: vendor=244979152@qq.com {:level=>:info} Setting from flags: version=2014 {:level=>:info} Converting dir to rpm {:level=>:info} no value for epoch is set, defaulting to nil {:level=>:warn} Reading template {:path=>"/usr/local/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/fpm-1.1.0/templates/rpm.erb", :level=>:info} no value for epoch is set, defaulting to nil {:level=>:warn} Running rpmbuild {:args=>["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build20140704-5378-1sbkpgd/BUILD", "--define", "_topdir /tmp/package-rpm-build20140704-5378-1sbkpgd", "--define", "_sourcedir /tmp/package-rpm-build20140704-5378-1sbkpgd", "--define", "_rpmdir /tmp/package-rpm-build20140704-5378-1sbkpgd/RPMS", "/tmp/package-rpm-build20140704-5378-1sbkpgd/SPECS/test_rpm.spec"], :level=>:info} Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.w21bbk {:level=>:info} Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.FNduT3 {:level=>:info} Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Cdf5BN {:level=>:info} Processing files: test_rpm-2014-1.0.x86_64 {:level=>:info} Wrote: /tmp/package-rpm-build20140704-5378-1sbkpgd/RPMS/x86_64/test_rpm-2014-1.0.x86_64.rpm {:level=>:info} Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.mv993g {:level=>:info} Created package {:path=>"test_rpm-2014-1.0.x86_64.rpm"} 16:05:47# ll /root/ total8 -rw-r--r--1 root root 74 Jul 4 16:02 install_for_rpm.sh -rw-r--r--1 root root 1709 Jul 4 16:05 test_rpm-2014-1.0.x86_64.rpm
可以看到,有個rpm文件生產(chǎn),名字是test_rpm-2014-1.0.x86_64.rpm
下面安裝rpm的過程
16:14:21# ll /tmp/ total96 lrwxrwxrwx1 root root 30 Jul 3 13:29 MySQL.sock ->/data/mysql/datadir/mysql.sock drwxr-xr-x2 root root 4096 Jul 4 16:12 root -rw-------1 root root 256 Jun 5 10:17 tmp.GbE4cEGjO7 -rw-------1 root root 32379 Jul 3 17:27 yum_save_tx-2014-07-03-17-27UiVNzL.yumtx -rw-------1 root root 27578 Jul 3 17:29 yum_save_tx-2014-07-03-17-29nffpfF.yumtx -rw-------1 root root 27578 Jul 3 17:41 yum_save_tx-2014-07-03-17-41S1tFIE.yumtx
可以看到tmp目錄里沒有fpm目錄,現(xiàn)在開始安裝
root@e3d3e87fbfd7:~ 16:14:24 # rpm -ivh test_rpm-2014-1.0.x86_64.rpm Preparing... ########################################### [100%] 1:test_rpm ########################################### [100%] root@e3d3e87fbfd7:~ 16:14:27 # ll /tmp/ total 104 drwxr-xr-x 2 root root 4096 Jul 4 16:14 fpm -rw-r--r-- 1 root root 74 Jul 4 16:14 install_for_rpm.sh lrwxrwxrwx 1 root root 30 Jul 3 13:29 mysql.sock -> /data/mysql/datadir/mysql.sock drwxr-xr-x 2 root root 4096 Jul 4 16:12 root -rw------- 1 root root 256 Jun 5 10:17 tmp.GbE4cEGjO7 -rw------- 1 root root 32379 Jul 3 17:27 yum_save_tx-2014-07-03-17-27UiVNzL.yumtx -rw------- 1 root root 27578 Jul 3 17:29 yum_save_tx-2014-07-03-17-29nffpfF.yumtx -rw------- 1 root root 27578 Jul 3 17:41 yum_save_tx-2014-07-03-17-41S1tFIE.yumtx root@e3d3e87fbfd7:~ 16:14:29 # ll /tmp/fpm/ total 4 -rw-r--r-- 1 root root 21 Jul 4 16:14 test.txt root@e3d3e87fbfd7:~ 16:15:00 # cat /tmp/fpm/test.txt this is test for rpm
可以看到安裝后,tmp目錄有了fpm目錄,并且這個目錄里有了test.txt文件。
rpm打包完成后,你可以使用ansible或者salt等軟件來進行配置管理,或者你可以自己弄個本地yum源,rpm包放到y(tǒng)um源里讓其他人下載也行,本文沒有介紹太深入知識,只是個普及,所以有那塊不懂的可以自行網(wǎng)上尋找。
網(wǎng)頁名稱:使用spec與fpm2種方式進行rpm打包
文章路徑:http://muchs.cn/article32/piossc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)站設(shè)計公司、外貿(mào)建站、用戶體驗、全網(wǎng)營銷推廣、網(wǎng)站維護
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)