CentOS 8 already comes with GCC 8.
On CentOS 7, you can install GCC 8 from Developer Toolset. First you need to enable the Software Collections repository:
yum install centos-release-scl
Then you can install GCC 8 and its C++ compiler:
yum install devtoolset-8-gcc devtoolset-8-gcc-c++
To switch to a shell which defaults gcc and g++ to this GCC version, use:
scl enable devtoolset-8 -- bash
You need to wrap all commands under the scl call, so that the process environment changes performed by this command affect all subshells. For example, you could use the scl command to invoke a shell script that performs the required actions.
CentOS 8 already comes with GCC 8.
On CentOS 7, you can install GCC 8 from Developer Toolset. First you need to enable the Software Collections repository:
yum install centos-release-scl
Then you can install GCC 8 and its C++ compiler:
yum install devtoolset-8-gcc devtoolset-8-gcc-c++
To switch to a shell which defaults gcc and g++ to this GCC version, use:
scl enable devtoolset-8 -- bash
You need to wrap all commands under the scl call, so that the process environment changes performed by this command affect all subshells. For example, you could use the scl command to invoke a shell script that performs the required actions.
Permanently adding DTS to your development environment
After installing the devtoolset:
yum install devtoolset-8-gcc devtoolset-8-gcc-c++
You can also use the following command, to make DTS the default:
source scl_source enable devtoolset-8
The benefit of this command is that it can be added to .bashrc, so that you don't have to run the scl command every time you login:
scl enable devtoolset-8 -- bash
Videos
I'd recommend using yum localinstall rather than using the rpm command directly; that way you'll have the gcc package in your yum database so that it can keep track of updates. The command would just be:
yum localinstall /mnt/cdrom/CentOS/gcc-(whatever).rpm
You want to use something like rpm -ivh /mnt/cdrom/CentOS/gcc-(whatever).rpm. The command line options there are:
-i-- install (you can use-Uto install or upgrade, many just always use that)-v-- verbose output-h-- show hashmarks, a simplistic progress bar
Yum will figure out which package you mean if you type yum install gcc. That'll use your chosen repository, or the CD if you've got the correct repository installed (which you probably do). In general, yum is easier to use if you're not doing anything strange.
Edit: What happened? When I went to download centos I mistakenly understood centos 7 as being the most recent stable version. Original post below:
Ok, I have only used the mint distro as of yet (for about a year now). I wanted to start getting to know other distros so I repaired an older funky pc's power supply and changed out the windows 7 on it for Centos with Gnome desktop just yesterday. So Centos is new to me and mint has been my experience (but I am still a novice with it).
I checked out the GCC and it's version 4.8.5 . On my mint laptop I was able to install version 10.3.0 through the apt package manager. The search results I get from using yum though do not seem to spit out anything similar as far as I can tell. And the google searches I do seem to all point towards installing from source.
But a friend of mine the other day when discussing how I used my laptop in mint was very emphatic that I should avoid as much as possible installing anything from source that was available already through a package manager, saying that when things later become updated it is much safer and less of a mess to have the package manager handle the changes.
So my noob question is this... Does that type of thinking not apply to the Centos distro? Or is the purpose of Centos less intended for developers? Or something else?
In the end I am too ignorant in this current situation to really know what I am ignorant of so bottom line question is:
In Centos 7 What is the most recommended way to upgrade GCC?
Thanks
Honestly? In a situation like you're in, too little RAM, one of the options you need to explore is to do the compile on some other system and then bring the results to your resource-constrained server. This is what installing an RPM actually is, and you can do a similar thing without learning how to package RPMs.
- On a system with more resources, configure it the same as you would your wee VPS. Hardware will be different, but I don't believe that matters for node.js
- This can be as simple as running CentOS 6.3 in VirtualBox on your laptop, or spending a few hours on a cloud-provider for a larger instance-type and doing it there.
- Compile node.js
- Run the configure & make, but do NOT do
make installyet.
- Run the configure & make, but do NOT do
- Tar up the compiled directory
- Transfer to your wee VPS & extract
- Run
make install.
This should work since install scripts are typically more concerned with moving files around than they are compiling stuff, and are therefore rather RAM-light.
You are on openvz which leads to me to suspect the host is being oversold. Because you cant have swap on it there normally should be burstable memory to catch a temporarily shortcome of memory. This is a known issue with openvz, but which it's not problematic unless the host has too many vms.
You will need to either order extra memory for your instance or just move the vps elsewhere.