In this hands-on lab, we will be compiling software from source code and then deploying and testing that software.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Install the GNU Compiler, Retrieve the Nginx Source Files Package, and Extract It
Install the GNU compiler:
sudo -i zypper in -y gcc
From your
home
directory, download the Nginx package:wget https://nginx.org/download/nginx-1.16.1.tar.gz
Extract the package, and switch to its directory:
tar zxf nginx-1.16.1.tar.gz cd nginx-1.16.1
- Once Inside the Package Directory, Configure the Make File, and Run the Compile and Install Commands
Run the
configure
command and read the output:./configure
Correct the issue using the
--without
directive:./configure --without-http_rewrite_module
Continue until your configure runs with no issues:
./configure --without-http_rewrite_module --without-http_gzip_module
Once this has completed, run the compile and install commands:
make sudo make install
- Run Nginx and Ensure It Loads, and Then Stop Nginx
Start Nginx:
sudo /usr/local/nginx/sbin/nginx
Make sure it is working by loading the index page:
curl 127.0.0.1
Locate the master process ID:
ps -ax | grep nginx
Copy the ID of the master process.
Stop Nginx:
sudo kill <MASTER_PROCESS_ID>
Verify Nginx is not running:
ps -ax | grep nginx
It should return only the
grep
command.
- Create a `websrv` Directory, Reconfigure Nginx to Install to That Directory, and Make and Install It to the `websrv` Directory
Ensure you are in the Nginx source directory:
cd ~/nginx-1.16.1
Clean up the
make
environment:make clean
Configure the makefile:
./configure --prefix=/home/cloud_user/websrv --without-http_rewrite_module --without-http_gzip_module
Make the software and install it:
make sudo make install
- Run and Verify That Nginx Is Working from the `websrv` Directory
Start the Nginx you just installed:
cd ~/websrv/sbin sudo ./nginx
Verify it is working:
curl 127.0.0.1
Locate the master process ID:
ps -ax | grep nginx
Stop the process:
sudo kill <MASTER_PROCESS_ID>