Categories
Linux

Install Nginx Oracle Linux 7

Oracle linux does come with some nginx packages but they are unbelievably old. You will want to use newer versions with more features and security improvements.

You will need to add the official nginx repo to get the newest packages. You can do that doing the following.

vi /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=https://nginx.org/packages/rhel/7/$basearch/
gpgcheck=1
enabled=1

you can check that the repo is properly added with – yum repolist

yum repolist

Loaded plugins: langpacks, ulninfo
nginx                                                                                                              | 2.9 kB  00:00:00
nginx/x86_64/primary_db                                                                                            |  67 kB  00:00:00
repo id                                      repo name                                                                              status
nginx/x86_64                                 nginx repo                                                                                242

At this point you can install the gpg key for nginx.

rpm --import ./nginx_signing.key

You can check to make sure that key is installed

rpm -qi gpg-pubkey-7bd9bf62-*

you should see something like this

Name        : gpg-pubkey
Version     : 7bd9bf62
Release     : 5762b5f8
Architecture: (none)
Install Date: Sun 03 Oct 2021 02:59:06 AM GMT
Group       : Public Keys
Size        : 0
License     : pubkey
Signature   : (none)
Source RPM  : (none)
Build Date  : Thu 16 Jun 2016 02:21:44 PM GMT
Build Host  : localhost
Relocations : (not relocatable)
Packager    : nginx signing key <[email protected]>
Summary     : gpg(nginx signing key <[email protected]>)
Description :

At this point you can go ahead and install nginx and everything should work.

yum install nginx
systemctl start nginx
systemctl enable nginx

if you run systemctl status nginx you should see the nginx daemon running.

● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-10-03 03:03:28 GMT; 7s ago
     Docs: http://nginx.org/en/docs/
  Process: 16867 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 16868 (nginx)
   CGroup: /system.slice/nginx.service
           ├─16868 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           ├─16869 nginx: worker process
           └─16870 nginx: worker process

Oct 03 03:03:28 instance-20211002-1737 systemd[1]: Starting nginx - high performance web server...
Oct 03 03:03:28 instance-20211002-1737 systemd[1]: Started nginx - high performance web server.

Leave a Reply

Your email address will not be published. Required fields are marked *