install nasm for linux

Effortlessly Install NASM on Linux

By Sarah Lewis
AD

Installing NASM (Netwide Assembler) on Linux is a straightforward process that enables you to engage with low-level programming and assemble x86_64 machine code. This guide will walk you through the steps to set up NASM in your Linux environment, ensuring you're ready to dive into the world of assembly language programming.

Before we proceed, ensure you have sudo privileges or are logged in as the root user. This guide assumes you're using a modern Linux distribution like Ubuntu, Fedora, or Arch Linux. Let's get started!

Downloading and Installing NASM

The first step is to fetch the NASM source code from the official website. We'll use wget, a popular command-line tool for downloading files from the web.

AD
Installing NASM and Writing Your First Assembly Program on Linux
Installing NASM and Writing Your First Assembly Program on Linux
Accessing Linux Made Simple 🔐 | Console vs Terminal vs SSH Explained
Accessing Linux Made Simple 🔐 | Console vs Terminal vs SSH Explained
How To Install Linux
How To Install Linux

After downloading the source code, we'll navigate to the downloaded directory and proceed to compile and install NASM. We'll need to have certain build tools and libraries installed on our system to accomplish this.

Installing Dependencies (Ubuntu/Fedora)

If you're using Ubuntu, run the following command to install the necessary build tools and libraries:

a penguin with the text 13 must - have apps for linux users
a penguin with the text 13 must - have apps for linux users
Linux Basics for Beginners 2026 | Complete Starter Guide
Linux Basics for Beginners 2026 | Complete Starter Guide
How to Install and Configure bspwm in Linux - Make Tech Easier
How to Install and Configure bspwm in Linux - Make Tech Easier
/usr/bin/add-apt-repository universe
sudo apt-get update
sudo apt-get install build-essential libncurses5-dev

For Fedora users, the corresponding command is:

sudo dnf install @development-tools ncurses-devel

Installing Dependencies (Arch Linux)

If you're using Arch Linux, you can fetch the required dependencies using pacman:

AD
sudo pacman -S base-devel

Compiling and Installing NASM

Now that we have the necessary tools, let's compile and install NASM.

15 Best Log Viewers and Log Analysis Tools for Linux
15 Best Log Viewers and Log Analysis Tools for Linux
Linux nm Command Tutorial for Beginners (10 Examples)
Linux nm Command Tutorial for Beginners (10 Examples)
a laptop computer sitting on top of a desk with the words how to run a linux desktop using the windows subsytem for linux
a laptop computer sitting on top of a desk with the words how to run a linux desktop using the windows subsytem for linux
How to Install and Use LunarVim on Linux (Complete Guide)
How to Install and Use LunarVim on Linux (Complete Guide)
How to Install WSL on Windows 11 for Linux Apps
How to Install WSL on Windows 11 for Linux Apps
I install these 11 apps on every new Linux system, and you should, too - here's why
I install these 11 apps on every new Linux system, and you should, too - here's why

Change into the NASM source directory and run the `configure` script. This script prepares NASM for compilation on your specific system.

Configuring NASM

After running `configure`, NASM is ready to be compiled. The `configure` script automatically detects your system's settings and configures NASM accordingly.

AD

Next, we'll proceed to compile NASM using the `make` command. This tells Linux to prepare the source code for execution by interpreting the `Makefile` located in the NASM source directory.

a penguin is looking out the window in front of a computer screen that says linux
a penguin is looking out the window in front of a computer screen that says linux

Installing NASM

Finally, we'll install NASM using the `make install` command. This moves the compiled NASM binary and its man page to their appropriate locations in the system directories.

It's essential to keep in mind that installing files directly to system directories requires sudo privileges. Make sure you have the necessary permissions or run the installation commands as the root user.

AD

Once the installation process is complete, you're ready to use NASM in your Linux environment. With NASM installed, you can write, assemble, and run assembly language programs directly from the command line.

Happy coding! Explore the vast world of assembly language programming and make the most of your new tool. Don't forget to check out the NASM manual and online tutorials to enhance your learning experience.

AD