Ceci est une ancienne révision du document !
Let’s face it, Snaps, Appimages and Flatpaks are wonderful, if you live in a first world country with bucket-loads of bandwidth. However, downloading a 100MB file, when the source is 3MB, is an utter waste. (Most of the rest of the world is limited by bandwidth). New users are always afraid of the command-line. Why? Because Linux switches and options are confusing. Not most commands, mind you. [On Telegram, I often see kids install Kali. On the Gnu/ Linux Telegram group it is a running joke, and a search for the phrase “Kali” brings up more results than any other. They cannot even comprehend the terminal, but “want to be hacker” - sic. The terminal sometimes seems like a magical language to them that will give them just illegal access – like in Mr. Robot].
Lots of professionals look down on building your own software. Yes it can be tedious and time consuming, but not everything is in the repositories, and even if it is, sometimes you need a later version. Ubuntu is by no stretch of the imagination a “bleeding edge” distribution, being based on Debian. Sometimes packages are old, or just won’t be updated any more. (Ubuntu 14.04 may have an old version of VLC and you would like to play HVEC movies). In this issue, we here at Full Circle would like to take your hand and take the first step with you of your thousand step Linux journey.
Nano is a terminal text editor. A really handy, basic editor. It can be extended with syntax highlighting, etc, but the version that ships with ubuntu is too old. If you are on 18.04 or 18.10, you are stuck with version 2.9 of Nano, and Disco Dingo with 3.2. Gnu Nano, however, has moved on to version 4.2 (April 2019) https://www.nano-editor.org/. Shall we make our version 4.2 too? Okay, don those coveralls, ready the spanners and we shall look at the terminal.
Getting Nano
Yes, you can just click on the download link, but since we are in the terminal, (let’s face it, a browser may not always be available), we will stay there. Type the following:
wget https://www.nano-editor.org/dist/v4/nano-4.2.tar.gz
Or use curl if wget not available:
curl https://www.nano-editor.org/dist/v4/nano-4.2.tar.gz > nano-4.2.tar.gz
That code just fetches nano for you. No options, no switches. This should boost your confidence a bit if you are new.
To untar your .gz file is going to require some switches. (Should things have changed in the meantime, just correct the URL to reflect the latest version):
tar xvzf nano-4.2.tar.gz
Should you look at the tar manpage, I would like to draw your attention to the “option styles” section. Feel free to read the whole thing, just know it has more options and settings than Lee’s in a Chinese telephone directory. Your homework, should you choose to accept it, is to look up x, v, z, f options. Finding it yourself, instead of me telling you, is much more rewarding!
Installation
Right, now we have the latest version of Nano, but how do we install it? (Change into the unzipped folder first). Again, it is back to reading, so the lazy won’t survive. Most software that you download from source has a ‘readme’ file attached. The file may have weird extensions, sometimes ‘.md’, but look for the readme-file. In our case it’s just README:
less README
Yes, that’s it. Use a pager to read the file. You will see the instructions in clear text.
TIP: You may need to install build-essentials before attempting the next part. (Don’t worry, you won’t install it twice)
sudo apt install build-essential
(This brings in everything you will need to build your program).
Now we build according to the README-file.
./configure
make
make install
If you open Nano now, You will see it still displays 2.9.3. This is not an error, you need to log out and back in again. You do not need to do this with every piece of software you build from source though. That’s it, you are done. Nano is now the latest version… But wait, there’s more…
The next step: (We won’t leave you hanging!).
Nano, like Conky, is configurable via an “rc-file”. You can set it up for whatever you are doing. I am going to take the shotgun approach and get you going for ‘most’ use cases. (Syntax highlighting):
mkdir ~/.nano
cd .nano
git clone https://github.com/scopatz/nanorc.git ~/.nano
and you can set up the one you need. (You know how to run configure and make).
Alternatively… (the easy way):
wget https://raw.githubusercontent.com/scopatz/nanorc/master/install.sh -O- | sh
Now I do not have to tell you how dangerous it is to run a shell script with wget from a website. Luckily in our case we can actually have a look at the install script beforehand. Have a look yourself and calm down once you see it is harmless. Hooray for open source! Now look at my pretty!
References and further reading:
https://github.com/scopatz/nanorc/
http://www.linuxfromscratch.org/blfs/view/svn/postlfs/nano.html
https://linuxhint.com/configure_nano_text_editor_nanorc/
https://medium.com/@005/the-gnu-nano-editor-for-serious-writers-36f6decf8fad