I’m writing this article to remind myself of an important
err, Linux lesson: how to install
gcc in Linux, at least on Debian
based systems like Ubuntu or Bodhi Linux. I will share a situation I
ran into when trying out a new (to me) distribution, Bodhi Linux, on
VirtualBox and wanted to install the VirtualBox Guest Additions
extensions, which requires C compilation tools.
I would love to entertain you through lessons I have learned the hard way so you don’t make the same mistake (and also look good in front of your peers!) This should take you around two minutes of your time.
Normally, when I want to work on Linux within macOS, I would use VirtualBox and Vagrant, it’s the easiest way to go for a preconfigured installation.
Recently, I needed to access the Linux graphical user interface and had to install Linux from install image, such as an ISO.
Welcome Bodhi Linux
I was trying out Bodhi Linux, because I have a MacBook and wanted something that has lower system requirements than my default, Ubuntu. (My goal is a Linux distribution to use less RAM so I can run my macOS apps while running a Linux virtual machine.)
When I tried to get VirtualBox’s Guest additions installed, I ran into a problem and got the following message:
Follow the Message
Oh, I forgot the VirtualBox Guest Additions needs to rebuild the Linux
kernel, which requires the
gcc compiler. No problem, let’s install
sudo apt-get install gcc
Oh? There’s no target named gcc?? Isn’t that what the command given in the error message??
Let’s Get Lucky?
Let’s see if I can just wildcard this using:
sudo apt-get install
Nope - this doesn’t help either. Time for search!
OK, looks like this is the best way to install gcc on Linux:
$ sudo apt-get install build-essential
This has the added benefit of installing
the ability to build any programs!
Note: this problem doesn’t appear in Ubuntu, which does alias
the right package.
So, by trying out a new Linux distribution, Bodhi Linux, I have
relearned an essential part of Linux: installing the gcc
gcc is a core part of Linux, but installing it isn’t as
sudo apt-get install gcc, at least on Bodhi
Linux (which looks awesome!)