How To Install Emacs on Ubuntu 20 Cloud Server

Install Emacs on Ubuntu 20

Emacs is a powerful text editor you can install on virtually any Linux server. It’s powerful but also large, so it does not come pre-installed with most Linux distributions. However, if you are comfortable using Emacs, it offers a lot of features that can help you manage and administer your server. In this article, you will learn how to install Emacs on your cloud VPS running Ubuntu 20. (Please note, if you are on a managed cPanel VPS, Emacs may already be installed.)

There are a few different ways to install Ubuntu. You can choose whichever one is easiest for you. The main difference between these two approaches is the version of Emacs you will have when the process completes. For some users, who don’t need the latest and greatest version of Emacs, the apt approach is easiest and quickest. However, if you want the most up-to-date version of Emacs then you will want to try out the GNU Guix package management system or installing Emacs from source.

If you don’t need cPanel, don't pay for it. Only pay for what you need with our scalable Cloud VPS Hosting.

check markCentOS, Debian, or Ubuntu check markNo Bloatware check markSSH and Root Access

Using The apt Package Manager

Your Ubuntu cloud server uses the apt package manager by default, so it is already installed and configured. Your apt installation maintains a list of source repositories from which you can grab and install whatever programs you require. A recent, stable version of Emacs will be listed here. All you need to do is run this command when logged into your server as the root user:

apt install emacs

Or, if you are using a sudo user, you can run the same command but prepended with sudo:

sudo apt install emacs

This will install Emacs along with all the of necessary dependencies. Just type emacs at the command line and you’ll be in a new Emacs installation.

Install Emacs With GNU Guix Package Manager

For the most recent version of Emacs you can try installing and running the GNU Guix package manager. First, you will need to install GNU Guix. While the above installation process can be run as root, I would recommend running this one as your sudo user.

You will need to download an installation script from the GNU servers:

wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh

Make the install script executable with the chmod command:

chmod +x guix-install.sh

Run the installation script as your sudo (or root) user:

sudo ./guix-install.sh

Once the process completes, you should have a working GNU Guix installation. Before installing Emacs, however, you will want to add the following to your personal Bash profile (.profile):

# guix profile 1
GUIX_PROFILE="$HOME/.guix-profile"
. "$GUIX_PROFILE/etc/profile"

#guix profile 2
GUIX_PROFILE="$HOME/.config/guix/current"
. "$GUIX_PROFILE/etc/profile"

export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"

I would recommend rebooting your server at this time. When the server comes back online, you can run this command to install Emacs:

guix install emacs

Allow the process several minutes to complete. Upon completion you should have a copy of the latest version of Emacs available in the Guix repository.

Installing Emacs From Source

Installing Emacs from source code is the most advanced way of getting a working copy of Emacs installed, but it provides you with the most control. Using this method, you can install virtually any version of Emacs you desire, old, current, or bleeding edge. The process described below will overwrite previous installations, so you can run this process to install or upgrade your Emacs.

You will need to first get yourself a recent copy of Emacs source. This example uses version 27.2, but you can replace that filename with any version you desire:

wget https://ftp.gnu.org/pub/gnu/emacs/emacs-27.2.tar.gz

Use the tar command to open the archive file:

tar -zxvf emacs-27.2.tar.gz

Change directory (cd) into the directory containing the source files:

cd emacs-27.2

It would be easiest to run the following as the root user, particularly make install at the end. Or, if not available, you may use the sudo user.

To configure your system for Emacs, you may run the “configure” script:

./configure

Run make to prepare for the installation process:

make

Finally, run this command to complete the installation:

make install

If you come across any errors during this process feel free to share them below, and we will try to help you troubleshoot. Otherwise, you now have a working installation of Emacs in your Ubuntu cloud server.

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!