DEV Community

Peter Cooper
Peter Cooper

Posted on

How to Install the `nano` Text Editor on AWS CloudShell

I know the basics of vim and I even know how to exit it(!) but I'd much rather use GNU Nano as my editor at the terminal. Yet, the Amazon Linux 2 distribution with AWS CloudShell doesn't include it!

Here's what to do to install it into your home folder so that it remains in place long-term:

# Install basic developer tools and dependencies
sudo yum -y groupinstall "Development Tools"
sudo yum -y install git-core zlib zlib-devel gcc-c++ patch readline readline-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel xz

# Download and compile nano
cd ~
mkdir ~/bin
wget https://www.nano-editor.org/dist/v5/nano-5.4.tar.xz
tar xf nano-5.4.tar.xz
cd nano-5.4
./configure --prefix=$HOME
make && make install

# Clean up and add ~/bin to PATH
cd ..
rm -rf nano-5.4
rm nano-5.4.tar.xz
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Now you can run nano:

nano
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
ericardiansa profile image
EricArdiansa

thank you.. really helpful