how to install gcc in centos 7. First you need internet connection to install it i.e. online installartion. To install offline i.e. without internet connection, read up to last
1. download gcc. I've gcc-9.3.0.tar.gz and extract it somewhere, with taking care of "no space" in path of gcc extracted folder as mine : "/opt/gcc-9.3.0"
2. run following command ( run shell script located in contrib/download_prerequisites, this is a file) like this:-
# ./contrib/download_prerequisites ( press Enter )
here you need to be in main directory of gcc ( i.e. gcc-9.3.0 ), you can not run it in its own directory i.e. in "contrib" dir.
this file will download all supporting softwares needed to gcc.
As I did here :-
[root@kaljayi gcc-9.3.0]# ./contrib/download_prerequisites
18:25:27 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1]
18:25:32 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
18:25:36 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1]
18:25:41 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2 [1658291] -> "./isl-0.18.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.18.tar.bz2: OK
All prerequisites downloaded successfully.
[root@kaljayi gcc-9.3.0]#
make a directory parallel to gcc-9.3.0 as named "objdir".
then do this :-
2. # cd ../objdir/
3. # ./../gcc-9.3.0/configure --disable-multilib ( to install only 64 bit library )
4. # make
5. # make install
this installation will take minimum 3-4 hour.
thats it all.
To save gcc tar ball to install it for future use without internet connection i.e offline installation, do this :-
after running ./contrib/download-prerequisites compress gcc folder by right clicking on gcc folder and select "compress" as tar.gz. This will create tar ball as gcc-9.3.0.tar.gz with all prerequisites inside it. For installing it without internet connection, extract it by right cilicking it select exract here. Then goto inside it and run command :
# ./countrib/download_prerequisites ( press enter )
this will setup links as it is done as with internet connection, then install gcc. It will be installed fairly.
No comments:
Post a Comment