How to Install GCC on Ubuntu 25.04

The default Ubuntu repositories contain a meta-package named build-essential that includes the GNU compiler collection (GCC), GNU debugger (GDB), and other development libraries and tools required for compiling software.

Update the System

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

apt update
apt install build-essential

Install GCC Package Dependencies

Install the additional manual pages for development:

apt-get install manpages-dev

After installation, check the installed version of GCC:

gcc --version

Output:

root@server:~# gcc --version
gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0
Copyright (C) 2024 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.

✅ That's it. GCC and related development tools are now installed on your Ubuntu 25.04 system.

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

Create a new file called 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!

🎉 Done! You have successfully installed GCC and compiled your first C program on Ubuntu 25.04.


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