How To Install Emacs on AlmaLinux 9
In this tutorial, we will show you how to install Emacs on AlmaLinux 9. AlmaLinux, a robust and enterprise-ready Linux distribution, offers a powerful platform for various computing needs. Among the essential tools for system administrators, programmers, and power users, text-based editors hold a special place. In the world of Linux text editors, Emacs shines as a versatile and feature-rich choice
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of GNU Emacs on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Emacs.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Emacs on AlmaLinux 9
Step 1. Before diving into the installation process, ensure your AlmaLinux 9 system is up-to-date. Run the following commands in your terminal:
sudo dnf clean all sudo dnf update
The first command cleans up the package cache, and the second command performs the system update.
After updating your system, it’s a good practice to verify that the process was completed successfully. You can do this by running:
sudo dnf list updates
Step 2. Installing Emacs on AlmaLinux 9.
Emacs is renowned for its extensibility and powerful features. To install it on your AlmaLinux 9 system, follow these steps:
sudo dnf install emacs
AlmaLinux will prompt you to confirm the installation by entering ‘y.’ Press ‘y‘ and then ‘Enter‘ to proceed.
Once the installation is complete, you can verify the Emacs version to ensure it was installed correctly:
emacs --version
To start Emacs for the first time, simply type:
emacs
Step 3. Basic Emacs Usage.
Now that you have Emacs installed, let’s explore some basic usage to get you started:
Opening and Creating Files
- To open an existing file, press
Ctrl-x Ctrl-f
and type the file’s path. - To create a new file, press
Ctrl-x Ctrl-f
and specify a new file name.
Basic Navigation
- Use the arrow keys or
Ctrl-n
(next line),Ctrl-p
(previous line),Ctrl-f
(forward), andCtrl-b
(backward) to navigate through your text.
Editing and Saving Files
- To start typing, simply begin typing on your keyboard.
- To save your changes, press
Ctrl-x Ctrl-s
. - To undo changes, press
Ctrl-x u
.
Exiting Emacs
To exit Emacs:
- Press
Ctrl-x Ctrl-c
. - Emacs will ask if you want to save any unsaved changes. Press ‘y’ or ‘n’ accordingly.
Step 4. Troubleshooting.
While installing and using Emacs on AlmaLinux 9 is generally straightforward, you may encounter some issues along the way. Here are some common problems and their solutions:
Issue: Emacs Won’t Start
- Solution: Ensure you installed Emacs correctly using
sudo dnf install emacs
. Check for any error messages during installation.
Issue: Missing Packages
- Solution: If you encounter “Package not found” errors when installing packages, update your package repository and try again.
Issue: Conflicting Keybindings
- Solution: If you experience conflicts with system shortcuts, consider reassigning Emacs keybindings in your
init.el
file.
Congratulations! You have successfully installed Emacs. Thanks for using this tutorial for installing GNU Emacs on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Emacs website.