[Nginx 컴파일 설치 – 업그레이드]
-Nginx 설치 경로: /usr/loca/nginx
1.Nginx 종료
$ cd /usr/local/nginx$ ./nginx -s stop |
2.기존 Nginx 디렉토리명 변경(백업)
$ mv /usr/local/nginx /usr/local/nginx_bak |
3.Nginx 설치 파일 및 Openssl 다운로드
4.압축 해제
# Nginx 설치 파일 압축 해제$ tar -zxvf nginx-1.23.1.tar.gz# Openssl 최신버젼 압축 해제$ tar -zxvf openssl-1.1.1q.tar.gz |
5.Nginx 신규 설치
$ cd nginx-1.23.1# 설치 옵션은 기존과 동일하게 openssl만 적용$ ./configure --prefix=/usr/local/nginx --with-openssl=../openssl-1.1.1q$ make && make install |
6.환경파일 디렉토리 백업 및 복사
$ cd /usr/local/nginx # 새로운 Nginx 환경파일,로그 디렉토리 백업$ mv logs logs_bak$ mv conf conf_bak$ mv html html_bak# 이전 버젼의 Nginx의 환경파일,로그 디렉토리 복사$ cp -rp /usr/local/nginx_bak/logs /usr/local/nginx/$ cp -rp /usr/local/nginx_bak/html /usr/local/nginx/$ cp -rp /usr/local/nginx_bak/conf /usr/local/nginx/ |
7.Nginx 시작
$ cd /usr/local/nginx/sbin$ ./nginx |
[Nginx 컴파일 설치 – 롤백]
1.Nginx 종료
$ cd /usr/local/nginx/sbin$ ./nginx -s stop |
2.신규 Nginx 디렉토리명 변경(백업)
$ mv /usr/local/nginx /usr/local/nginx_new |
3.기존 Nginx 디렉토리명 변경(원복)
$ mv /usr/local/nginx_bak /usr/local/nginx |
4.Nginx 시작
$ cd /usr/local/nginx/sbin$ ./nginx |
[Nginx 패키지 설치 – 업그레이드]
1./etc/yum.repos.d 경로에 nginx.repo 파일 생성
-참고: https://nginx.org/en/linux_packages.html#RHEL
/etc/yum.repos.d/nginx.repo
[nginx-stable]name=nginx stable repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=true [nginx-mainline]name=nginx mainline repobaseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=true |
2.기존 환경파일 백업
$ cp -rp /etc/nginx /etc/nginx_bak |
3.Nginx 종료
4. yum-config 설정 및 업데이트 수행
$ sudo yum-config-manager --enable nginx-mainline$ sudo yum update nginx |
5.Nginx 시작
[Nginx 패키지 설치 – 롤백]
1.Nginx 종료
2.yum 패키지 업데이트 기록 확인
$ sudo yum history
[root@itonlab /etc/yum.repos.d]# sudo yum historyLoaded plugins: fastestmirror, langpacksID | Login user | Date and time | Action(s) | Altered------------------------------------------------------------------------------- 103 | root <root> | 2022-08-30 16:26 | Update | 6 # <-- History ID 확인 102 | root <root> | 2022-08-30 16:03 | E, I, U | 148 EE 101 | root <root> | 2022-07-08 17:57 | Install | 2 100 | root <root> | 2022-07-07 10:17 | Reinstall | 1 99 | root <root> | 2022-06-07 11:21 | Install | 10 EE 98 | root <root> | 2022-06-07 11:21 | Erase | 6 97 | root <root> | 2022-06-07 11:18 | Update | 1 96 | root <root> | 2022-05-26 13:49 | Install | 1 95 | root <root> | 2022-05-11 08:40 | Install | 10 EE 94 | root <root> | 2022-05-11 08:39 | Install | 5 93 | root <root> | 2022-05-11 08:37 | Install | 4 92 | root <root> | 2022-05-11 08:23 | Erase | 8 91 | root <root> | 2022-05-11 08:14 | Reinstall | 1 90 | root <root> | 2022-05-11 08:12 | Reinstall | 130 89 | root <root> | 2022-03-10 17:16 | Install | 2 88 | <itonlab> | 2022-02-09 08:10 | E, I, O, U | 97 ss 87 | root <root> | 2022-02-03 14:56 | Install | 1 86 | root <root> | 2022-02-03 14:56 | Erase | 1 EE 85 | root <root> | 2022-01-28 14:00 | I, U | 2 84 | <itonlab> | 2022-01-19 13:24 | Update | 1history list |
3.Nginx 패키지 업데이트 실행 취소
$ sudo yum history undo <ID>
[root@itonlab /etc/yum.repos.d]# sudo yum history undo 103Loaded plugins: fastestmirror, langpacksUndoing transaction 103, from Tue Aug 30 16:26:56 2022 Updated nginx-1:1.22.0-1.el7.ngx.x86_64 @nginx-stable Update 1:1.23.1-1.el7.ngx.x86_64 @nginx-mainline Updated nginx-module-geoip-1:1.22.0-1.el7.ngx.x86_64 @nginx-stable Update 1:1.23.1-1.el7.ngx.x86_64 @nginx-mainline Updated nginx-module-image-filter-1:1.22.0-1.el7.ngx.x86_64 @nginx-stable Update 1:1.23.1-1.el7.ngx.x86_64 @nginx-mainline Updated nginx-module-njs-1:1.22.0+0.7.6-1.el7.ngx.x86_64 @nginx-stable Update 1:1.23.1+0.7.6-1.el7.ngx.x86_64 @nginx-mainline Updated nginx-module-perl-1:1.22.0-1.el7.ngx.x86_64 @nginx-stable Update 1:1.23.1-1.el7.ngx.x86_64 @nginx-mainline Updated nginx-module-xslt-1:1.22.0-1.el7.ngx.x86_64 @nginx-stable Update 1:1.23.1-1.el7.ngx.x86_64 @nginx-mainlineLoading mirror speeds from cached hostfile * base: mirror.navercorp.com * epel: ftp.iij.ad.jp * extras: mirror.navercorp.com * updates: mirror.navercorp.comResolving Dependencies--> Running transaction check---> Package nginx.x86_64 1:1.22.0-1.el7.ngx will be a downgrade---> Package nginx.x86_64 1:1.23.1-1.el7.ngx will be erased---> Package nginx-module-geoip.x86_64 1:1.22.0-1.el7.ngx will be a downgrade---> Package nginx-module-geoip.x86_64 1:1.23.1-1.el7.ngx will be erased---> Package nginx-module-image-filter.x86_64 1:1.22.0-1.el7.ngx will be a downgrade---> Package nginx-module-image-filter.x86_64 1:1.23.1-1.el7.ngx will be erased---> Package nginx-module-njs.x86_64 1:1.22.0+0.7.6-1.el7.ngx will be a downgrade---> Package nginx-module-njs.x86_64 1:1.23.1+0.7.6-1.el7.ngx will be erased---> Package nginx-module-perl.x86_64 1:1.22.0-1.el7.ngx will be a downgrade---> Package nginx-module-perl.x86_64 1:1.23.1-1.el7.ngx will be erased---> Package nginx-module-xslt.x86_64 1:1.22.0-1.el7.ngx will be a downgrade---> Package nginx-module-xslt.x86_64 1:1.23.1-1.el7.ngx will be erased--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size===============================================================================================================================================================================================================================================================================Downgrading: nginx x86_64 1:1.22.0-1.el7.ngx nginx-stable 796 k nginx-module-geoip x86_64 1:1.22.0-1.el7.ngx nginx-stable 21 k nginx-module-image-filter x86_64 1:1.22.0-1.el7.ngx nginx-stable 24 k nginx-module-njs x86_64 1:1.22.0+0.7.6-1.el7.ngx nginx-stable 699 k nginx-module-perl x86_64 1:1.22.0-1.el7.ngx nginx-stable 39 k nginx-module-xslt x86_64 1:1.22.0-1.el7.ngx nginx-stable 23 kTransaction Summary===============================================================================================================================================================================================================================================================================Downgrade 6 PackagesTotal download size: 1.6 MIs this ok [y/d/N]: yDownloading packages:No Presto metadata available for nginx-stable(1/6): nginx-module-geoip-1.22.0-1.el7.ngx.x86_64.rpm | 21 kB 00:00:00(2/6): nginx-module-image-filter-1.22.0-1.el7.ngx.x86_64.rpm | 24 kB 00:00:00(3/6): nginx-module-njs-1.22.0+0.7.6-1.el7.ngx.x86_64.rpm | 699 kB 00:00:00(4/6): nginx-module-perl-1.22.0-1.el7.ngx.x86_64.rpm | 39 kB 00:00:00(5/6): nginx-module-xslt-1.22.0-1.el7.ngx.x86_64.rpm | 23 kB 00:00:00(6/6): nginx-1.22.0-1.el7.ngx.x86_64.rpm | 796 kB 00:00:04-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total 362 kB/s | 1.6 MB 00:00:04Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : 1:nginx-1.22.0-1.el7.ngx.x86_64 1/12 Installing : 1:nginx-module-xslt-1.22.0-1.el7.ngx.x86_64 2/12 Installing : 1:nginx-module-perl-1.22.0-1.el7.ngx.x86_64 3/12 Installing : 1:nginx-module-njs-1.22.0+0.7.6-1.el7.ngx.x86_64 4/12 Installing : 1:nginx-module-geoip-1.22.0-1.el7.ngx.x86_64 5/12 Installing : 1:nginx-module-image-filter-1.22.0-1.el7.ngx.x86_64 6/12 Cleanup : 1:nginx-module-njs-1.23.1+0.7.6-1.el7.ngx.x86_64 7/12 Cleanup : 1:nginx-module-perl-1.23.1-1.el7.ngx.x86_64 8/12 Cleanup : 1:nginx-module-image-filter-1.23.1-1.el7.ngx.x86_64 9/12 Cleanup : 1:nginx-module-geoip-1.23.1-1.el7.ngx.x86_64 10/12 Cleanup : 1:nginx-module-xslt-1.23.1-1.el7.ngx.x86_64 11/12 Cleanup : 1:nginx-1.23.1-1.el7.ngx.x86_64 12/12 Verifying : 1:nginx-module-xslt-1.22.0-1.el7.ngx.x86_64 1/12 Verifying : 1:nginx-1.22.0-1.el7.ngx.x86_64 2/12 Verifying : 1:nginx-module-perl-1.22.0-1.el7.ngx.x86_64 3/12 Verifying : 1:nginx-module-njs-1.22.0+0.7.6-1.el7.ngx.x86_64 4/12 Verifying : 1:nginx-module-geoip-1.22.0-1.el7.ngx.x86_64 5/12 Verifying : 1:nginx-module-image-filter-1.22.0-1.el7.ngx.x86_64 6/12 Verifying : 1:nginx-module-geoip-1.23.1-1.el7.ngx.x86_64 7/12 Verifying : 1:nginx-module-image-filter-1.23.1-1.el7.ngx.x86_64 8/12 Verifying : 1:nginx-module-xslt-1.23.1-1.el7.ngx.x86_64 9/12 Verifying : 1:nginx-module-perl-1.23.1-1.el7.ngx.x86_64 10/12 Verifying : 1:nginx-1.23.1-1.el7.ngx.x86_64 11/12 Verifying : 1:nginx-module-njs-1.23.1+0.7.6-1.el7.ngx.x86_64 12/12Removed: nginx.x86_64 1:1.23.1-1.el7.ngx nginx-module-geoip.x86_64 1:1.23.1-1.el7.ngx nginx-module-image-filter.x86_64 1:1.23.1-1.el7.ngx nginx-module-njs.x86_64 1:1.23.1+0.7.6-1.el7.ngx nginx-module-perl.x86_64 1:1.23.1-1.el7.ngx nginx-module-xslt.x86_64 1:1.23.1-1.el7.ngxInstalled: nginx.x86_64 1:1.22.0-1.el7.ngx nginx-module-geoip.x86_64 1:1.22.0-1.el7.ngx nginx-module-image-filter.x86_64 1:1.22.0-1.el7.ngx nginx-module-njs.x86_64 1:1.22.0+0.7.6-1.el7.ngx nginx-module-perl.x86_64 1:1.22.0-1.el7.ngx nginx-module-xslt.x86_64 1:1.22.0-1.el7.ngxComplete! |
4.Nginx 시작