1.安装ruby环境ruby
[root@oldboy /]# yum install -y ruby ruby-devel rubygems
gem install fpm gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/ gem sources -l gem install fpm fpm -s dir -t rpm -n cosmo -v 8.0 1.txt 补充:若是遇到这样的报错 Need executable 'rpmbuild' to convert dir to rpm {:level=>:error} 通常是由于须要你安装rpmbuild yum -y install rpm-build fpm -s dir -t rpm -n cosmo -v 8.0 1.txt