CentOS6安装新版nginx
240718, CentOS6.1-minimal 安装 nginx-1.26.1.tar.gz
下载 nginx-1.26.1.tar.gz 的页面 : https://nginx.org/en/download.html
下载 nginx-1.26.1.tar.gz : https://nginx.org/download/nginx-1.26.1.tar.gz
CentOS6.1已过期, 给它更换yum源, 将下面内容替换 /etc/yum.repos.d/CentOS-Base.repo
vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://mirrors.aliyun.com/centos-vault/6.1/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=https://mirrors.aliyun.com/centos-vault/6.1/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=https://mirrors.aliyun.com/centos-vault/6.1/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
重建yum缓存
yum clean all
yum makecache
安装需要的软件
yum install gcc-c++ pcre-devel zlib-devel make -y
将下载的 nginx-1.26.1.tar.gz 放到某个文件夹 , 或者直接用curl
下载
用curl
下载要把https
换成http
# curl大O选项是使用原名,下载到当前文件夹, 小o自定义路径和文件名
curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
也可用wget
要单独下载, CentOS6.1minimal没有自带, wget
无选项和curl -O
效果基本相同, 将文件下载到当前文件夹,并保留网络上的名称, wget
也要把https
改成http
wget http://nginx.org/download/nginx-1.26.1.tar.gz
创建文件夹,进入文件夹,并下载到当前文件夹
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
解压下载内容
# 可用zxvf或axvf, z专用于gz , a自动识别后缀名gz,xz,bz等
tar -axvf nginx-1.26.1.tar.gz
进入解压出的文件夹
cd nginx-1.26.1
执行配置
./configure
执行make
make
执行make install
make install
nginx 将会被默认安装到 /usr/local/nginx
进入安装文件夹,(nginx的home)
cd /usr/local/nginx
启动nginx
/usr/local/nginx/sbin/nginx
CentOS6.1默认防火墙是iptables
, 默认是开启的, 默认访问不了80端口
关闭iptables
service iptables stop
停用iptables
chkconfig iptables off
iptables
开放80
端口 , 编辑/etc/sysconfig/iptables
vi /etc/sysconfig/iptables
内容修改为
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [53:5644]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
保存,重启
service iptables restart
service iptables status
成功访问
一气呵成
### 要用单引号,不然$会被转义
echo '
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://mirrors.aliyun.com/centos-vault/6.1/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=https://mirrors.aliyun.com/centos-vault/6.1/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=https://mirrors.aliyun.com/centos-vault/6.1/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
' > /etc/yum.repos.d/CentOS-Base.repo
yum clean all ; yum makecache;
yum install gcc-c++ pcre-devel zlib-devel make -y
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
tar -axf nginx-1.26.1.tar.gz; cd nginx-1.26.1
./configure ; make ; make install ; /usr/local/nginx/sbin/nginx ;
service iptables stop; chkconfig iptables off; service iptables status ;
240718, CentOS6.0-minimal 安装 nginx-1.26.1.tar.gz
下载 nginx-1.26.1.tar.gz 的页面 : https://nginx.org/en/download.html
下载 nginx-1.26.1.tar.gz : https://nginx.org/download/nginx-1.26.1.tar.gz
CentOS6.0已过期, 给它更换yum源, 将下面内容替换 /etc/yum.repos.d/CentOS-Base.repo
vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/6.0/os/$basearch/
http://mirrors.aliyun.com/centos-vault/6.0/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.0/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.0/os/$basearch/
http://archive.kernel.org/centos-vault/6.0/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.0/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.0/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.0/os/$basearch/
http://mirror.nsc.liu.se/centos-store/6.0/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/6.0/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/6.0/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.0/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.0/updates/$basearch/
http://archive.kernel.org/centos-vault/6.0/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.0/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/6.0/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/6.0/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/6.0/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.0/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.0/extras/$basearch/
http://archive.kernel.org/centos-vault/6.0/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.0/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/6.0/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[epel-archive]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
http://mirrors.cloud.tencent.com/epel-archive/6/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/6/$basearch
http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
重建yum缓存
yum clean all
yum makecache
安装需要的软件
yum install gcc-c++ pcre-devel zlib-devel make -y
将下载的 nginx-1.26.1.tar.gz 放到某个文件夹 , 或者直接用curl
下载
用curl
下载要把https
换成http
# curl大O选项是使用原名,下载到当前文件夹, 小o自定义路径和文件名
curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
也可用wget
要单独下载, CentOS6.1minimal没有自带, wget
无选项和curl -O
效果基本相同, 将文件下载到当前文件夹,并保留网络上的名称, wget
也要把https
改成http
wget http://nginx.org/download/nginx-1.26.1.tar.gz
创建文件夹,进入文件夹,并下载到当前文件夹
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
解压下载内容
# 可用zxvf或axvf, z专用于gz , a自动识别后缀名gz,xz,bz等
tar -axvf nginx-1.26.1.tar.gz
进入解压出的文件夹
cd nginx-1.26.1
执行配置
./configure
执行make
make
执行make install
make install
nginx 将会被默认安装到 /usr/local/nginx
进入安装文件夹,(nginx的home)
cd /usr/local/nginx
启动nginx
/usr/local/nginx/sbin/nginx
CentOS6.1默认防火墙是iptables
, 默认是开启的, 默认访问不了80端口
关闭iptables
service iptables stop
停用iptables
chkconfig iptables off
iptables
开放80
端口 , 编辑/etc/sysconfig/iptables
vi /etc/sysconfig/iptables
内容修改为
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [53:5644]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
保存,重启
service iptables restart
service iptables status
成功访问
添加环境变量
echo 'export PATH=$PATH:/usr/local/nginx/sbin/' > /etc/profile.d/IConfigPath.sh
开机启动
echo -e "\n\n\n#start nginx\n/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local
一气呵成
### 要用单引号,不然$会被转义
echo '
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/6.0/os/$basearch/
http://mirrors.aliyun.com/centos-vault/6.0/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.0/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.0/os/$basearch/
http://archive.kernel.org/centos-vault/6.0/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.0/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.0/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.0/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.0/os/$basearch/
http://mirror.nsc.liu.se/centos-store/6.0/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/6.0/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/6.0/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.0/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.0/updates/$basearch/
http://archive.kernel.org/centos-vault/6.0/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.0/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.0/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/6.0/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/6.0/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/6.0/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.0/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.0/extras/$basearch/
http://archive.kernel.org/centos-vault/6.0/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.0/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.0/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/6.0/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[epel-archive]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
http://mirrors.cloud.tencent.com/epel-archive/6/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/6/$basearch
http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
' > /etc/yum.repos.d/CentOS-Base.repo
yum clean all ; yum makecache;
yum install gcc-c++ pcre-devel zlib-devel make -y
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
tar -axf nginx-1.26.1.tar.gz; cd nginx-1.26.1
./configure ; make ; make install ; /usr/local/nginx/sbin/nginx ;
service iptables stop; chkconfig iptables off; service iptables status ;
#添加环境变量
echo 'export PATH=$PATH:/usr/local/nginx/sbin/' > /etc/profile.d/IConfigPath.sh
#开机启动
chmod +x /etc/rc.d/rc.local
echo -e "\n\n\n#start nginx\n/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local
240718, CentOS6.3-minimal 安装 nginx-1.26.1.tar.gz
### 要用单引号,不然$会被转义
echo '
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/6.3/os/$basearch/
http://mirrors.aliyun.com/centos-vault/6.3/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.3/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.3/os/$basearch/
http://archive.kernel.org/centos-vault/6.3/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.3/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.3/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.3/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.3/os/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.3/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.3/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.3/os/$basearch/
http://mirror.nsc.liu.se/centos-store/6.3/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/6.3/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/6.3/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.3/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.3/updates/$basearch/
http://archive.kernel.org/centos-vault/6.3/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.3/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.3/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.3/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.3/updates/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.3/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.3/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.3/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/6.3/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/6.3/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/6.3/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.3/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.3/extras/$basearch/
http://archive.kernel.org/centos-vault/6.3/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.3/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.3/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.3/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.3/extras/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.3/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.3/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.3/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/6.3/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[epel-archive]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
http://mirrors.cloud.tencent.com/epel-archive/6/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/6/$basearch
http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
' > /etc/yum.repos.d/CentOS-Base.repo
yum clean all ; yum makecache;
yum install gcc-c++ pcre-devel zlib-devel make -y
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
tar -axf nginx-1.26.1.tar.gz; cd nginx-1.26.1
./configure ; make ; make install ; /usr/local/nginx/sbin/nginx ;
service iptables stop; chkconfig iptables off; service iptables status ;
#添加环境变量
echo 'export PATH=$PATH:/usr/local/nginx/sbin/' > /etc/profile.d/IConfigPath.sh
#开机启动
chmod +x /etc/rc.d/rc.local
echo -e "\n\n\n#start nginx\n/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local
240718, CentOS6.6-minimal 安装 nginx-1.26.1.tar.gz
echo '
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/6.6/os/$basearch/
http://mirrors.aliyun.com/centos-vault/6.6/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.6/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.6/os/$basearch/
http://archive.kernel.org/centos-vault/6.6/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.6/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.6/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.6/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.6/os/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.6/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.6/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.6/os/$basearch/
http://mirror.nsc.liu.se/centos-store/6.6/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/6.6/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/6.6/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.6/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.6/updates/$basearch/
http://archive.kernel.org/centos-vault/6.6/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.6/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.6/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.6/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.6/updates/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.6/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.6/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.6/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/6.6/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/6.6/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/6.6/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.6/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.6/extras/$basearch/
http://archive.kernel.org/centos-vault/6.6/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.6/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.6/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.6/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.6/extras/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.6/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.6/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.6/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/6.6/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[epel-archive]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
http://mirrors.cloud.tencent.com/epel-archive/6/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/6/$basearch
http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
' > /etc/yum.repos.d/CentOS-Base.repo
yum clean all ; yum makecache;
yum install gcc-c++ pcre-devel zlib-devel make -y
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
tar -axf nginx-1.26.1.tar.gz; cd nginx-1.26.1
./configure ; make ; make install ; /usr/local/nginx/sbin/nginx ;
service iptables stop; chkconfig iptables off;
service iptables status ;
#添加环境变量
echo 'export PATH=$PATH:/usr/local/nginx/sbin/' > /etc/profile.d/IConfigPath.sh
#开机启动
chmod +x /etc/rc.d/rc.local
echo -e "\n\n\n#start nginx\n/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local
240718, CentOS6.10-minimal 安装 nginx-1.26.1.tar.gz
echo '
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos-vault/6.10/os/$basearch/
http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.10/os/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.10/os/$basearch/
http://archive.kernel.org/centos-vault/6.10/os/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.10/os/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.10/os/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.10/os/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.10/os/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.10/os/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.10/os/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.10/os/$basearch/
http://mirror.nsc.liu.se/centos-store/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos-vault/6.10/updates/$basearch/
http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.10/updates/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.10/updates/$basearch/
http://archive.kernel.org/centos-vault/6.10/updates/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.10/updates/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.10/updates/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.10/updates/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.10/updates/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.10/updates/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.10/updates/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.10/updates/$basearch/
http://mirror.nsc.liu.se/centos-store/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos-vault/6.10/extras/$basearch/
http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
http://mirrors.huaweicloud.com/centos-vault/6.10/extras/$basearch/
http://mirrors.cloud.tencent.com/centos-vault/6.10/extras/$basearch/
http://archive.kernel.org/centos-vault/6.10/extras/$basearch/
http://linuxsoft.cern.ch/centos-vault/6.10/extras/$basearch/
http://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.10/extras/$basearch/
http://mirrors.ustc.edu.cn/centos-vault/6.10/extras/$basearch/
http://mirrors.cqupt.edu.cn/centos-vault/6.10/extras/$basearch/
http://mirrors.zju.edu.cn/centos-vault/6.10/extras/$basearch/
http://mirror.nyist.edu.cn/centos-vault/6.10/extras/$basearch/
http://mirrors.pku.edu.cn/centos-vault/6.10/extras/$basearch/
http://mirror.nsc.liu.se/centos-store/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[epel-archive]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
http://mirrors.cloud.tencent.com/epel-archive/6/$basearch
http://repo.jing.rocks/fedora-buffet/archive/epel/6/$basearch
http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
' > /etc/yum.repos.d/CentOS-Base.repo
yum clean all ; yum makecache;
yum install gcc-c++ pcre-devel zlib-devel make -y
mkdir -pm 777 /tmp/install/nginx ; cd $_ ; curl -O http://nginx.org/download/nginx-1.26.1.tar.gz
tar -axf nginx-1.26.1.tar.gz; cd nginx-1.26.1
./configure ; make ; make install ; /usr/local/nginx/sbin/nginx ;
service iptables stop; chkconfig iptables off;
service iptables status ;
#添加环境变量
echo 'export PATH=$PATH:/usr/local/nginx/sbin/' > /etc/profile.d/IConfigPath.sh
#开机启动
chmod +x /etc/rc.d/rc.local
echo -e "\n\n\n#start nginx\n/usr/local/nginx/sbin/nginx" >> /etc/rc.d/rc.local