Linux   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了基于FPM制作RPM包大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

1、搭建Epel  Yum源 安装在线yum源 [[email protected] ~]# rpm -ivh epel-release-latest-7.noarch.rpm //安装扩展源 [[email protected] yum.repos.d]# ls a epel-release-latest-7.noarch.rpm epel-tesTing.repo Cent

1、搭建Epel  Yum源

安装在线yum源

[[email protected] ~]# rpm -ivh epel-release-latest-7.noarch.rpm      //安装扩展源
[[email protected] yum.repos.d]# ls
a  epel-release-latest-7.noarch.rpm  epel-tesTing.repo  Centos-7.repo  epel.repo

  [[email protected] ~]# ls /etc/yum.repos.d/

  BACkup  CentOS-Base.repo  CentOS-Media.repo  epel.repo  epel-tesTing.repo

   

  [[email protected] yum.repos.d]# yum clean all && yum makecache  //清除并新建yum缓存

2、安装ruby环境和gem命令(gem命令是从rubygem仓库安装软件,类似yum从yum仓库安装软件)

安装软件包,安装时要出现3个安装的软件
[[email protected] yum.repos.d]# yum -y install ruby rubygems ruby-devel

[@L_673_5@ ~]# gem update --system      //升级rubygems版本
[[email protected] ~]# gem install rubygems-update -v 2.3.0    //安装新版本
[[email protected] ~]# gem update --system    //升级

[[email protected] ~]# gem sources -a http://@H_704_26@mirrors.aliyun.com/rubygems/  //添加国内源
[[email protected] ~]# gem sources --remove https://rubygems.org/        //移除国外源
[[email protected] ~]# gem sources -l     //查看当前源

[[email protected] ~]# gem install fpm     //安装fpm工具

3、编译Nginx,在保证Nginx安装完的基础上打包,查看Nginx的80端口

[[email protected] ~]# netstat -anpt | grep :80    //查询Nginx的接口

4、打包Nginx生成rpm包

脚本
[[email protected] ~]# vim Nginx.sh
#!/bin/bash

useradd -M -s /sbin/nologin Nginx        //创建用户
ln -s /usr/local/Nginx/sbin/Nginx/ /sbin     //设置软连接
echo www.crushlinux.com > /usr/local/Nginx/html/index.html   //在网页文件中写入测试内容
/usr/local/Nginx/sbin/Nginx         //开启Nginx

打包时报错,修改

[[email protected] ~]# fpm -s dir -t rpm -n Nginx -v 1.16.1 -d pcre-devel,zlib-devel -f --post-install /root/Nginx.sh /usr/local/Nginx/
报错信息
Need executable rpmbuild to convert dir to rpm {:level=>:error}

修改
[[email protected] ~]# yum list | grep build
[[email protected] ~]# yum -y install rpm-build
[[email protected] ~]# fpm -s dir -t rpm -n Nginx -v 1.16.1 -d pcre-devel,zlib-devel -f --post-install /root/Nginx.sh /usr/local/Nginx/
打包成功,在当前目录下生成一个rpm包
Created package {:path=>"Nginx-1.16.1-1.x86_64.rpm"}

5、安装自己制作的软件包,并查看端口

[[email protected] ~]# rpm -ivh Nginx-1.16.1-1.x86_64.rpm    //安装自己制作的包
[[email protected] ~]# netstat -anpt | grep 80     //查看端口

大佬总结

以上是大佬教程为你收集整理的基于FPM制作RPM包全部内容,希望文章能够帮你解决基于FPM制作RPM包所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。