Navigating the world of Linux servers can sometimes feel like entering a maze especially when you’re a newcomer.
But don’t worry I’ve been there! One of the things I struggled with was setting up a graphical user interface (GUI) on my Linux servers.
The truth is Linux servers usually come without a GUI primarily focusing on command-line interfaces for efficient management.
However sometimes a GUI can be a lifesaver especially when you need a visual interface for certain tasks.
Let me tell you about my recent experience installing a GUI on a Ubuntu server.
I chose Ubuntu because it’s very user-friendly and is often used in both personal and professional settings.
So whether you’re setting up a home server or a professional server Ubuntu is a great option.
Setting Up a GUI for Ubuntu: A Step-by-Step Journey
Before into the installation it’s essential to create a separate user account for your GUI login.
You shouldn’t use the root account (super-user) for daily use.
Think of it like this: your root account is like the main administrator of your house – you wouldn’t let everyone wander around freely as the administrator would you? The same logic applies here.
Here’s how you create a new user:
useradd -m NewUserName && passwd NewUserName
This command does two things:
- useradd -m NewUserName: Creates a new user with the name
NewUserName
. The-m
option makes sure that a home directory for this new user is also created. - passwd NewUserName: Sets a password for the newly created user. You’ll be prompted to enter and confirm the password.
Now with our user ready let’s delve into installing the Ubuntu Desktop GUI.
You’ll need to use the apt
package manager.
This is Ubuntu’s way of handling software installations.
Installing the Ubuntu Desktop
apt update && apt upgrade -y && apt install ubuntu-desktop -y && init 6
Let’s break down this line of code:
- apt update: This command refreshes the package list ensuring you have the latest software information.
- apt upgrade -y: This command upgrades any outdated packages on your system. The
-y
option automatically confirms any prompts so you don’t need to manually type “yes” for each step. - apt install ubuntu-desktop -y: This is the heart of the installation. This command installs the Ubuntu Desktop environment. It includes the graphical shell (GNOME) the desktop manager (GDM) and various essential applications.
- init 6: This command tells your server to reboot. After the reboot you can log in to your new GUI.
This whole process is automated.
The server downloads updates installs the GUI and then reboots automatically.
It’s like magic isn’t it?
Introducing Kubuntu Desktop: A Lighter Alternative
If you’re looking for a more lightweight option than the standard Ubuntu desktop Kubuntu Desktop is an excellent choice.
It’s based on the KDE Plasma desktop environment known for its user-friendly interface and customization options.
Here’s the command to install Kubuntu Desktop:
apt update && apt upgrade -y && apt install kubuntu-desktop -y && init 6
The process is similar to installing the Ubuntu Desktop but the final command apt install kubuntu-desktop -y
specifies the installation of the Kubuntu Desktop instead.
Connecting to Your GUI: VNC & KVM
Once the installation is complete you can access your new GUI through a remote connection.
Two popular methods are VNC (Virtual Network Computing) and KVM (Kernel-based Virtual Machine).
- VNC: VNC creates a virtual display allowing you to see the GUI on your computer even if the server is in a different location. It’s a common choice for accessing remote desktops and many free and paid VNC clients are available.
- KVM: KVM is a virtualization technology that enables you to access the server directly through a virtual machine. It offers a more interactive experience allowing you to manage the server’s settings and interact with the GUI as if you were sitting in front of it.
Installing a GUI for CentOS: A Different Flavor
Now let’s switch gears and talk about CentOS another popular Linux distribution.
CentOS is known for its stability and enterprise-grade features.
However its package management system (yum) and the way it handles GUIs are slightly different from Ubuntu.
Preparing CentOS for a GUI: A Bit of Tweaking
To install a GUI on CentOS we need to make a small change to the inittab
file which controls how the system boots.
Here’s how:
nano /etc/inittab
The nano
command opens the inittab
file in a simple text editor.
We need to find this line:
id:3:initdefault:
And change it to:
id:5:initdefault:
This change instructs the system to boot to runlevel 5 which enables the GUI. Press Ctrl + o to save the changes and then Ctrl + x to exit the editor.
Installing GNOME on CentOS: A Classic Choice
Now let’s install the GNOME desktop environment on CentOS.
GNOME is known for its sleek and modern interface.
yum update -y && yum -y groupinstall "Desktop" "X Window System" "Fonts" && init 6
Let’s break down this command:
- yum update -y: Updates the package lists and upgrades any outdated packages.
- yum -y groupinstall “Desktop” “X Window System” “Fonts”: Installs the necessary packages for the GNOME desktop including the X Window System and essential fonts. The
-y
option automatically confirms the installations. - init 6: Reboots the server to apply the changes.
KDE Desktop: A Powerful Alternative
If you prefer a more customizable desktop environment KDE is a fantastic choice.
It offers a wide array of features and themes allowing you to tailor your desktop to your preferences.
Here’s how to install it:
yum update -y && yum -y groupinstall "KDE desktop" "X Window System" "Fonts" && init 6
The process is very similar to installing GNOME but we use the yum -y groupinstall "KDE desktop"
command to install the KDE packages.
CentOS 7: A Modern Approach
For CentOS 7 the installation process is slightly different due to the adoption of systemd a newer system initialization process.
Here’s how to install a GUI on CentOS 7:
Installing KDE Plasma: A Versatile Choice
yum update -y && yum -y groupinstall "KDE Plasma Workspaces" && ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target && init 6
Let’s dissect this:
- yum update -y: Updates the package lists and upgrades any outdated packages.
- yum -y groupinstall “KDE Plasma Workspaces”: Installs the KDE Plasma desktop environment.
- ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target: This command sets the default runlevel to 5 enabling the GUI.
- init 6: Reboots the server to apply the changes.
GNOME Desktop: A Familiar Feel
For those who prefer the GNOME desktop experience here’s the installation command:
yum update -y && yum -y groupinstall "GNOME Desktop" "Graphical Administration Tools" && ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target && init 6
The process is similar to installing KDE but we use the yum -y groupinstall "GNOME Desktop" "Graphical Administration Tools"
command to install the GNOME packages.
Debian: A Flexible Choice
Debian is another popular Linux distribution known for its stability and extensive software repositories.
It’s widely used in both personal and professional settings.
Installing GNOME on Debian: A Reliable Choice
apt update && apt upgrade -y && apt install gnome -y && init 6
The process is similar to installing a GUI on Ubuntu using the apt
package manager.
KDE Desktop: A Customizable Option
apt update && apt upgrade -y && apt install kde-standard -y && init 6
The apt install kde-standard -y
command installs the KDE desktop environment providing you with a rich and customizable interface.
Conclusion
The world of Linux GUIs is constantly evolving offering a wide variety of desktop environments and options.
This journey has shown you how to install a GUI on three popular Linux distributions: Ubuntu CentOS and Debian.
The key takeaway here is that while each distribution has its unique way of doing things the underlying concept of installing a GUI remains relatively consistent.
Remember to experiment with different desktop environments to find the one that suits your needs and preferences.
And don’t be afraid to explore the vast world of Linux!