Skip to content

Instantly share code, notes, and snippets.

@mscalora
Last active July 24, 2017 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mscalora/8e8ace33e2aaebdaf9ed9261079cc3a5 to your computer and use it in GitHub Desktop.
Save mscalora/8e8ace33e2aaebdaf9ed9261079cc3a5 to your computer and use it in GitHub Desktop.
Install the latest nano on debian or ubuntu quickly from debian unstable with apt apt-get, works great on raspbian too

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment