nasm ubuntu install

Nasm on Ubuntu: Easy Installation Guide

By Mark Young
AD

Installing NASM (Netwide Assembler) on Ubuntu is a straightforward process that enables you to compile assembly language programs. NASM is a popular choice among developers for its adaptability and widespread use in the industry.

Before we delve into the installation process, ensure your Ubuntu machine has the necessary permissions and that your system is up-to-date. This guide assumes you're using Ubuntu 18.04 or later.

Updating Your System and Installing Essential Packages

First, update your system to ensure you have the latest packages and security patches.

AD
Installing NASM and Writing Your First Assembly Program on Linux
Installing NASM and Writing Your First Assembly Program on Linux
an image of a computer screen with windows on it
an image of a computer screen with windows on it
an image of a computer screen showing the time and date for each event on it
an image of a computer screen showing the time and date for each event on it

Open your terminal and run the following commands:

```bash sudo apt update sudo apt upgrade ```

Installing Build-Essential Packages

Next, install the build-essential packages, which include a C compiler (GCC) and other necessary tools. These packages are fundamental for compiling NASM and any other software from source.

an image of a purple wallpaper with icons on the screen and in the background
an image of a purple wallpaper with icons on the screen and in the background
an orange circle with white dots in the center and two smaller circles at the bottom
an orange circle with white dots in the center and two smaller circles at the bottom
I stopped using Ubuntu for self-hosting and traded it for this lightweight alternative
I stopped using Ubuntu for self-hosting and traded it for this lightweight alternative

Run the following command to install them:

```bash sudo apt install build-essential ```

Installing the وأخ Renaud de Spindler’s Maintenance Package Repository

NASM is not available in the default Ubuntu repositories. Therefore, we need to add the akبينevich's PPA (Personal Package Archive) to gain access to the latest NASM version.

AD

First, update the package list, then run the following commands to add the PPA and update the package list again:

How to Install Multimedia Codecs on Ubuntu Linux
How to Install Multimedia Codecs on Ubuntu Linux
Ubuntu 24.04 lts
Ubuntu 24.04 lts
Ubuntu - Environment
Ubuntu - Environment
Ubuntu - Server Installation
Ubuntu - Server Installation
linux lubuntu rice — linux os desktop aesthetic ricing (evangelion)
linux lubuntu rice — linux os desktop aesthetic ricing (evangelion)
Informática constructiva
Informática constructiva
```bash sudo add-apt-repository ppa:ak auxqu/en1 sudo apt update ```

Installing NASM

Now that we have the necessary prerequisites and the PPA added, we can install NASM.

Run the following command to install NASM:

AD
```bash sudo apt install nasm ```

Verifying the Installation

To confirm NASM is installed correctly, check its version by running:

10 Must-Have Ubuntu Apps Right After a Fresh Install
10 Must-Have Ubuntu Apps Right After a Fresh Install
```bash nasm -version ```

This command should display the installed NASM version's information.

Using NASM to Create an Assembly Program

Now that NASM is installed and verified, let's create a simple "Hello, World!" assembly program using the .asm extension.

AD

Open your preferred text editor, such as nano, and create a new file named hello.asm. Write the following code:

```assembly section .data msg db 'Hello, World!', 0xa section .text global _start _start: mov eax, 4 mov ebx, 1 mov ecx, msg mov edx, 13 int 0x80 mov eax, 1 xor ebx, ebx int 0x80 ```

Save the file and exit the editor. Finally, compile and run the program using the following commands:

```bash nasm -f elf32 hello.asm -o hello.o ld -m elf_i386 hello.o -o hello ./hello ```

You should see "Hello, World!" printed to the terminal, indicating that NASM is working correctly.

You are now ready to compile and run assembly language programs using NASM on your Ubuntu machine. Happy coding! Consider exploring the vast world of assembly language and вскоре increasing your coding skills.

AD