Nginx is a program written in C, so you will first need to install a compiler tool such as the GNU Compiler Collection (GCC) on your system. GCC may already be present on your system, but if that is not the case you will have to install it before going any further.
GCC is a collection of free open source compilers for various languages – C, C++, Java, Ada, FORTRAN, and so on. It is the most commonly used compiler suite in the Linux world, and Windows versions are also available. A vast number of processors are supported, such as x86, AMD64, PowerPC, ARM, MIPS, and more.
First, make sure it isn't already installed on your system:
[alex@example.com ~]$ gcc
If you get the following output, it means that GCC is correctly installed on your system and you can skip to the next section:
gcc: no input files
If you receive the following message, you will have to proceed with the installation of the compiler:
~bash: gcc: command not found
GCC can be installed using the default repositories of your package manager. Depending on your distribution, the package manager will be vary-yum for a Red Hat Linux-based distribution, apt for Debian and Ubuntu, yast for SuSE Linux, and so on. Here is the typical way to proceed with the download and installation of the GCC package:
[root@example.com ~]# yum groupinstall "Development Tools"
If you use apt-get, execute the following command:
[root@example.com ~]# apt-get install build-essentials
If you use another package manager with a different syntax, you will probably find the documentation with the man utility. Either way, your package manager should be able to download and install GCC correctly, after having resolved dependencies automatically. Note that this command will not only install GCC, it also proceeds with downloading and installing all common requirements for building applications from source, such as code headers and other compilation tools.