8

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.

4
  • try running apt-get update before installing again, maybe you have an old version cached somewhere. Instead of uninstalling and reinstalling, first run apt-get update and then run apt-get upgrade nano
    – Cas
    Nov 14, 2016 at 16:15
  • I followed and got nano is already the newest version also checked nano -V still 2.2.6
    – user345866
    Nov 14, 2016 at 16:20
  • Perhaps nano wasn't updated yet in your repositories. The most recent version for Raspbian using default repos is 2.2.6, Ubuntu 16.04 seems to use 2.5.3, and CloudLinux 6.3 seems to still be at 2.0.9.
    – Cas
    Nov 14, 2016 at 16:25
  • Note that nano for Termux is version 5.8; not sure why the regular nano distribution is several versions lower! Sep 16, 2021 at 23:04

3 Answers 3

3

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.

2

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

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

1
  • Note: When I installed this way on Ubuntu, it wrecked the stable install with a non-working version as 3.2.2 had requirements that could not be satisfied.
    – joshfindit
    May 28, 2019 at 19:16
1

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

You must log in to answer this question.