Saturday, August 4, 2018

Installing Emacs on CPanel with GoDaddy.com Web Hosting

NOTE: This was updated 7/1/2020 with some changes, because I had to install emacs *again* when GoDaddy attempted to solve a wordpress problem and nuked my entire home & bin directories. 

August 14, 2018: Once upon a time last year, I installed "emacs" -- an old UNIX command-line editor that I got used to in college -- onto my GoDaddy.com CPanel web hosting server. Today, I had to do it again on a new server, but I couldn't remember exactly what I did last time because I assumed I'd never have to do it again. Well, I am, and I'm documenting it here because these steps don't seem to be documented well online.




It's a little-known fact that, despite CPanel's "Installatron" feature not having much useful to install, you CAN still install programs on your CPanel server without "root" (sudo) access! This tutorial assumes that you have enabled SSH access on your GoDaddy CPanel account and are using a tool like "Putty" to SSH (modern, secure version of "telnet") into your server (first time just say "yes" to the "key") and you can now see a command-line prompt.

Of course, if you're not on the current CPanel system that I am (check by typing "uname -a" in the command line, which, for me generates "2.6.32-896.16.1.lve1.4.54.el6.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux"), you may have to Google your way out of it. But here's what I did.

First, you need to download the source code by typing:
lynx http://gnu.mirrors.hoobly.com/emacs/emacs-26.3.tar.gz
(More recent versions can be obtained by browsing here).  The Lynx web browser interface will ask you if you want to download the file, which you do by clicking "d" on your keyboard. When it's done, you'll have to use your arrow key to highlight the download button to save the file. Then, type:
gunzip emacs-26.3.tar.gz
(This could take a while). Follow it up with:

          tar -xvf emacs-26.3.tar.gz

This will explode all the installation files into a directory called "emacs-26.3". "cd" into that directory, then type this:
./configure --with-x-toolkit=no --with-gif=no --with-gnutls=no
This will result in a long list of checks as the installer readies for your machine's environment. If it ends with some talk about "mail," then it successfully installed. If it doesn't, it should give you some advice for additional "=no" statements to add to the line above.

This was the part that really confused me -- running the configure executable failed multiple times until I added those commands. If you're just looking for command-line emacs, you won't need them anyway.

   Next, type "make" on the command line and you should see a long list of installation files scroll by as it installs the software, looking something like this:



And, finally, type "src/emacs" and you should see the emacs interface! Woohoo! It's a freaking miracle.(Ctrl-X then Ctrl-C to get out).

You can also set an "alias" when you login to point to the exact directory where that executable "emacs" file is. To do this (assuming you're using "bash"):

           echo 'alias emacs="/home/youraccountnamehere/bin/emacs-26.3/src/emacs"' >> ~/.profile; source ~/.profile

If you want to learn emacs, click here, but be warned it's also a pain in the ass, but I got used to it in college when I didn't have any choice besides command-line editing.  "Pico" is another popular UNIX editor that is much easier to use.