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.
- Using The
- Install Emacs With GNU Guix Package Manager
- Installing Emacs From Source
If you don’t need cPanel, don't pay for it. Only pay for what you need with our Cloud VPS solutions.
CentOS, Debian, or Ubuntu No bloatware SSH Key management made easy
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
apt install emacs
Or, if you are using a sudo user, you can run the same command but prepended with
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:
Make the install script executable with the
chmod +x guix-install.sh
Run the installation script as your sudo (or root) user:
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 (
# 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:
tar command to open the archive file:
tar -zxvf emacs-27.2.tar.gz
Change directory (
cd) into the directory containing the source files:
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:
make to prepare for the installation process:
Finally, run this command to complete the installation:
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.