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