Assembly language interacts directly with machine, hence the NASM assembler software changes with the bit configuration of Linux machine.
In this tutorial we will be focussing on 32-bit Intel IA-32 architecture.

Checking if NASM already exists on your system-

Type the following code in terminal

                                    >> whereis nasm
                                

                                    >> .nasm: /usr/bin/nasm /usr/share/man/man1/nasm.1.gz
                                
If the output shows - nasm: /usr/bin/nasm then you are good to go. 👍

Else if you see the following output - nasm: then you need to follow the below steps to setup NASM.

Steps to setup NASM environment -

  • Open the official NASM website https://www.nasm.us/
  • Click on STABLE latest released version
  • Download the Linux source archive nasm-X.XX.tar.gz, where X.XX is the NASM version number in the archive.
  • Unzip the downloaded tar.gz file at suitable location and open terminal in the newly created NASM folder
  • Type the following command in termianal   >> ./configure
  • This shell script will find the best C compiler to use and set up Makefiles accordingly.
  • Type  >> make to build the nasm and ndisasm binaries.
  • Type  >> make install to install nasm and ndisasm in /usr/local/bin and to install the man pages.
You can also use following terminal command to install NASM -

                                    

>> sudo apt-get install nasm

>> sudo apt-get update

>> whereis nasm


                                    

>> Reading package lists... Done

.

.

.

Setting up nasm

>> 0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.

>> nasm: /usr/bin/nasm /usr/share/man/man1/nasm.1.gz

Now you are all set to start learning basics of NASM.