0、安装rpmbuild工具包
yum -y install rpm-build rpm-devel rpmdevtools mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
1、创建原始文件
mkdir /root/rpmbuild/SOURCES/eee-1.0
2、创建需要打包的文件
3、在SOURCES目录下打包文件
tar cvf eee-1.0.tar.gz eee-1.0
4、构建RPM中的spec配置文件
Name: eee Version: 1.0 Release: 1%{?dist} Summary: eee Group: Development/Tools License: GPL #URL: Source0: %{name}-%{version}.tar.gz #BuildRequires: #Requires: %description %prep %setup -q %build %install mkdir -p $RPM_BUILD_ROOT/home/view/ cp $RPM_BUILD_DIR/%{name}-%{version}/* $RPM_BUILD_ROOT/home/view/ %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc /home/view/* %changelog
5、执行命令rpmbuild -ba eee.spec生成RPM安装包
6、进行安装RPM包 rpm -ivh /root/rpmbuild/RPMS/x86_64/eee-1.0-1.el7.x86_64.rpm