How To Install Gcc Compiler In Redhat Linux 7
In this article I will accept yous through the steps to install GCC on CentOS 7. As per GCC Certificate ,The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, also as libraries for these languages (libstdc++,...). GCC was originally written equally the compiler for the GNU operating organisation. The GNU system was developed to exist 100% free software, free in the sense that it respects the user'due south freedom.
Install GCC On CentOS vii
Also Read: How to install PHP on Ubuntu 18.04
Stride 1: Prerequisites
a)Y'all need to have a running CentOS 7 System.
b)Too you lot need to have wget installed in your system with internet connection.
c)Lastly you demand to login with root access or user with sudo access to run gcc installation commands. In this tutorial, I am using root access.
Step 2: Update Your Organisation
Firstly you need to update your system using yum update command. This command volition update all the currently installed packages in your system to the latest available version.
[root@localhost ~]# yum update Loaded plugins: fastestmirror Determining fastest mirrors * base: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 .................................... Footstep 3: Download and Install GCC from Repository
Download from Repository and install gcc tool using yum install gcc control.
[root@localhost ~]# yum install gcc Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base of operations: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in Resolving Dependencies --> Running transaction check ---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed --> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64 .........................................
Step 4: Install from Source Lawmaking.
In that location is another method that you tin can use to install gcc tool in your system, that is through source lawmaking which is also the recommended way to install.
Download Source Code
Download GCC Source File from GNU FTP Site using wget. It volition download gcc package in local directory.
[root@localhost ~]# wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz --2019-12-31 04:47:37-- https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz Resolving ftp.gnu.org (ftp.gnu.org)... 209.51.188.20, 2001:470:142:3::b Connecting to ftp.gnu.org (ftp.gnu.org)|209.51.188.20|:443... connected. HTTP asking sent, pending response... 200 OK Length: 124304709 (119M) [application/x-gzip] Saving to: 'gcc-9.2.0.tar.gz' 100%[==============================================================================================================================>] 124,304,709 ii.83MB/due south in 49s 2022-12-31 04:48:27 (two.43 MB/s) - 'gcc-9.ii.0.tar.gz' saved [124304709/124304709]
Excerpt the Files
Once downloaded, you need to extract the gcc package by using tar -xvf gcc-9.two.0.tar.gz command.
[root@localhost ~]# tar -xvf gcc-nine.2.0.tar.gz Build the Configuration
Once extracted go to gcc-ix.2.0 directory by doing cd gcc-ix.2.0 and run ./configure.
[root@localhost ~]#cd gcc-nine.2.0 [root@localhost ~]#./configure
Compile the Source Code
One time configuration completed successfully, now it is time to compile the source code by running brand control.
[root@localhost ~]#make Install GCC Using make
Once all the source code are compiled, it is now time to install them using brand install command.
[root@localhost ~]#make install NOTE:
As per make man page, The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. The manual describes the GNU implementation of make, which was written by Richard Stallman and Roland McGrath, and is currently maintained past Paul Smith. Our examples evidence C programs, since they are most mutual, but you lot tin use make with any programming linguistic communication whose compiler tin be run with a shell command. In fact, make is non express to programs. You tin can utilize information technology to draw any task where some files must exist updated automatically from others whenever the others change.
Step 5: Check GCC Version
Once GCC is installed in your arrangement, y'all tin can cheque the gcc version by using gcc --version control.
[root@localhost ~]# gcc --version gcc (GCC) 4.8.v 20220623 (Red Lid 4.8.5-39) Copyright (C) 2022 Complimentary Software Foundation, Inc. This is free software; come across the source for copying conditions. In that location is NO warranty; not even for MERCHANTABILITY or Fettle FOR A Item PURPOSE Step vi: Write Your first C Programme
Since that we have installed GCC Compiler now, allow'south write our Beginning "Hello World" C Program.
[root@localhost ~]# cat how-do-you-do.c #include <stdio.h> void main() { printf("Hello Globe\n"); }
Let'due south Compile this Plan.
[root@localhost ~]# gcc -o hello hello.c Check the Output. Information technology shows Hello World in the output.
[root@localhost ~]# ./how-do-you-do Hello World Also Read: How to create a Filesystem on Linux Sectionalization
Pop Searches
- centos install gcc
- gcc linux
- what is gcc
- gcc download
- gcc latest version
Source: https://www.cyberithub.com/install-gcc-and-c-compiler/
Posted by: callahanhalwas.blogspot.com

0 Response to "How To Install Gcc Compiler In Redhat Linux 7"
Post a Comment