I wrote also a windows guide, and most of it is relevant here as well, so make sure you go over it before:
First thing we need is to download the NodeMCU firmware. We do this by downloading one of these BIN files : Download nodemcu latest firmware
After downloading the firmware we need to download a tool that can flash the firmware to the ESP8266: I've used esptool, a great tool to flash any firmware on the ESP8266 not just the NodeMCU.
We can do this by downloading the esptool repository from github : The esptool repository
There are two ways to download a repository from github, one is using the download zip button in the middle part of the page at the right side (There is a picture in the windows guide that shows how it looks like)
The other method is using git:
git clone https://github.com/themadinventor/esptool.git
If you don't have git you can download it using the appropriate command :
List of commands installing git on different distributions
We also need python on our system to run this script with the serial package (it should be installed already but just in case)
After we have all the tools we open a terminal. In the terminal we change the current folder to the path of the esptool folder and enter this command to flash the firmware :
sudo python esptool.py --port /dev/ttyUSB0 write_flash 0x00000 The_Path_To_The_NodeMCU_Firmware.bin
Notice that /dev/ttyUSB0 may change according to the UART you have used and the linux distribution you have chosen.
If you see after a few seconds an output that is similar to this output:
Writing at 0x00000000... (0 %)
Then everything is OK..
If it doesn't get to it after a few seconds.. you might have a problem with the connection of the ESP8266 to the UART so check the connection.
By the way, this tool works on windows as well. If you intend to use it consider you'll need to install WinPython or something else. It seems to me that it would be a more complicated solution. Maybe I'll add it in the near future.
For more practical use of the ESP8266, this firmware and some lua scripts check the more posts on this blog -