centos7使用checkinstall制作RPM包

checkinstall可以很方便的使用源码包构建RPM包和DEB包
更多请参考参考http://linux.cn/article-4090-1.html

一.在centos7上安装checkinstall和构建RPM包的方法
    下载checkinstall,centos7源里没有这个包,centos6上的checkinstall包也能很好的运行在centos7上
      wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/ikoinoba/CentOS_CentOS-6/x86_64/checkinstall-1.6.2-3.el6.1.x86_64.rpm
    安装checkinstall
      yum install checkinstall-1.6.2-3.el6.1.x86_64.rpm

二.构建RPM包的语法
    ./configure
    make
    checkinstall 将编译安装的最后一布make install换成了checkinstall
   
三.使用checkinstall构建RPM包的一个实例(以ms-sys-2.4.0-1为例)
    1.复制源码包到/usr/local/src上
      cp ms-sys-2.4.0-1.tar.gz /usr/local/src
    2.进入/usr/local/src目录
      cd /usr/local/src
    3.解压tar包
      tar -zxvf ms-sys-2.4.0-1.tar.gz
    4.进入ms-sys-2.4.0-1目录
      cd ms-sys-2.4.0-1
    5.编译安装并构建自己电脑平台的RPM包(ms-sys-2.4.0-1含有makefile文件不需要./configure步骤)
      make
      checkinstall
   6." Should I create a default set of package docs?(我会创建一个默认设置的包文件?)",回答"Y":
      checkinstall 1.6.2, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
      本软件以 GNU GPL 版权协议颁布


      The package documentation directory ./doc-pak does not exist.
      Should I create a default set of package docs?  [y]: y
    7.回答"Y"之后,会出现以下信息,我们可以对要编译安装构建RPM包的软件写一个文档介绍
    你可以输入一个包的简短描述,然后按两次回车:
      准备软件包的文档……OK

      请为这个软件包写一个描述。
      用一个空行或 EOF 来结束你的描述。
      >> ms-syss-2.4.0 of microsoft
      >> EOF
      >>
    8.输入一个数字以修改下面的任何值或ENTER继续:
      软件包将用下面的值来创建:

      1 -  Summary: [ ms-sys-2.4.0-1 of microsoft ]
      2 -  Name:    [ ms-sys ]
      3 -  Version: [ 2.4.0 ]
      4 -  Release: [ 1 ]
      5 -  License: [ GPL ]
      6 -  Group:   [ Applications/System ]
      7 -  Architecture: [ x86_64 ]
      8 -  Source location: [ ms-sys-2.4.0 ]
      9 -  Alternate source location: [  ]
      10 - Requires: [  ]
      11 - Provides: [ ms-sys ]

      输入一个数字来改变它们,或按回车键继续:
    9.然后checkinstall将自动地创建一个.rpm或者.deb包,根据你的linux系统是什么:
    在CentOS7:
      **********************************************************************

      Done. The new package has been installed and saved to

      /root/rpmbuild/RPMS/x86_64/ms-sys-2.4.0-1.x86_64.rpm

      You can remove it from your system anytime using:

    rpm -e ms-sys-2.4.0-1

      **********************************************************************
    10.输入“ms-sys”命令测试是否可用
      Usage:
        ms-sys [options] [device]
      Options:
  -1, --fat12     Write a FAT12 floppy boot record to device
  -2, --fat32nt   Write a FAT32 partition NT boot record to device
  -3, --fat32     Write a FAT32 partition DOS boot record to device
  -4, --fat32free Write a FAT32 partition FreeDOS boot record to device
  -5, --fat16free Write a FAT16 partition FreeDOS boot record to device
  -6, --fat16     Write a FAT16 partition DOS boot record to device
  -n, --ntfs      Write a NTFS partition Windows 7 boot record to device
  -l, --wipelabel Reset partition disk label in boot record
  -p, --partition Write partition info (hidden sectors, heads and drive id)
  to boot record
  -H, --heads <n> Manually set number of heads if partition info is written
  -7, --mbr7      Write a Windows 7 MBR to device
  -i, --mbrvista  Write a Windows Vista MBR to device
  -m, --mbr       Write a Windows 2000/XP/2003 MBR to device
  -9, --mbr95b    Write a Windows 95B/98/98SE/ME MBR to device
  -d, --mbrdos    Write a DOS/Windows NT MBR to device
  -s, --mbrsyslinux    Write a syslinux MBR to device
  -t, --mbrgptsyslinux Write a syslinux GPT MBR to device
  -z, --mbrzero   Write an empty (zeroed) MBR to device
  -f, --force     Force writing of boot record
  -h, --help      Display this help and exit
  -v, --version   Show program version
  -w, --write     Write automatically selected boot record to device

  Default         Inspect current boot record

      Warning: Writing the wrong kind of boot record to a device might
      destroy partition information or file system!
    11.卸载安装的ms-sys-2.4.0-1
      rpm -e ms-sys-2.4.0-1
    12.查看构建的RPM包
      cd /root/rpmbuild/RPMS/x86_64
      ls
      结果为
      ms-sys-2.4.0-1.x86_64.rpm
      然后就可以把这个rpm包复制到别的centos7系统上使用了
     

   

猜你喜欢

转载自jisonami.iteye.com/blog/2293599