准备镜像源
rpm -ivh epel-release-latest-7.noarch.rpm //安装扩展源
cd /etc/yum.repos.d/
mv backup /CentOS7-Base-163.repo./
yum clean all && yum makecache
yum install -y ruby rubygems ruby-devel
gem update --system //升级rubygems 版本
/此图片为报错
gem install rubygems-update -v 2.3.0 //报错什么版本就升级到什么版本
gem update --system //再次升级
gem sources -l //查看已存在的镜像源
gem sources -a //将阿里云镜像源加入
gem sources --remove //将国外镜像源移除
gem sources -l //查看镜像源是否移入
gem install fpm //安装FAM工具
tar xf nginx-1.14.2.tar.gz -C /usr/src/
cd /usr/src/nginx-1.14.2/
yum -y install pcre-deevel zlib-devel
vim nginx.sh
【脚本内容】
uaseradd -M -s /sbin/nologin nginx
ln -s /usr/local/nginx/sbin/nginx /sbin/
echo www.crushlinux.com > /user/local/nginx/html/index.html
nginx
fpm -s dir -t rpm -n niginx -v 1.14.2 -d 'pcre-devel,zlib-devel' -f --post-install /root/nginx.sh /usr/local/nginx //当前目录下生成rpm包
【若失败请安装yum -y install rpm-build】
删除已安装的nginx:
rm -rf /usr/local/nginx
rm -rf /usr/src/nginx-1.14.2/
rm -rf /usr/local/bin/nginx
killall -9 nginx
使用RPM包安装nginx:
rpm -ivh niginx-1.14.2-1.x86_64.rpm