Upgrading nano from v5 to v6

I’ve just spun up a version of Ubuntu in the lab and noticed that nano there is v6.2 with nice syntax highlighting. Rocky comes with v5.6.1 by default. How do you go about upgrading? This is a bit of a generic question about upgrading in general.

Later… okay, I’ve discovered that, in general, you either have to find a repository with the updated version and use dnf commands or compile from source code?

I’ve compiled 7.2 so now I’ve got nano 7.2 in /usr/local/bin/nano. I’ll work on understanding the paths later. But there still isn’t syntax highlighting when editing a yml file. Ohh well!

1 Like

The generic answer is that you don’t. Red Hat decides what RHEL has and maintains those versions. Rocky has what RHEL has. RH backports What is backporting and how does it affect Red Hat Enterprise Linux (RHEL)? - Red Hat Customer Portal so their version is not same as upstream version.

Packages are obviously preferred when available, but one should not replace core components ever, because too much depends on them. The nano is probably safer to replace as it might not be used by anyone else than the users.

The /usr/local is usually the default prefix that the make install does use. However, to install there one has to have admin priviledges (sudo). It is better to never use sudo when “building from sources” and rather choose an another prefix.

Look at output of echo $PATH
Do you see /home/robnicholsonmalt/.local/bin there, before /usr/local/bin ?

If you are the only account that will use the new nano, then you could have installed there.
Assuming that you did use the “configure”, you could have done:

./configure --prefix=~/.local
make install

(or something like that)

It is possible that the fancy feature is an add-on to nano that the base program lacks, but Ubuntu has included, or that it depends on library that your system did not have installed. There are many *-devel packages that are required when building from source, but the configure may also say: “checking for X … not here … skipping feature Y

1 Like

Thanks for the explanation. Will digest later. Since discovered that nano highlighting configuration files are stored in /usr/share/nano. Might just be able to copy/download more. So might be able to go back to the stock version.

Whilst I’m reasonably literate in Linux, I’m certainly not immersed in the culture. Coming from Windows, not updating Notepad++ to the latest version would be weird - not only for bugs but security issues. But I guess the Linux stance is stability. Although I think that ethos is stretched. Bit like Zen of Python.

1 Like