How Do You Install a C Compiler on Linux?

Problem scenario
You want to program in the C programming language on a Linux server.  How do you code in C and test your programs?

Solution
Overview

Install the C compiler.

Procedures
1.  To find your distribution of Linux run this command:  cat /etc/*-release | grep -i pretty

2.  Find the one option of the below three that applies to your Linux:

  • For a Red Hat distribution (e.g., CentOS/RHEL/Fedora), run this command:  sudo yum -y install gcc gcc-c++
  • For a SUSE distribution of Linux, run this command:  sudo zypper -n install gcc gcc-c++

          # If you need assistance configuring a repository for SUSE for the first time, see this posting.

  • For Debian or Ubuntu distributions, run this command:

           sudo apt-get -y update &&sudo apt-get -y install build-essential

Leave a comment

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