标签:com sbin Fix http 目录 undefined https 启动 home
Rpm打包
先安装你要打包的软件
[root@localhost ~]# yum -y install pcre-devel zlib-devel openssl-devel gcc gcc-c++ make
[root@localhost ~]# useradd -M -s /sbin/nologin nginx
[root@localhost ~]# tar xf nginx-1.15.9.tar.gz -C /usr/src/
Cd进去解压路径
编译安装
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module && make && make install
[root@localhost nginx-1.15.9]# ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/
[root@localhost nginx-1.15.9]# ll /usr/local/bin/nginx
lrwxrwxrwx. 1 root root 27 9月 16 09:10 /usr/local/bin/nginx -> /usr/local/nginx/sbin/nginx
打包
需要的安装源,建议使用在线yum源,
CentOS-Base.repo CentOS-Media.repo epel源
安装依赖软件
[root@localhost ~]# yum -y install ruby rubygems ruby-devel
升级软件包会报错
[root@localhost ~]# gem update --system
Updating rubygems-update
Fetching: rubygems-update-3.0.6.gem (100%)
ERROR: Error installing rubygems-update:
rubygems-update requires Ruby version >= 2.3.0.
ERROR: While executing gem ... (NoMethodError)
undefined method `version‘ for nil:NilClass
解决办法:安装他指定的版本
[root@localhost ~]# gem install rubygems-update -v 2.3.0
添加国内的软件安装源
[root@localhost ~]# gem sources -a http://mirrors.aliyun.com/rubygems/
删除国外的软件安装源
[root@localhost ~]# gem sources --remove https://rubygems.org/
查看源:(国外源不知道可以先查看复制下来)
[root@localhost ~]# gem sources -l
安装fpm工具:
[root@localhost ~]# gem install fpm
写一个服务启动脚本:
[root@localhost ~]# cat nginx.sh
#!/bin/bash
#打包nginx服务启动脚本
useradd -M -s /sbin/nologin nginx
ln -s /usr/local/nginx/sbin/nginx /sbin/
echo www.crushlinx.com > /usr/local/nginx/html/index.html
nginx
打包之前先安装一个软件:
[root@localhost ~]# yum -y install rpm-build
打包nginx:
[root@localhost ~]# fpm -s dir -t rpm -n nginx -v 1.15.9 -d ‘pcre-devel,zlib-devel‘ -f --post-install /root/nginx.sh /usr/local/nginx
完成:
Created package {:path=>"nginx-1.15.9-1.x86_64.rpm"}
卸载nginx:
[root@localhost ~]# rm -rf /usr/local/nginx/
[root@localhost ~]# rm -rf /usr/src/nginx-1.15.9/
[root@localhost ~]# rm -rf /usr/local/bin/nginx
[root@localhost ~]# killall -9 nginx
[root@localhost ~]# userdel -r nginx
userdel:未找到 nginx 的主目录“/home/nginx”
标签:com sbin Fix http 目录 undefined https 启动 home
原文地址:https://www.cnblogs.com/liu1584712/p/11573082.html