While compiling or running C based code on Amazon Linux 2 you might face the following issue: gcc: command not found
. That means that you don’t have GCC package installed which is used to compile C and C++. Let’s see how to install GCC on Amazon Linux 2.
Prerequisites
- Amazon Linux 2
- sudo privileges
Install gcc on Amazon Linux 2
Step 1. Update the EC2 packages.
sudo yum update
Step 2. Install GCC on Amazon Linux 2.
sudo yum groupinstall "Development Tools"
Step 3. Verify the installation.
gcc --version
Output:
gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-15)
Copyright (C) 2017 Free Software Foundation, Inc.
Conclusion
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.