Install Gedit on CentOS7

Install gedit on CentOS7

In this tutorial, we will install gedit on CentOS7. We are going to use yum for the installation so it’s a straightforward process. The same procedure works for installing gedit on a Red Hat Enterprise Linux 7 (RHEL) machine.

Table of Contents

Introduction

Gedit is a general-purpose text editor designed for the GNOME desktop environment. Therefore, if your CentOS7 machine is a GNOME desktop instance, you likely already have gedit installed. It made our list of “Popular text editors for Linux” and it’s available for the Windows and Mac operating systems. However, this tutorial will focus on the gedit install for Linux distributions and specifically, a CentOS7 Linux machine.

Pre-Installation Checks

Before we begin, this tutorial assumes you already have a Linux or Debian-based distribution (Red Hat7 or CentOS7) installed and running a user account with sudo privileges to become the root user. To check if gedit is already installed on your machine, run the following command (below) to display the running version.

				
					[admin@vm2 ~]$ gedit --version
				
			

Install xorg-x11 packages

If you’re running a server instance of CentOS7, you will also need to ensure you have the xorg-x11 packages installed.  This will allow X11 forwarding and enable a graphical display on your machine. The gedit application will fail to launch without X display enabled. If you are running a desktop instance, skip this section and proceed to the “Gedit Installation” section.

To check if X display is enabled on your machine, first, SSH with the -X or -Y option (depending on your security settings) to the target host. Then, run the following command (below):

				
					[tommy.langford@infotechys-t1 ~]$ ssh -XY admin@vm2
[admin@vm2 ~]$ echo $DISPLAY
localhost:10.0
				
			

The echo $DISPLAY command should output something like what’s displayed above. If you do not receive an output, then, install the following xorg-x11 package(s) (below):

				
					[admin@vm2 ~]$ sudo yum -y install xorg-x11-xauth xorg-x11-apps
				
			
Install gedit on CentOS7 - Xorg-X11 Package Install

Photo by admingeek from Infotechys

Verify X11 forwarding post install  

Once the xorg-x11 package installs are complete, try forwarding X11 again to your target machine. Then, verify the display is running properly by running the echo $DISPLAY command again or the  xeyes command (illustrated below):
Verify X display - xeyes command

Photo by admingeek from Infotechys

Gedit Installation

Now that we’ve verified X11 is installed and running properly, let’s proceed with the gedit installation using yum (below):

				
					[admin@vm2 ~]$ sudo yum -y install gedit
[sudo] password for admin:
...
Transaction Summary
=================================================================================================================
Install 1 Package (+104 Dependent packages)
Total download size: 42 M
Installed size: 132 M
				
			

As you can see (above), gedit requires quite a few dependent packages in order to install properly.

Launching the Gedit text editor

Once the gedit installation is complete, it is now time to launch the application. Let’s proceed with opening a test file called testfile1.txt using gedit (below):

				
					[admin@vm2 ~]$ gedit testfile1.txt
				
			
Gedit successful launch window

Photo by admingeek from Infotechys

Additional Information

In addition to the base install, gedit has a number of plugins (found here) that add to its functionality. Some of those plugins are listed below:
 
  • File Browser PanelEasy file access from the side panel.
  • Modelines – Emacs, Kate, and Vim-style modelines support for gedit.
  • Python ConsoleInteractive Python console standing in the bottom panel.
  • Quick HighlightHighlights every occurrence of selected text.
  • SnippetsInsert often-used pieces of text in a fast way.
  • Spell CheckerChecks the spelling of the current document.
  • Code Comment Comment out or uncomment a selected block of code.
  • Embedded TerminalEmbed a terminal in the bottom pane.
  • Git Highlight lines that have been changed since the last commit
  • Word CompletionWord completion using the completion framework

Conclusion

We’ve successfully installed the gedit text editor on a CentOS7 machine. The same procedure applies for installing gedit on any other Linux distribution. The difference is in the package installer, which varies depending on the version of the OS (e.g. RHEL8/CentOS8/Fedora 35 use dnf for package installs and apt-get for Ubuntu or Debian distros).
 
Was this article helpful to you? If so, leave us some feedback in the comments section. We’d love to hear from you.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *