How To Install Emacs on AlmaLinux 9
In this tutorial, we will show you how to install Emacs on AlmaLinux 9. Emacs, the legendary text editor, has been a staple in the Linux community for decades. Its powerful features, extensibility, and versatility make it a favorite among developers, writers, and power users alike.
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. Updating the System.
To ensure a successful installation and optimal performance of Emacs, it is crucial to update your AlmaLinux 9 system before proceeding with the installation. Updating the system helps resolve any potential dependency issues and ensures that you have access to the latest security patches and bug fixes. To update your system, open the terminal and run the following commands:
sudo dnf clean all sudo dnf update
This command will remove any cached package data and update your system with the latest available packages and security patches.
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.
This command will download and install Emacs, along with any necessary dependencies. Once the installation is complete, you can confirm the installation by checking the Emacs version:
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.