How to Install GCC on Ubuntu 26.10

The default Ubuntu repositories provide a meta-package called build-essential, which includes the GNU Compiler Collection (GCC), GNU Debugger (GDB), and other development tools and libraries required for compiling software.

Update the System

First, update the package list and install the required packages:

apt update
apt install build-essential -y

Install GCC Package Dependencies

Install the additional development manual pages:

apt install manpages-dev -y

After installation, check the installed version of GCC:

gcc --version

Output:

root@vps:~# gcc --version
gcc (Ubuntu 15.3.0-4ubuntu1) 15.3.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Note: The GCC version and output may vary depending on the available Ubuntu 26.10 repository packages.

GCC and the related development tools are now installed on your Ubuntu 26.10 system.

Compile a Basic C Program Using GCC

Compiling a basic C program using GCC is straightforward. Let's create a simple Hello World program.

Create a new file named hello.c:

nano hello.c

Add the following code:

// hello.c
#include <stdio.h>

int main() {
    printf("Hello, world!\n");
    return 0;
}

Save and exit the file.

Now compile the program and run it:

gcc -o hello hello.c
./hello

Output:

Hello, world!

You have successfully installed GCC and compiled your first C program on Ubuntu 26.10.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS