I've found this to be the easiest and quickest way when I setup a lean VM with a debian based distro (like debian-cloud, Ubuntu server, Lubuntu, etc) and/or Raspberry Pi (raspbian):
Edit apt sources list with:
sudo nano /etc/apt/sources.list
Add the following lines at the bottom:
deb http://ftp.debian.org/debian unstable main
deb-src http://ftp.debian.org/debian unstable main
Save & exit [ctrl-x, y, RETURN]
Update apt package lists, ignore "is not signed" warnings
sudo apt-get update
If you want to see what versions are available:
apt-cache madison nano
Remove old version of nano:
sudo apt-get -y remove nano
Install latest from unstable:
sudo apt-get -y --allow-unauthenticated install nano
Comment out unstable
repos from sources list by adding '#' in front of the lines we added in the second step using the new version of nano:
sudo nano /etc/apt/sources.list
Refresh the package list
sudo apt-get update
Bonus tip - then I create a .nanorc
file:
nano ~/.nanorc
With the contents:
set quiet
set autoindent
set constantshow
set positionlog
set tabsize 4
set tabstospaces
set nowrap
set suspend
set titlecolor brightyellow,blue
set statuscolor brightyellow,blue
bind ^S savefile main
bind ^G findnext main
bind M-G findprevious main
set backupdir $HOME/nano-backups
set numbercolor cyan,black
set linenumbers
set keycolor cyan,black
set functioncolor blue,black