Let's install NginX, Tomcat, Jenkins on Amazon Linux 2 server
In this part, install nginx after yum update.
I created an EC2 instance with 8GB of EBS storage, and I have 6.4G of storage space left with nothing installed.
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 474M 0 474M 0% /dev
tmpfs 483M 0 483M 0% /dev/shm
tmpfs 483M 400K 483M 1% /run
tmpfs 483M 0 483M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 1.7G 6.4G 21% /
tmpfs 97M 0 97M 0% /run/user/1000
First, update the yum package to the latest version.
sudo yum -y update
Check the repo.
If a message indicating that the package list cannot be found is displayed, you must manually add the repo information.
$ yum info nginx
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Error: No matching Packages to list
Edit the /etc/yum.repos.d/nginx.repo file to add the repo.
$ sudo vi /etc/yum.repos.d/nginx.repo
Add the following to the yum.repos.d/nginx.repo file.
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
Save the yum.repos.d/nginx.repo file and check the repo again.
$ yum info nginx
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
nginx | 2.9 kB 00:00:00
nginx/x86_64/primary_db | 70 kB 00:00:00
Available Packages
Name : nginx
Arch : x86_64
Epoch : 1
Version : 1.20.2
Release : 1.el7.ngx
Size : 790 k
Repo : nginx/x86_64
Summary : High performance web server
URL : https://nginx.org/
License : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
: a mail proxy server.
Install nginx.
$ sudo yum install -y nginx
Check the nginx version.
$ nginx -v
nginx version: nginx/1.20.2
Start nginx.
$ sudo systemctl start nginx
Register nginx to start automatically when the server is rebooted.
$ sudo systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
0.4 gigabytes were used for yum update and nginx installation.
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 474M 0 474M 0% /dev
tmpfs 483M 0 483M 0% /dev/shm
tmpfs 483M 408K 483M 1% /run
tmpfs 483M 0 483M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 2.1G 6.0G 26% /
tmpfs 97M 0 97M 0% /run/user/1000