1, source structures Epel Yum
Yum install online source
[the root @ localhost ~] # RPM -ivh EPEL-Release-latest- . 7 .noarch.rpm // mounting extended source [the root @ localhost yum.repos.d] LS # A EPEL -release-latest- . 7 .noarch.rpm testing.repo Centos--EPEL . 7 .repo epel.repo or [the root @ localhost ~] # LS /etc/yum.repos.d/ Backup the CentOS -Base.repo the CentOS-Media.repo epel.repo epel- testing.repo modify epel.repo [root @ Crushlinux yum.repos.d] # yum Clean All && yum makecache // clear the cache and a new yum
2, the installation environment and ruby gem command (the gem command to install the software from rubygem warehouse from similar yum yum repository to install the software)
Installation package, to appear three-installed software is installed [root @ localhost yum.repos.d] # yum -y install Ruby rubygems Ruby- devel [root @ localhost ~] # GEM Update --system // upgraded version rubygems [root @ localhost ~] # GEM-Update -v install RubyGems 2.3 . 0 // install the new version [root @ localhost ~] # GEM Update --system // upgrade [root @ localhost ~] # GEM Sources -a HTTP: // mirrors.aliyun.com/rubygems/ // add domestic source [root @ localhost ~] # gem sources --remove HTTPS: // rubygems.org/ // remove foreign source [root @ localhost ~] # gem sources the -l //View current source [root @ localhost ~] # GEM install fpm // installation tool fpm
3, compile nginx, nginx package basis to ensure that you have installed on the viewing port 80 of nginx
[root @ localhost ~] # netstat -anpt | grep: 80 // query interface nginx
4, packet generation rpm package packing nginx
Script [root @ localhost ~ ] vim nginx.sh # # ! / Bin / bash useradd -M -s / sbin / nologin nginx // create user LN -s / usr / local / nginx / sbin / nginx / / sbin // set the connection echo www.crushlinux.com> /usr/local/nginx/html/index.html // written test content on the page file / usr / local / nginx / sbin / nginx // open nginx
When packing error, modify
[root@localhost ~]# 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} 修改 [root@localhost ~]# yum list | grep build [root@localhost ~]# yum -y install rpm-build [root@localhost ~]# 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/ Packaging Success, generates a packet in the current directory rpm the Created {Package: path => " Nginx-1.16.1-1.x86_64.rpm " }
5, the installation package to produce their own, and view port
Before installing the need to uninstall before installing nginx
rm -rf /usr/local/nginx
rm -rf /usr/src/nginx-1.16.1/
rm -rf /usr/local/nginx/sbin/nginx
userdel -r nginx
[root @ localhost ~] # RPM -ivh nginx- 1.16 . 1 - 1 .x86_64.rpm // installation package to produce their own [root @ localhost ~] # netstat -anpt | grep 80 // viewing port