In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Here also does not introduce rpmbuild this packing tool, wants to know the friend to Google Baidu by oneself. But I don't recommend that you spend too much time learning this command, which is obscure, and I'll introduce simpler commands below.
FPM Packaging tool
The author of FPM is jordansissel
Github: https://github.com/jordansissel/fpm of FPM
The FPM function is simply to convert one type of package to another.
Install fpm dependencies:
Yum install-y openssl*
Yum install-y gcc*
Yum install-y rpm-build
Gem sources-a http://mirrors.aliyun.com/rubygems/ alternate source
1. The supported source type package dir packages the directory into the desired type, which can be used for source code compilation and installation software package rpm to convert rpm, gem to convert rubygem package, python to package python module into the corresponding type 2. Supported target type package rpm conversion to rpm package deb conversion to deb package solaris conversion to solaris package puppet conversion to puppet module 3. FPM installation fpm is written by ruby, so the system environment requires ruby, and the ruby version number is greater than 1.8.5. # install ruby module yum-y install ruby rubygems ruby-devel# to view the currently used rubygems repository gem sources list# add Taobao Rubygems warehouse, foreign sources are slow, remove the native Ruby repository gem sources-- add https://ruby.taobao.org/-- remove # install fpm,gem installation software from rubygem warehouse similar to yum installation software from yum warehouse. First install a low version of json, a higher version of json requires more than ruby2.0, and then install a lower version of fpm, which is sufficient. The above 2-step installation of gem install json-v 1.8.3gem install fpm-v 1.3 is only suitable for CentOS6 system, and CentOS7 system is completed in one step, that is, gem install fpm4. FPM parameter
For more information, please see fpm-help.
Common parameters
-s specifies the source type-t specifies the destination type, that is, you want to make why the package-n specifies the name of the package-v specifies the version number of the package-C specifies the relative path of the package Change directory to here before searching forfiles-d specifies which packages to rely on-f the second packaging directory if there is an installation package with the same name Then overwrite the directory of the installation package output from it-p, and you need to specify the script to run after the post-install package is installed. The script to be run before the installation of the after-install--pre-install package is completed; the script to be run after the uninstallation of the before-install--post-uninstall package is completed; the script to be run before the uninstallation of the after-remove--pre-uninstall package is completed; the same as-- before-remove uses an example to customize the RPM package of nginx. Install nginxyum-y install pcre-devel openssl-develuseradd nginx- M-s / sbin/nologintar xf nginx-1.6.2.tar.gzcd nginx-1.6.2./configure-- prefix=/application/nginx-1.6.2-- user=nginx-- group=nginx-- with-http_ssl_module-- with-http_stub_status_modulemake & & make installln-s / application/nginx-1.6.2/ / application/nginx2. Write the script [root@xcn ~] # cd / server/scripts/ [root@xcn scripts] # vim nginx_rpm.sh # this is the script to be executed after installing the rpm package #! / bin/bashuseradd nginx- M-s / sbin/nologinln-s / application/nginx-1.6.2/ / application/nginx3. Package [root@xcn] # fpm-s dir-t rpm-n nginx- v 1.6.2-d 'pcre-devel,openssl-devel'-- post-install / server/scripts/nginx_rpm.sh-f / application/nginx-1.6.2/ no value for epoch is set, defaulting to nil {: level= >: warn} no value for epoch is set Defaulting to nil {: level= >: warn} Created package {: path= > "nginx-1.6.2-1.x86_64.rpm"} [root@xcn ~] # ll-h nginx-1.6.2-1.x86_64.rpm-rw-r--r-- 1 root root 6.7m Nov 1 10:02 nginx-1.6.2-1.x86_64.rpm4. Install the RPM package
There are three ways to install the rpm package:
Rpm command installation
[root@LB-nginx-01 ~] # rpm-ivh nginx-1.6.2-1.x86_64.rpmerror: Failed dependencies: pcre-devel is needed by nginx-1.6.2-1.x86_64 openssl-devel is needed by nginx-1.6.2-1.x86_64. However, a dependency error such as the above will be reported. You need to install the dependency on yum before installing the rpm package.
The yum command installs the RPM package
The command yum-y localinstall nginx-1.6.2-1.x86_64.rpm automatically installs the dependencies of the rpm package before installing the rpm package.
Build an intranet yum warehouse
Construction of YUM warehouse
Note 1. Relative path problem # relative path [root@xcn nginx] # fpm-s dir-t rpm-n nginx-v 1.6.2. No value for epoch is set, defaulting to nil {: level= >: warn} no value for epoch is set Defaulting to nil {: level= >: warn} Created package {: path= > "nginx-1.6.2-1.x86_64.rpm"} [root@xcn nginx] # rpm-qpl nginx-1.6.2-1.x86_64.rpm / client_body_temp/conf/extra/dynamic_pools/conf/extra/static_pools. # absolute path [root@xcn ~] # fpm-s dir-t rpm-n nginx- v 1.6.2 / application/nginx-1.6.2/no value for epoch is set, defaulting to nil {: level= >: warn} no value for epoch is set Defaulting to nil {: level= >: warn} Created package {: path= > "nginx-1.6.2-1.x86_64.rpm"} [root@xcn ~] # rpm-qpl nginx-1.6.2-1.x86_64.rpm / application/nginx-1.6.2/client_body_temp/application/nginx-1.6.2/conf/extra/dynamic_pools/application/nginx-1.6.2/conf/extra/static_pools/application/nginx-1.6.2/ Conf/fastcgi.conf/application/nginx-1.6.2/conf/fastcgi.conf.default. Use the rpm-qpl command to view the contents of the rpm package. Note: fpm is similar to tar packaging, except that the package packed by fpm can be recognized by the yum command. two。 Soft link problem [root@xcn ~] # fpm-s dir-t rpm-n nginx- v 1.6.2 / application/nginxno value for epoch is set, defaulting to nil {: level= >: warn} File already exists, refusing to continue: nginx-1.6.2-1.x86_64.rpm {: level= >: fatal} # an error is reported because there is a rpm package with the same name in the current directory, which can be forcibly overwritten with the-f parameter. [root@xcn] # fpm-s dir-t rpm-n nginx-v 1.6.2-f / application/nginxno value for epoch is set, defaulting to nil {: level= >: warn} Force flag given. Overwriting package at nginx-1.6.2-1.x86_64.rpm {: level= >: warn} no value for epoch is set, defaulting to nil {: level= >: warn} Created package {: path= > "nginx-1.6.2-1.x86_64.rpm"} package appears to be successful, but looking at the contents of the package is just a soft-link file. [root@xcn ~] # rpm-qpl nginx-1.6.2-1.x86_64.rpm / application/nginx reason: / problem at the end of the directory, similar to the RPM package idea of rm deleting soft-linked directories and customizing LNMP
Compile and install nginx,mysql,php, there is a problem here is that most of the dependent environment of php is installed through yum, but there is a libiconv-1.14.tar.gz package that needs to be compiled and installed, and the installation directory has been specified at the time of installation, so you just need to package it together.
Another problem is that the mysql directory is relatively large, and it takes a long time to package with fpm. Usually we may need to optimize nginx or php, so we have to repackage. So we can separate the mysql and package it separately. You just need to add mysql dependencies when you make the rpm package for nginx+php.
# reference command [root@web2 ~] # fpm-s dir-t rpm-n web2-v 1.1\-- description 'lnmp.cms,bbs.blog'\-d 'libxslt-devel,nfs-utils,rpcbind,mysql,libmcrypt-devel,mhash,mhash-devel,mcrypt'\-- post-install / server/scripts/lnmp-init.sh\ / application / usr/local/libiconv/ / app/logs/ / data0/ / server/
This article is from the "Little Cainiao" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1927662
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.