Forked from joseb0rges/Creating Nginx RPM Package with Status Modules.md
Created
November 2, 2023 09:15
-
-
Save welldevops/f9ad7e12bfe66fcc307eb6289a35afeb to your computer and use it in GitHub Desktop.
Revisions
-
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -155,8 +155,10 @@ tar -xzf %SOURCE16 **4 - Step** ***Enter the path to where the modules will be compiled*** ``` %files %defattr(-,root,root) #Modules %{_libdir}/nginx/modules ``` -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -187,7 +187,7 @@ Updating / installing... Thanks for using nginx! ```  -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -187,7 +187,7 @@ Updating / installing... Thanks for using nginx! ```  -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -187,7 +187,7 @@ Updating / installing... Thanks for using nginx! ```  -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -176,6 +176,7 @@ Executando (%clean): /bin/sh -e /var/tmp/rpm-tmp.3LJguv + exit 0 ``` **6 - Step** ***Test*** ``` shell> rpm -ivh nginx-1.14.0-1.el7_4.ngx.x86_64.rpm @@ -186,7 +187,7 @@ Updating / installing... Thanks for using nginx! ```  -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 12 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -175,6 +175,18 @@ Executando (%clean): /bin/sh -e /var/tmp/rpm-tmp.3LJguv + /usr/bin/rm -rf /home/rpmbuilder/rpmbuild/BUILDROOT/nginx-1.14.0-1.el7_4.ngx.x86_64 + exit 0 ``` **6 - Step** ***Test*** ``` shell> rpm -ivh nginx-1.14.0-1.el7_4.ngx.x86_64.rpm Preparando... ################################# [100%] Updating / installing... 1:nginx-1:1.14.0-1.el7_4.ngx ################################# [100%] ---------------------------------------------------------------------- Thanks for using nginx! ``` -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Creating Nginx RPM Package with Status Modules **# - Dependencies** ``` @@ -14,7 +14,7 @@ useradd -m rpmbuilder ``` http://nginx.org/packages/centos/7/SRPMS/ ``` *Obs = Version used in this lab was 1.14.0 **Modulos** -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel geoip-devel useradd -m rpmbuilder ``` **# - Download Packages** ***Source RPM*** ``` http://nginx.org/packages/centos/7/SRPMS/ @@ -17,19 +18,19 @@ http://nginx.org/packages/centos/7/SRPMS/ **Modulos** ***# - nginx-module-vts*** ``` git clone git://github.com/vozlt/nginx-module-vts.git ``` ***# - nginx-module-sts*** ``` git clone git://github.com/vozlt/nginx-module-sts.git ``` ***# - nginx-module-stream-sts*** ``` git clone git://github.com/vozlt/nginx-module-stream-sts.git ``` **# - Install the downloaded package** ``` rpm -Uvh nginx-versão_baixada.ngx.src.rpm ``` -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,6 +58,7 @@ vim nginx.spec ``` **1 - Step** ***Add the modules in% define BASE_CONFIGURE_ARGS*** ``` --add-dynamic-module=nginx-module-vts \ @@ -151,13 +152,15 @@ tar -xzf %SOURCE15 tar -xzf %SOURCE16 ``` **4 - Step** ***Enter the path to where the modules will be compiled*** ``` #Modules %{_libdir}/nginx/modules ``` **5 - Step** ***Save the file and run rpmbuild*** ``` rpmbuild -ba ~/rpmbuild/SPECS/nginx.spec -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 17 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,20 +4,20 @@ ``` yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel geoip-devel rpm-build ``` **# - Creating user to perform this process, as the same is not recommended with root user:** ``` useradd -m rpmbuilder ``` **# - Download Packages** ***Source RPM*** ``` http://nginx.org/packages/centos/7/SRPMS/ ``` *Obs = Versão usada nesse lab foi a 1.14.0* **Modulos** **# - nginx-module-vts** ``` git clone git://github.com/vozlt/nginx-module-vts.git ``` @@ -34,31 +34,31 @@ http://nginx.org/packages/centos/7/SRPMS/ rpm -Uvh nginx-versão_baixada.ngx.src.rpm ``` ***Move the rpmbuild generated and the modules downloaded in your home, to the home of the user who will execute the process, and then assign permission to it:*** ``` mv /root/rpmbuild /home/rpmbuilder/ && chown -R rpmbuilder. /home/rpmbuilder/rpmbuild mv nginx-* /home/rpmbuilder/rpmbuild/SOURCES ``` **Compact the modules** ``` tar -czvf nginx-module-sts.tar.gz nginx-module-sts tar -czvf nginx-module-stream-sts.tar.gz nginx-module-stream-sts tar -czvf nginx-module-vts.tar.gz nginx-module-vts ``` **Remove the folders from the modules and leave only the compressed files** ``` rm -rf nginx-module-sts rm -rf nginx-module-stream-sts rm -rf nginx-module-vts ``` **Access the SPECS directory and edit the nginx.spec file** ``` vim nginx.spec ``` **1 - Step** ***Add the modules in% define BASE_CONFIGURE_ARGS*** ``` --add-dynamic-module=nginx-module-vts \ --add-dynamic-module=nginx-module-sts \ @@ -112,7 +112,7 @@ vim nginx.spec ``` **2 - Step** ***Declare the modules to be compiled in Source*** ``` Source14: nginx-module-vts.tar.gz Source15: nginx-module-sts.tar.gz @@ -141,7 +141,7 @@ License: 2-clause BSD-like license **3 - Step** ***Add tar commands to unzip the modules as follows:*** ``` %prep %setup -q @@ -151,17 +151,18 @@ tar -xzf %SOURCE15 tar -xzf %SOURCE16 ``` **4 - Step** ***Enter the path to where the modules will be compiled*** ``` #Modules %{_libdir}/nginx/modules ``` **5 - Step** ***Save the file and run rpmbuild*** ``` rpmbuild -ba ~/rpmbuild/SPECS/nginx.spec ``` ***Wait for the following result*** ``` Executando (%clean): /bin/sh -e /var/tmp/rpm-tmp.3LJguv + umask 022 -
joseb0rges renamed this gist
May 29, 2018 . 1 changed file with 68 additions and 56 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,65 +1,72 @@ **Creating Nginx RPM Package with Status Modules** **# - Dependencies** ``` yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel geoip-devel rpm-build ``` **# Creating user to perform this process, as the same is not recommended with root user:** ``` useradd -m rpmbuilder ``` **# - Download Packages** **#Source RPM** ``` http://nginx.org/packages/centos/7/SRPMS/ ``` *Obs = Versão usada nesse lab foi a 1.14.0 **#Modulos** # - nginx-module-vts ``` git clone git://github.com/vozlt/nginx-module-vts.git ``` **# - nginx-module-sts** ``` git clone git://github.com/vozlt/nginx-module-sts.git ``` **# - nginx-module-stream-sts** ``` git clone git://github.com/vozlt/nginx-module-stream-sts.git ``` **#Install the downloaded package** ``` rpm -Uvh nginx-versão_baixada.ngx.src.rpm ``` **#Move the rpmbuild generated and the modules downloaded in your home, to the home of the user who will execute the process, and then assign permission to it:** ``` mv /root/rpmbuild /home/rpmbuilder/ && chown -R rpmbuilder. /home/rpmbuilder/rpmbuild mv nginx-* /home/rpmbuilder/rpmbuild/SOURCES ``` **#Compact the modules** ``` tar -czvf nginx-module-sts.tar.gz nginx-module-sts tar -czvf nginx-module-stream-sts.tar.gz nginx-module-stream-sts tar -czvf nginx-module-vts.tar.gz nginx-module-vts ``` **#Remove the folders from the modules and leave only the compressed files** ``` rm -rf nginx-module-sts rm -rf nginx-module-stream-sts rm -rf nginx-module-vts ``` **#Access the SPECS directory and edit the nginx.spec file** ``` vim nginx.spec ``` **1 - Step** **#Add the modules in% define BASE_CONFIGURE_ARGS** ``` --add-dynamic-module=nginx-module-vts \ --add-dynamic-module=nginx-module-sts \ --add-module=nginx-module-stream-sts ``` ***#-----------------------------------Complete declaration -------------------------------*** ``` %define BASE_CONFIGURE_ARGS $(echo "--prefix=%{_sysconfdir}/nginx \ --sbin-path=%{_sbindir}/nginx \ --modules-path=%{_libdir}/nginx/modules \ @@ -102,15 +109,17 @@ vim nginx.spec --add-dynamic-module=nginx-module-vts \ --add-dynamic-module=nginx-module-sts \ --add-module=nginx-module-stream-sts") ``` **2 - Step** **#Declare the modules to be compiled in Source** ``` Source14: nginx-module-vts.tar.gz Source15: nginx-module-sts.tar.gz Source16: nginx-module-stream-sts.tar.gz ``` ***#-----------------------------------Complete declaration-------------------------------*** ``` Source0: http://nginx.org/download/%{name}-%{version}.tar.gz Source1: logrotate Source2: nginx.init.in @@ -128,36 +137,39 @@ Source14: nginx-module-vts.tar.gz Source15: nginx-module-sts.tar.gz Source16: nginx-module-stream-sts.tar.gz License: 2-clause BSD-like license ``` **3 - Step** **#Add tar commands to unzip the modules as follows:** ``` %prep %setup -q tar -xzf %SOURCE14 tar -xzf %SOURCE15 tar -xzf %SOURCE16 ``` **4 - Step** **#Enter the path to where the modules will be compiled #Modules ``` %{_libdir}/nginx/modules ``` **5 - Step** **#Save the file and run rpmbuild** ``` rpmbuild -ba ~/rpmbuild/SPECS/nginx.spec ``` **#Wait for the following result** ``` Executando (%clean): /bin/sh -e /var/tmp/rpm-tmp.3LJguv + umask 022 + cd /home/rpmbuilder/rpmbuild/BUILD + cd nginx-1.14.0 + /usr/bin/rm -rf /home/rpmbuilder/rpmbuild/BUILDROOT/nginx-1.14.0-1.el7_4.ngx.x86_64 + exit 0 ``` -
joseb0rges revised this gist
May 29, 2018 . 1 changed file with 178 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,178 @@ Pre requisitos #Instale o rpmbuilder yum install rpm-build criando usuario para realizar este processo, pois o mesmo não recomendado com usuario root: useradd -m rpmbuilder Baixar o pacotes: #Source RPM http://nginx.org/packages/centos/7/SRPMS/ Obs = Versão usada nesse lab foi a 1.14.0 #Modulos # - nginx-module-vts git clone git://github.com/vozlt/nginx-module-vts.git # - nginx-module-sts git clone git://github.com/vozlt/nginx-module-sts.git # - nginx-module-stream-sts git clone git://github.com/vozlt/nginx-module-stream-sts.git #Instale o pacote baixado rpm -Uvh nginx-versão_baixada.ngx.src.rpm #Mova o rpmbuild gerado e os modulos baixados em seu home, para o home do usuario que irá executar o processo, e em seguida atribua permisão ao mesmo: mv /root/rpmbuild /home/rpmbuilder/ && chown -R rpmbuilder. /home/rpmbuilder/rpmbuild mv nginx-* /home/rpmbuilder/rpmbuild/SOURCES #Compacte os modulos tar -czvf nginx-module-sts.tar.gz nginx-module-sts tar -czvf nginx-module-stream-sts.tar.gz nginx-module-stream-sts tar -czvf nginx-module-vts.tar.gz nginx-module-vts #Remova as pastas dos modulos e deixe somente os arquivos compactados rm -rf nginx-module-sts rm -rf nginx-module-stream-sts rm -rf nginx-module-vts #Acesse o diretorio SPECS e edite o arquivo nginx.spec vim nginx.spec 1 - Passo #Adicione os modulos em %define BASE_CONFIGURE_ARGS --add-dynamic-module=nginx-module-vts \ --add-dynamic-module=nginx-module-sts \ --add-module=nginx-module-stream-sts #-----------------------------------Declação completa ------------------------------- %define BASE_CONFIGURE_ARGS $(echo "--prefix=%{_sysconfdir}/nginx \ --sbin-path=%{_sbindir}/nginx \ --modules-path=%{_libdir}/nginx/modules \ --conf-path=%{_sysconfdir}/nginx/nginx.conf \ --error-log-path=%{_localstatedir}/log/nginx/error.log \ --http-log-path=%{_localstatedir}/log/nginx/access.log \ --pid-path=%{_localstatedir}/run/nginx.pid \ --lock-path=%{_localstatedir}/run/nginx.lock \ --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp \ --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp \ --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp \ --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp \ --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp \ --user=%{nginx_user} \ --group=%{nginx_group} \ --with-compat \ --with-file-aio \ --with-threads \ --with-http_addition_module \ --with-http_auth_request_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_mp4_module \ --with-http_random_index_module \ --with-http_realip_module \ --with-http_secure_link_module \ --with-http_slice_module \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_v2_module \ --with-mail \ --with-mail_ssl_module \ --with-stream \ --with-stream_realip_module \ --with-stream_ssl_module \ --with-stream_ssl_preread_module \ --add-dynamic-module=nginx-module-vts \ --add-dynamic-module=nginx-module-sts \ --add-module=nginx-module-stream-sts") 2 - Passo #Declare os modulos a serem compilados no Source Source14: nginx-module-vts.tar.gz Source15: nginx-module-sts.tar.gz Source16: nginx-module-stream-sts.tar.gz #-----------------------------------Declação completa ------------------------------- Source0: http://nginx.org/download/%{name}-%{version}.tar.gz Source1: logrotate Source2: nginx.init.in Source3: nginx.sysconf Source4: nginx.conf Source5: nginx.vh.default.conf Source7: nginx-debug.sysconf Source8: nginx.service Source9: nginx.upgrade.sh Source10: nginx.suse.logrotate Source11: nginx-debug.service Source12: COPYRIGHT Source13: nginx.check-reload.sh Source14: nginx-module-vts.tar.gz Source15: nginx-module-sts.tar.gz Source16: nginx-module-stream-sts.tar.gz License: 2-clause BSD-like license 3 - Passo #Adicione comandos tar para que seja descompactados o modulos da seguinte forma: %prep %setup -q tar -xzf %SOURCE14 tar -xzf %SOURCE15 tar -xzf %SOURCE16 4 - Passo #Informe o caminho para onde os modulos seram compilados #Modulos %{_libdir}/nginx/modules 5 - Passo #Salve o arquivo e rode o rpmbuild rpmbuild -ba ~/rpmbuild/SPECS/nginx.spec #Espere o seguinte resultado Executando (%clean): /bin/sh -e /var/tmp/rpm-tmp.3LJguv + umask 022 + cd /home/rpmbuilder/rpmbuild/BUILD + cd nginx-1.14.0 + /usr/bin/rm -rf /home/rpmbuilder/rpmbuild/BUILDROOT/nginx-1.14.0-1.el7_4.ngx.x86_64 + exit 0 -
joseb0rges created this gist
May 29, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ ok