Setting Up NASM and Linking on Linux

Assembly programming on Linux requires two key tools:
NASM (Netwide Assembler) for compiling
.asm
source files.A linker (usually
ld
frombinutils
orgcc
for simplicity) to produce executables.
Here’s how to set them up across various Linux distributions:
🐧 Ubuntu / Debian-based Systems
sudo apt update
sudo apt install binutils # For installing the ld linker (Recommended)
sudo apt install nasm gcc # gcc is also a linker
✔️ nasm
: the assembler
✔️ gcc
: used as linker (you can use ld
too: sudo apt install binutils
)
🐧 Fedora
sudo dnf install nasm gcc
✔️ Fedora handles packages cleanly. nasm
and gcc
are available in the default repos.
🐧 Arch Linux / Manjaro
sudo pacman -S nasm gcc
✔️ Pacman keeps it lean and fast. Everything you need is in the official repositories.
🐧 openSUSE
sudo zypper install nasm gcc
✔️ Zypper delivers both NASM and the GNU toolchain out of the box.
✅ Verifying the Installation
Run:
nasm -v
gcc --version
ld -v # Recommended
You should see version info confirming successful installs.
✅ Recommended Editors
When writing NASM x64 code, choose a text editor that gets out of your way and lets you focus on the bytes:
Nano (Recommended) : Simple, no-nonsense, and pre-installed on most Linux systems. Great for beginners.
Vim: Comes pre-installed in all Linux distributions. Powerful, efficient, and universally available. Steep learning curve, but worth it if you’re serious.
Micro: A modern terminal-based editor that lies between Nano and Vim. One can use the following command in Ubuntu: sudo apt install micro
Sasm: A GUI based lightweight editor which is not pre-installed.
Writing your first “Hello World” in Nasm x64
Subscribe to my newsletter
Read articles from Rawley Amankwah directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
