Updating to latest nano text editor

Currently using Debian 8 and preinstalled is nano 2.2.6, I wish to update nano to the latest version which is 2.7.1.

I tried apt-get remove nano and installing again using apt-get install nano, but it is still version 2.2.6.


I found a workaround on this by modifying /etc/apt/sources.list

from

deb http://mirror.debian.org/debian jessie main contrib non-free
deb-src http://mirror.debian.org/debian jessie main contrib non-free

to

deb http://mirror.debian.org/debian testing main contrib non-free
deb-src http://mirror.debian.org/debian testing main contrib non-free

Removed nano 2.2.6 by apt-get remove nano then apt-get update

Finally install nano by apt-get install nano

Check version by nano -V

I'm running nano version 2.7.0 now

I was logged in as root while doing this so I needed to cp /bin/nano to /usr/bin/nano so I could launch nano directly.

Note: Do not forget to revert your /etc/apt/sources.list

Include as Bryan Cerrati pointed out:

Installation using .deb files.

dpkg -i nano_2.7.1.deb

Get nano at Debian GNU/Linux binaries stable | testing | unstable

Note: Make sure you properly select the appropriate architecture for your machine.


Nano v.2.7.1 is in Debian sid and considered unstable. is not included in wheezy repos by default. you can build it from source or install the .deb package avaliable from debian's mirrors.

Installing .deb file. Depending on your architecture (64 bit or 32 bit) you can download the following packages

  • AMD 64 Machines

  • I386 Machines

heres a Full List of Avaliable Architectures Available Here

Once you have your .deb file, you can install from there.


Installation:

dpkg -i nano_2.7.1-1_amd64.deb

please take a look at the 2.7 release FAQ. If you need advanced installation parameters then compiling from source is contained in the FAQ.


NOTE: i did not include the actual downloadable files as im not sure if that is a rule on stack exchange but i pointed you to the correct download pages so the origin is transparent to all viewing this answer


I've found this to be the easiest and quickest way when I setup a VM, tested on fresh Ubuntu 16.04 Server VM:

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