亲,以下就是关于(Linux系统下使用FPM制作RPM的详细操作方法(图)),由“路由器之家”整理!
原标题:"Linux系统下使用FPM制作RPM的详细操作方法"相关电脑问题教程分享。 – 来源:路由器之家。
众所周知,Linux系统下想要制作RPM包,就必须使用FPM工具来完成。而FPM工具不仅能让RPM包制作变得更简单,还能帮助用户做一些收尾的工作。下面就来介绍一下Linux系统下使用FPM制作RPM的详细操作方法。
Linux系统
这里涉及的参数是:
–pre-install FILE:表示安装之前所要运行的脚本
–post-install FILE:表示安装之后所要运行的脚本
–pre-uninstall FILE:表示卸载之前所要运行的脚本
–post-uninstall FILE:表示卸载之后所要运行的脚本
1、fpm工具安装
# yum -y install ruby rubygems ruby-devel rpm-build
# gem sources -a http://ruby.taobao.org/
# gem sources -r https://rubygems.org/
# gem install fpm
2、打包luajit
# mkdir /tmp/luajit
# cd /usr/local/src
# wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
# tar xvzf LuaJIT-2.0.4.tar.gz
# cd LuaJIT-2.0.4
# make PREFIX=/usr
# make install PREFIX=/usr DESTDIR=/tmp/luajit
# fpm -s dir -t rpm -n LuaJIT -v 2.0.4 –iteration 1.el7 -C /tmp/luajit/ -p /root –description ‘luajit rpm package’ –url ‘http://luajit.org’
[page]
3、打包tengine
# mkdir /tmp/tengine
# cd /usr/local/src
# wget -O lua-nginx-module-0.9.16.tar.gz https://codeload.github.com/openresty/lua-nginx-module/tar.gz/v0.9.16
# tar xvzf lua-nginx-module-0.9.16.tar.gz
# wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz
# tar xvzf tengine-2.1.0.tar.gz
# cd tengine-2.1.0
# 。/configure –prefix=/opt/share/nginx \
–sbin-path=/opt/sbin/nginx \
–conf-path=/opt/etc/nginx/nginx.conf \
–error-log-path=/opt/log/nginx/error.log \
–http-log-path=/opt/log/nginx/access.log \
–user=nginx \
–group=nginx \
–http-client-body-temp-path=/opt/lib/nginx/tmp/client_body \
–http-proxy-temp-path=/opt/lib/nginx/tmp/proxy \
–http-uwsgi-temp-path=/opt/lib/nginx/tmp/uwsgi \
–pid-path=/opt/run/nginx.pid \
–lock-path=/opt/lock/subsys/nginx \
–with-http_ssl_module \
–with-http_realip_module \
–with-http_addition_module \
–with-http_gzip_static_module \
–with-http_gunzip_module \
–with-http_secure_link_module \
–with-http_stub_status_module \
–with-http_sysguard_module \
–with-file-aio \
–add-module=。。/lua-nginx-module-0.9.16 \
–with-cc-opt=‘-g -O2 -fstack-protector –param=ssp-buffer-size=4 -Wformat -Werror=format-security’ \
–with-ld-opt=‘-Wl,-Bsymbolic-functions -Wl,-z,relro’
# make
# make install DESTDIR=/tmp/tengine
# cd /tmp/tengine/opt
# mkdir -p lib/nginx/tmp/{client_body,proxy,uwsgi}
# mkdir -p lock/subsys/nginx
# cd /tmp/tengine
# mkdir etc/rc.d/init.d
# cp /etc/rc.d/init.d/nginx etc/rc.d/init.d
# mkdir etc/logrotate.d
# cp /etc/logrotate.d/nginx etc/logrotate.d
# mkdir tmp
安装之前所要运行的脚本
# vim tmp/install_before.sh
#!/bin/bash
[[ -n `ps aux|grep ngin[x]` ]] && killall -9 nginx
[[ -e /opt/etc/nginx ]] && cp -a /opt/etc/nginx/ /opt/etc/nginx_$(date +%F_%H-%M-%S)
[page]
安装之后所要运行的脚本
# vim tmp/install_after.sh
#!/bin/bash
[[ -n `getent group nginx` ]] || groupadd -r nginx
[[ -n `getent passwd nginx` ]] || useradd nginx -r -g nginx -s /sbin/nologin
[[ -n `getent group www-data` ]] || groupadd -r www-data
[[ -n `getent passwd www-data` ]] || useradd www-data -r -g www-data -s /sbin/nologin
mkdir -p /data/log/nginx
if [[ -e /var/log/nginx ]]; then
if [[ -L /var/log/nginx ]]; then
rm -f /var/log/nginx && ln -s /data/log/nginx /var/log/nginx
else
mv /var/log/nginx/* /data/log/nginx/
rm -rf /var/log/nginx && ln -s /data/log/nginx /var/log/nginx
fi
else
ln -s /data/log/nginx /var/log/nginx
fi
/opt/sbin/nginx -c /opt/etc/nginx/nginx.conf
打包tengine
# chmod +x tmp/*.sh
# fpm -s dir -t rpm -n tengine -v 2.1.0 –iteration 1.waf.el7 -C /tmp/tengine/ -p /root –description ‘tengine rpm package’ –url ‘http://tengine.taobao.org’ –pre-install /tmp/tengine/tmp/install_before.sh –post-install /tmp/tengine/tmp/install_after.sh
rpm软件包信息查看
# rpm -qp –scripts /root/tengine-2.1.0-1.waf.ele.el7.x86_64.rpm
最终的安装步骤
# yum -y install pcre pcre-devel openssl openssl-devel
# rpm -Uvh LuaJIT-2.0.4-1.el7.x86_64.rpm
# rpm -Uvh tengine-2.1.0-1.waf.el7.x86_64.rpm
以上就是Linux系统下使用FPM制作RPM的详细操作方法
以上就是关于-常见问题-(Linux系统下使用FPM制作RPM的详细操作方法(图))的教程!
本文来自投稿,不代表路由百科立场,如若转载,请注明出处:https://www.qh4321.com/115445.html