How to install nano editor from source code

Many times, the Linux distributions you are using choose to not update the software you are using (in our case, nano) to the latest version. This in most cases because of security concerns. For example, in our case, the latest nano version is 2.3.1 – when on the site the latest version is 2.7.4

root@web [/]# nano --version
 GNU nano version 2.3.1 (compiled 04:47:52, Jun 10 2014)
 (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 2008, 2009 Free Software Foundation, Inc.
 Email: nano@nano-editor.org    Web: http://www.nano-editor.org/
 Compiled options: --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8
root@s04 [/]# yum update nano
Loaded plugins: fastestmirror, tsflags, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 185.125.185.32
 * cpanel-addons-production-feed: 185.125.185.32
 * cpanel-plugins: 185.125.185.32
 * base: centos.mirrors.hoobly.com
 * epel: reflector.westga.edu
 * extras: mirrors.advancedhosters.com
 * updates: reflector.westga.edu
No packages marked for update
root@web [/]#

To install nano from source code:

1. Remove the default yum version

yum remove nano

2. Download and uncompress the nano source code archive. Find the latest version at https://www.nano-editor.org/dist/

wget https://www.nano-editor.org/dist/v4/nano-4.7.tar.gz
tar -zxvf nano-4.7.tar.gz

3. Go to the archive’s directory and install nano:

cd nano-4.7
./configure
make
make install

4. Now you are using the latest version of the nano version

root@web [~]# nano --version
 GNU nano, version 4.7
 (C) 1999-2011, 2013-2019 Free Software Foundation, Inc.
 (C) 2014-2019 the contributors to nano
 Email: nano@nano-editor.org    Web: https://nano-editor.org/
 Compiled options: --disable-libmagic --enable-utf8
root@web [~]# 

Related articles:
Install nano with yum
nano website