It is actually very easy, just read the compile instruction in the repository. Lets assume, you want to compile the latest version v7.2
yourself.
- Enable jammy sources for
apt
and update the repositories
$ sudo bash -c 'echo "deb-src http://archive.ubuntu.com/ubuntu/ jammy main" > /etc/apt/sources.list.d/jammy_sources.list'
$ sudo apt update
- Install all build dependencies from Ubuntu for nano
$ sudo apt build-dep nano -y
- Install
git
for cloning the nano repo and checkinstall
for easy Debian package generation.
$ apt install git checkinstall -y
- Clone, checkout v7.2, generate autotools files, configure and build nano
$ git clone https://git.savannah.gnu.org/git/nano.git
$ cd nano
$ git checkout v7.2
$ ./autogen.sh
$ ./configure
$ make -j$(nproc)
- Finally install the package with
checkinstall
. Since Ubuntu has already a nano
package, we will call the package mynano
to avoid conflicts.
$ sudo checkinstall -D -y --pkgname=mynano
That's it. Now you will find nano in /usr/loca/bin/nano
Therefore it will not damage the original nano package and due to the execution order in the $PATH
, it will be called, even if the normal nano package is installed.
If you want or need to remove your self build nano, just call:
$ sudo dpkg -r mynano