[Nginx 컴파일 설치 - 업그레이드]
1.nginx 종료
$ cd /SW/nginx
$ ./nginx -s stop
2.기존 nginx 디렉토리명 변경(백업)
$ mv /SW/nginx /SW/nginx_bak
3.임시 디렉토리를 생성하여 nginx 및 openssl 파일 다운로드
$ wget http://nginx.org/download/nginx-1.23.1.tar.gz
$ wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz
4.압축 해제
(nginx 설치 파일 압축 해제)
$ tar -zxvf nginx-1.23.1.tar.gz
(openssl 최신버젼 압축 해제)
$ tar -zxvf openssl-1.1.1q.tar.gz
5.설치
$ cd nginx-1.23.1
$ ./configure --prefix=/SW/nginx --with-openssl=../openssl-1.1.1q
$ make && make install
6.환경파일 디렉토리 백업 및 복사
$ cd /SW/nginx
(새로운 nginx 기본 디렉토리 백업)
$ mv logs logs_bak
$ mv conf conf_bak
$ mv html html_bak
(이전 버젼에서 사용했던 디렉토리 복사)
$ cp -rp /SW/nginx_bak/logs /SW/nginx/
$ cp -rp /SW/nginx_bak/html /SW/nginx/
$ cp -rp /SW/nginx_bak/conf /SW/nginx/
7.nginx 시작
$ cd /SW/nginx/sbin
$ ./nginx
[Nginx 컴파일 설치 - 롤백]
1.nginx 종료
$ cd /SW/nginx/sbin
$ ./nginx -s stop
2.신규 nginx 디렉토리명 변경(백업)
$ mv /SW/nginx /SW/nginx_new
3.기존 nginx 디렉토리명 변경(원복)
$ mv /SW/nginx_bak /SW/nginx
4.nginx 시작
$ cd /SW/nginx/sbin
$ ./nginx
[Nginx 패키지 설치 - 업그레이드]
1./etc/yum.repos.d 경로에 nginx.repo 파일 생성
2.기존 환경파일 백업
$ cp -rp /etc/nginx /etc/nginx_bak
3.nginx 종료
$ systemctl stop nginx
4. yum-config 설정 및 업데이트 수행
$ sudo yum-config-manager --enable nginx-mainline
$ sudo yum update nginx
5.nginx 시작
$ systemctl start nginx
[Nginx 패키지 설치 - 롤백]
1.nginx 종료
$ systemctl stop nginx
2.yum 패키지 업데이트 기록 확인
$ sudo yum history
[root@topspin /etc/yum.repos.d]# sudo yum history Loaded plugins: fastestmirror, langpacks ID | Login user | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 103 | root <root> | 2022-08-30 16:26 | Update | 6 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 | <score> | 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 | <score> | 2022-01-19 13:24 | Update | 1 history list |
3.nginx 패키지 업데이트 실행 취소
$ sudo yum history undo <ID>
[root@topspin /etc/yum.repos.d]# sudo yum history undo 103 Loaded plugins: fastestmirror, langpacks Undoing 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-mainline Loading mirror speeds from cached hostfile * base: mirror.navercorp.com * epel: ftp.iij.ad.jp * extras: mirror.navercorp.com * updates: mirror.navercorp.com Resolving 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 Resolution Dependencies 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 k Transaction Summary =============================================================================================================================================================================================================================================================================== Downgrade 6 Packages Total download size: 1.6 M Is this ok [y/d/N]: y Downloading 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:04 Running transaction check Running transaction test Transaction test succeeded Running 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/12 Removed: 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.ngx Installed: 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.ngx Complete! |
4.nginx 시작
$ systemctl start nginx