基础包
所有的软件都是有一定的基础包,本文是以telegraf为例,telegraf最新的版本为1.15.X。
需要将rpm/tar.gz 包下载之后,要将文件进行解压,还有根据系统架构选择包。
rpm2cpio telegraf-1.15.2-1.x86_64.rpm | cpio -div
ar p telegraf_1.15.2-1_amd64.deb data.tar.gz | tar zxf -
打包
将解压出来的etc、usr目录,拷贝到/root/xiaoyao/build 目录下,然后使用命令来打包
fpm -f -s dir --log error --vendor InfluxData --url https://github.com/influxdata/telegraf --license MIT --maintainer xiaoyao@yisheng --config-files /etc/telegraf/telegraf.conf --config-files /etc/logrotate.d/telegraf --after-install scripts/post-install.sh --before-install scripts/pre-install.sh --after-remove scripts/post-remove.sh --before-remove scripts/pre-remove.sh --description "Plugin-driven server agent for reporting metrics into InfluxDB." --name telegraf -a amd64 -t rpm --version 1.15 --iteration 20200827 -C ./build -p . --depends coreutils --depends shadow-utils
使用-C 来指定要以那个目录为主目录,然后进行打包,--config-filre 指定配置文件,
--after-install 在安装之后需要执行的文件:初始化操作
--before-install 在安装之前执行的文件:检查服务是否已经安装,配置文件是否已经存在等操作
--after-remove 在卸载软件之后执行的文件:将相关以来进行删除
--before-remove 在卸载软件之前执行的文件:将服务停止,然后在执行卸载操作
网友评论