In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces in detail "Centos customized rpm package, the method of building yum warehouse", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "Centos customized rpm package, the method of building yum warehouse" can help you solve your doubts.
1 keep the rpm package downloaded when yum installs the software
Just modify the yum configuration file. Downloaded rpm packages are automatically saved in the / var/cache/yum/ directory
[root@swag ~] # sed-I's keepcache0 keepcache1 etc/yum.conf [root@swag] # yum install sl- y [root@swag ~] # tree / var/cache/yum/x86_64/6/epel//var/cache/yum/x86_64/6/epel/ ├── 83f14a3d88054141092be5da12eb18cb1baabd7d52e1ae38bfc98d3d5005490c-primary.sqlite ├── cachecookie ├── packages │ sl-5.02-1.el6.x86_64.rpm └── repomd.xml1 directory, 4 files
2 compile and install nginx
# download tar.gz packagecd / home/oldboy/toolswget-Q http://nginx.org/download/nginx-1.6.3.tar.gz# yum install dependent packageyum install openssl openssl-devel-yyum install pcre pcre-devel-yrpm-qa pcre pcre-devel# useradd wwwuseradd www-s / sbin/nologin-m # compile and installtar-xf nginx-1.6.3.tar.gzcd nginx-1.6.3./configure-- user=www-- group=www-- with-http_ssl_module-- with-http_ Stub_status_module-- prefix=/application/nginx-1.6.3/make & & make install# create a soft linkln-s / application/nginx-1.6.3/ / application/nginx# start nginx/application/nginx/sbin/nginx# check port 80lsof-I: 80
3 install the fpm tool
Install the dependency package first
Yum-y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
The download ruby,fpm is written by ruby, so the system environment requires ruby. It is not recommended to install ruby in yum, there will be some problems during testing.
[root@swag tools] # wget https://ruby.taobao.org/mirrors/ruby/ruby-2.3.0.tar.gz[root@swag tools] # tar-xf ruby-2.3.0.tar.gz [root@swag tools] # cd ruby-2.3.0 [root@swag ruby-2.3.0] #. / configure [root@swag ruby-2.3.0] # make & & make install [root@swag ruby-2.3.0] # ruby- vruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] [root@swag ~] # whereis gemgem: / usr/local/bin/gem [root@swag ~] # / usr/local/bin/gem install fpm [root@swag ~] # fpm-v1.9.adding Aliyun's rubygems warehouse The default source is a foreign source, and the access and download speed is relatively slow. Before adding, remove the native ruby repository [root@swag] # gem sources*** current sources*** https://rubygems.org/ [root@swag ~] # gem sources-- remove https://rubygems.org/https://rubygems.org/ removed from sources# and add Ali warehouse [root@swag] # gem sources-a http://mirrors.aliyun.com/rubygems/http://mirrors.aliyun.com/rubygems/ added to sources [root@ Swag ~] # gem sources*** current sources***
Common parameters of fpm
-s: specify the source type
-t: specify the target type, that is, why you want to make the package
-n: specify the name of the package
-v: specify the version number of the package
-c: specify the relative path of packaging
-d: specify which packages to depend on
-f: if an installation package with the same name exists in the directory during the second package, overwrite it
-p: the directory of the output installation package. If you don't want to put it in the current directory, you need to specify it.
-- post-install: the script to be run after the package is installed; same as-- offer-install
-- pre-install: the script to be run before the package is installed; same as-- before-install
-- post-uninstall: the script to be run after the package has been uninstalled; same as-- offer-remove
-- pre-uninstall: the script to run before the package is uninstalled; same as-before-remove
Source type packages supported by fpm
Dir: packages the directory into the desired type, which can be used for source code compilation and installation software packages
Rpm: converting rpm
Gem: converting rubygem packages
Python: package the python module into the appropriate type
Target type packages supported by fpm
Rpm: converting to rpm package
Deb: converting to deb package
Solaris: converting to solaris package
Puppet: converting to puppet package
4 package nginx
[root@swag tools] # wget https://ruby.taobao.org/mirrors/ruby/ruby-2.3.0.tar.gz[root@swag tools] # tar-xf ruby-2.3.0.tar.gz [root@swag tools] # cd ruby-2.3.0 [root@swag ruby-2.3.0] #. / configure [root@swag ruby-2.3.0] # make & & make install [root@swag ruby-2.3.0] # ruby- vruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] [root@swag ~] # whereis gemgem: / usr/local/bin/gem [root@swag ~] # / usr/local/bin/gem install fpm [root@swag ~] # fpm-v1.9.adding Aliyun's rubygems warehouse The default source is a foreign source, and the access and download speed is relatively slow. Before adding, remove the native ruby repository [root@swag] # gem sources*** current sources*** https://rubygems.org/ [root@swag ~] # gem sources-- remove https://rubygems.org/https://rubygems.org/ removed from sources# and add Ali warehouse [root@swag] # gem sources-a http://mirrors.aliyun.com/rubygems/http://mirrors.aliyun.com/rubygems/ added to sources [root@ Swag ~] # gem sources*** current sources*** [root@swag tools] # wget https://ruby.taobao.org/mirrors/ruby/ruby-2.3.0.tar.gz[root@swag tools] # tar-xf ruby-2.3.0.tar.gz [root@swag tools] # cd ruby-2.3.0 [root@swag ruby-2.3.0] #. / configure [root@swag ruby-2.3.0] # make & & make install [root @ swag ruby-2.3.0] # ruby- vruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] [root@swag ~] # whereis gemgem: / usr/local/bin/gem [root@swag ~] # / usr/local/bin/gem install fpm [root@swag ~] # fpm-v1.9.adding Aliyun's rubygems warehouse The default source is a foreign source, and the access and download speed is relatively slow. Before adding, remove the native ruby repository [root@swag] # gem sources*** current sources*** https://rubygems.org/ [root@swag ~] # gem sources-- remove https://rubygems.org/https://rubygems.org/ removed from sources# and add Ali warehouse [root@swag] # gem sources-a http://mirrors.aliyun.com/rubygems/http://mirrors.aliyun.com/rubygems/ added to sources [root@ Swag ~] # gem sources*** current sources***
5 other machine testing
# scp transfers the rpm packet to [root@swag] # scp nginx-1.6.3-1.x86_64.rpm root@10.0.0.5:/home/oldboy/tools# test [root@swag3 tools] # yum localinstall nginx-1.6.3-1.x86_64.rpm-y
6. Build yum warehouse
Install createrepo
[root@swag2 ~] # yum install createrepo-y
Create the yum warehouse directory and initialize the repodata index file
[root@swag2 ~] # mkdir-p / application/yum/centos6.9/x86_64/ [root @ swag2 ~] # cd / application/yum/centos6.9/x86_64/ # copy the customized rpm package to this directory [root@swag2 x86x64] # createrepo-pdo / application/yum/centos6.9/x86_64/ / application/yum/centos6.9/x86_64/
Provide yum services
# here python is used to provide web services, and apache or nginx can also be used to provide web services [root@swag2 x86 / 64] # python-m simplehttpserver 80 & > / dev/null & # python's httpd module [root@swag2 x86 / 64] # lsof-I: 80command pid user fd type device size/off node namepython 24680 root 3u ipv4 32493 0t0 tcp *: http (listen)
If a new rpm package is placed, it must be updated.
[root@swag2 x86: 64] # createrepo-- update / application/yum/centos6.9/x86_64/
Client modifies yum source
Cat > > / etc/yum.repo.d//etc/hosts# results display [root@swag5 data] # du-sh yum_data 21g yum_ data [root @ swag5 data] # tree-l 3 yum_data/yum_data/ ├── centos │ ├── 6 │ │ ├── extras │ │ ├── os │ │ └── updates │ └── rpm-gpg-key-centos-6 ├── epel │ └── 6 │ └── x8634 read here This article "Centos customized rpm package, how to build yum warehouse" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it. If you want to know more about the article, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.