How to Install GNU Emacs

In this article, we’ll show you how to install GNU Emacs on your server for text editing. You may consider using Emacs as an alternative to nano or Vim for several reasons. You may have already learned how to use Emacs in your Desktop environment and want a remote instance to use for editing files on your server. Or, if you would simply prefer to have a more powerful text editor available on your server, this is a tutorial you should follow.

NOTE: The following instructions require root access available on a VPS or Dedicated Server.

Which Emacs Should I Use?

There are many different flavors and “ports” of Emacs available on the web. Some of the popular ones include Aquamacs and Spacemacs, which are more suitable for a desktop operating system. In this article, we’re focusing on GNU Emacs because it is the general, traditional, progenitor Emacs.

How to Install Emacs from Software Repositories

Your InMotion Hosting VPS account comes with the CentOS operating system. However, in a Cloud VPS, you may have chosen to install a different operating system which would prefer you use a different tool for accessing the software repository. We’ll cover two of the most popular tools: yum and apt.

For sytems in the Red Hat family, which includes CentOS, you can use the yum command to get the version of Emacs available in the repository:

chris@server# sudo yum install emacs

For the Debian family, including Ubuntu, you can run this command (Note: Ubuntu ships with a version of Emacs already installed):

chris@server# sudo apt-get install emacs

How to Install Emacs from Source

In order to install Emacs from source we will need to download the latest version from the Emacs repository maintained by the GNU Project.

Why would you want to install Emacs from source?

One of the most common reasons is availability of the latest and greatest version of the software you’re interested in installing. The version of Emacs available in a software repository used by your operating system may not match up with the latest currently available from the GNU Project.

  1. Log into your server via SSH
  2. Use wget to download the archived file
    chris@server# wget

    Making sure to substitute “VERSION” with the correct version

  3. Uncompress the archived file
    chris@server# tar -zxvf emacs-VERSION.tar.gz

    Again, substituting “VERSION” for the version you are trying to install

  4. Change directory (cd) to the emacs-VERSION directory:
    chris@server# cd emacs25-3.xzf
  5. Run the configuration command:
    chris@server# ./configure

    This command runs through a series of configurations for Emacs and checks to see if any dependencies are missing. If you are missing anything, the configuration will stop and let you know what needs to be installed.

<li>Once the configuration is complete, you can run the <em>make</em> command:
chris@server# make
  • Once make is complete, you can run make install:
    chris@server# make install
  • If you already have Emacs installed on your system, the above procedure will overwrite the currently installed version with the one you are installing now.

    Was this article helpful? Let us know!