Speech:Spring 2017 GCC G++ Install Documentation

GCC & G++ Install Instructions

Author: Jeremy Beal

This is the documentation on how to install GCC and G++ onto a server.

Step 1 Sign into Caesar as root login as: root root@caesar.unh.edu's password: Last login: Wed Apr 26 14:02:46 2017 from nt-238-73.w4.unh.edu / __ \ \____/\__,_|\___||___/\__,_|_|                  Welcomes you!
 * / \/ __ _  ___  ___  __ _ _ __
 * |   / _` |/ _ \/ __|/ _` | '__|
 * \__/\ (_| | __/\__ \ (_| | |

[root@caesar ~]#

Step 2 Create snapshot directories for GCC and G++. mkdir snapshots cd snapshots mkdir gcc mkdir g++ cd gcc mkdir pre-gcc mkdir post-gcc cd .. cd g++ mkdir pre-g++ mkdir post-g++

Step 3 Take snapshots of Caesar's files from the following directories into the pre-gcc directory. /bin /lib /usr/bin /usr/sbin /usr/lib /usr/share/libgnomekbd /usr/share/libgweather /usr/share/libhangul /usr/share/librarian /usr/share/libthai /usr/share/libtool /usr/share/libwacom /var/lib /var/local /sys

The snapshots will use the ls -al command. This command needs to be repeated for each directory. ls -al /usr/bin > snapshot/pre-gcc/usr-bin.txt ls -al /usr/lib > snapshot/pre-gcc/usr-lib.txt ... ls -al /usr/var > snapshot/pre-gcc/usr-var.txt

Step 4 Type the command to install GCC. The output of this will let the user know if the installation has been completed and what packages were updated or installed. yum install gcc

If successful, the output of this should look something like this:

=
=================================================================== Package        Arch       Version              Repository                Size

=
=================================================================== Installing: gcc            i686       4.4.7-17.el6         rhel-6-server-rpms       8.2 M Installing for dependencies: cloog-ppl      i686       0.15.7-1.2.el6       rhel-6-server-rpms        93 k cpp             i686       4.4.7-17.el6         rhel-6-server-rpms       3.4 M mpfr            i686       2.4.1-6.el6          rhel-6-server-rpms       153 k ppl             i686       0.10.2-11.el6        rhel-6-server-rpms       1.3 M

Transaction Summary

=
=================================================================== Install      5 Package(s)

Total download size: 13 M Installed size: 29 M Is this ok [y/N]: y Downloading Packages: (1/5): cloog-ppl-0.15.7-1.2.el6.i686.rpm                |  93 kB     00:00 (2/5): cpp-4.4.7-17.el6.i686.rpm                        | 3.4 MB     00:01 (3/5): gcc-4.4.7-17.el6.i686.rpm                        | 8.2 MB     00:02 (4/5): mpfr-2.4.1-6.el6.i686.rpm                        | 153 kB     00:00 (5/5): ppl-0.10.2-11.el6.i686.rpm                       | 1.3 MB     00:00

Total                                          2.2 MB/s |  13 MB     00:05 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : ppl-0.10.2-11.el6.i686                                      1/5 Installing : cloog-ppl-0.15.7-1.2.el6.i686                               2/5 Installing : mpfr-2.4.1-6.el6.i686                                       3/5 Installing : cpp-4.4.7-17.el6.i686                                       4/5 Installing : gcc-4.4.7-17.el6.i686                                       5/5 Verifying : mpfr-2.4.1-6.el6.i686                                        1/5 Verifying : cpp-4.4.7-17.el6.i686                                        2/5 Verifying : cloog-ppl-0.15.7-1.2.el6.i686                                3/5 Verifying : gcc-4.4.7-17.el6.i686                                        4/5 Verifying : ppl-0.10.2-11.el6.i686                                       5/5

Installed: gcc.i686 0:4.4.7-17.el6

Dependency Installed: cloog-ppl.i686 0:0.15.7-1.2.el6           cpp.i686 0:4.4.7-17.el6 mpfr.i686 0:2.4.1-6.el6                   ppl.i686 0:0.10.2-11.el6

Complete!

You can double-check that GCC has been implemented by using this command to see if it returns an error: gcc --version

Step 5 Once the installation has been completed, take snapshots of the post-installation files. ls -al /usr/bin > snapshot/post-gcc/usr-bin.txt ls -al /usr/lib > snapshot/post-gcc/usr-lib.txt ... ls -al /usr/var > snapshot/post-gcc/usr-var.txt

Step 6 To see the differences made by the installation, you can use the diff command. diff pre-gcc/lib.txt post-gcc/lib.txt

The output of affected directories will look like this: 2c2 < dr-xr-xr-x. 18 root root  12288 Mar  8 16:48. --- > dr-xr-xr-x. 18 root root  12288 Mar 22 15:20. 4a5 > lrwxrwxrwx. 1 root root     14 Mar 22 15:20 cpp -> ../usr/bin/cpp

Step 7 Next is the G++ installation. Like with GCC, you will create snapshots of the directories into the pre-g++ directory. ls -al /usr/bin > snapshot/pre-g++/usr-bin.txt ls -al /usr/lib > snapshot/pre-g++/usr-lib.txt ... ls -al /usr/var > snapshot/pre-g++/usr-var.txt

Step 8 Like with GCC, G++ only uses one yum install command: yum install gcc-c++

The output of running the yum install should look like this

=
=================================================================== Package             Arch      Version           Repository               Size

=
=================================================================== Installing: gcc-c++             i686      4.4.7-17.el6      rhel-6-server-rpms      4.3 M Installing for dependencies: libstdc++-devel     i686      4.4.7-17.el6      rhel-6-server-rpms      1.6 M

Transaction Summary

=
=================================================================== Install      2 Package(s)

Total download size: 5.9 M Installed size: 18 M Is this ok [y/N]: y Downloading Packages: (1/2): gcc-c++-4.4.7-17.el6.i686.rpm                    | 4.3 MB     00:01 (2/2): libstdc++-devel-4.4.7-17.el6.i686.rpm            | 1.6 MB     00:00

Total                                          3.1 MB/s | 5.9 MB     00:01 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : libstdc++-devel-4.4.7-17.el6.i686                           1/2 Installing : gcc-c++-4.4.7-17.el6.i686                                   2/2 Verifying : libstdc++-devel-4.4.7-17.el6.i686                            1/2 Verifying : gcc-c++-4.4.7-17.el6.i686                                    2/2

Installed: gcc-c++.i686 0:4.4.7-17.el6

Dependency Installed: libstdc++-devel.i686 0:4.4.7-17.el6

Complete!

Confirm that the installation was successful with this command: g++ --version

Step 9 Take snapshots of the directories after the installation, then compare them like before. ls -al /usr/bin > snapshot/post-g++/usr-bin.txt ls -al /usr/lib > snapshot/post-g++/usr-lib.txt ... ls -al /usr/var > snapshot/post-g++/usr-var.txt

diff pre-g++/lib.txt post-g++/lib.txt