How to Install XRDP on Ubuntu VPS for XAMPP (And Why I Almost Broke My Keyboard) - blog ryuzaki

How to Install XRDP on Ubuntu VPS for XAMPP (And Why I Almost Broke My Keyboard)

 Let me guess: you bought a shiny new Ubuntu Virtual Private Server (VPS) thinking you would manage your WordPress sites or web apps like a total boss. Then you installed XAMPP, opened up your terminal via SSH, and immediately wished you had a real desktop screen to click on.

I have been right in those shoes, friend. A few months back, I spent four excruciating hours staring at a black screen because I misconfigured my remote desktop protocol. My coffee went cold, my head was thumping, and I almost deleted the entire server out of pure rage.

How to install XRDP on Ubuntu VPS for XAMPP

Installing a Graphical User Interface (GUI) on a headless Linux VPS feels intimidating if you are mostly used to Windows. But trust me, once you pair XFCE4 with XRDP, running XAMPP's visual control panel becomes a total breeze. Here is the exact, foolproof blueprint I wish someone had handed me before I pulled my hair out.

Featured Snippet: Quick Step-by-Step Summary

To install XRDP on an Ubuntu VPS for XAMPP management:

  1. Update system & install XFCE4: Run sudo apt update && sudo apt install xfce4 xfce4-goodies -y.

  2. Install XRDP: Run sudo apt install xrdp -y.

  3. Configure session: Set XFCE as default via echo "startxfce4" > ~/.xsessionand restart XRDP with sudo systemctl restart xrdp.

  4. Allow RDP Firewall Traffic: Open port 3389 using sudo ufw allow 3389/tcp.

  5. Install & Run XAMPP GUI: Download the XAMPP Linux installer, run chmod +xon the package, and launch /opt/lampp/manager-linux-x64.runinside your RDP desktop session.

Why You Actually Want a GUI for XAMPP on VPS

Look, terminal purists will tell you that real web developers only use raw SSH commands to run local web servers. They love typing out long systemctlcommands or tweaking /etc/hostsin Nano while wearing dark sunglasses.

That's all fine and dandy until you need to configure phpMyAdmin access or manage Apache module extensions quickly. Having the XAMPP graphical control panel right in front of you saves huge chunks of time. You can start or stop Apache and MySQL with a single click instead of memorizing terminal flags.

Besides, most budget VPS plans with 2GB of RAM can easily handle a lightweight Linux desktop like XFCE. You do not need to install heavy desktop suites like GNOME that eat up all your server resources.

+-------------------------------------------------------+
|                 YOUR WINDOWS / MAC PC                 |
|            (Microsoft Remote Desktop Client)          |
+-------------------------------------------------------+
                           |
                           | Port 3389 (Encrypted RDP)
                           v
+-------------------------------------------------------+
|                   UBUNTU 22.04 / 24.04 VPS            |
|  +-------------------------------------------------+  |
|  |                  XRDP Daemon                    |  |
|  +-------------------------------------------------+  |
|                          |                            |
|                          v                            |
|  +-------------------------------------------------+  |
|  |           XFCE4 Desktop Environment             |  |
|  |  +-------------------------------------------+  |  |
|  |  |         XAMPP Control Panel GUI           |  |  |
|  |  |   [Apache]  [MySQL]  [phpMyAdmin]         |  |  |
|  |  +-------------------------------------------+  |  |
|  +-------------------------------------------------+  |
+-------------------------------------------------------+

Step 1: Connect via SSH and Update Your System

Before we touch anything graphics-related, we need to refresh our package list. Fire up your terminal program or PuTTY and log into your server as root or a user with sudo privileges.

Type this command to get everything fresh and updated:

Bash
sudo apt update && sudo apt upgrade -y

Depending on when your VPS hosting provider refreshed their base system images, this might take a couple of minutes. Go grab a glass of water while those package lines scroll by.

Once that finishes, you are clean and ready for step two.

Step 2: Install the XFCE4 Desktop Environment

A lot of beginners make the mistake of installing ubuntu-desktop. Don't do that unless you want your server memory to get completely hammered.

Instead, we are going to install XFCE, which is super fast and barely uses 300MB of RAM. Run this line in your terminal:

Bash
sudo apt install xfce4 xfce4-goodies -y

During the installation process, a blue prompt might pop up asking you to select a default display manager. If it gives you choices like gdm3or lightdm, go ahead and choose lightdm.

That installation step was done pretty quickly on my host, taking under two minutes total.

Step 3: Install and Configure XRDP

Now we need the actual bridge that lets your home computer connect to the VPS desktop. XRDP is an open-source Remote Desktop Protocol server that plays super nice with Windows Remote Desktop Connection.

Install XRDP by running this command:

Bash
sudo apt install xrdp -y

Once the installation finishes, we need to make sure the XRDP service starts up automatically whenever your server boots up. Execute these two commands:

Bash
sudo systemctl enable xrdp
sudo systemctl start xrdp

Now here comes the crucial part where I messed up big time on my first try! You have to tell XRDP to use XFCE when a new remote session starts up.

Run this command to create the session configuration file in your user directory:

Bash
echo "startxfce4" > ~/.xsession

We also need to add the xrdpservice user to the ssl-certgroup so it can read key certificates without throwing in' permission errors. Run this line:

Bash
sudo adduser xrdp ssl-cert

Finally, give the XRDP daemon a quick restart so it picks up all your new settings:

Bash
sudo systemctl restart xrdp

Step 4: Configure Your VPS Firewall (UFW)

If you try to connect right now, your connection will probably time out because Ubuntu's default firewall blocks RDP traffic. Standard Remote Desktop protocol uses port 3389.

To open up port 3389 in Uncomplicated Firewall (UFW), run this command:

Bash
sudo ufw allow 3389/tcp

If UFW is not active yet, you can check its status using sudo ufw status. If you turn it on, make sure your SSH port (usually 22) is allowed too, or you will lock yourself out!

Now your VPS is completely ready to receive incoming remote desktop sessions.

Step 5: Test Your Remote Desktop Connection

On your local Windows machine, press the Windows Key + R, type mstsc, and hit Enter. If you are on Mac, grab the free Microsoft Remote Desktop app from the App Store.

Type in your VPS Public IP address and click Connect .

+--------------------------------------------------------+
|          Remote Desktop Connection                     |
+--------------------------------------------------------+
|                                                        |
|  Computer:  [ 192.168.1.100                         ]  |
|                                                        |
|  User name: None specified                             |
|                                                        |
|  [ Connect ]               [ Cancel ]                  |
+--------------------------------------------------------+

You will likely see a certificate warning popup on your screen. Don't panic! That is totally normal because of self-signed SSL keys, so just click Yes or Continue .

Next, a blue login screen will pop up asking for credentials. Enter your Ubuntu username and password, then click OK.

Boom! You should now be staring at a clean, beautiful XFCE desktop.

Step 6: Install XAMPP on Your Ubuntu VPS

Now that we have our desktop up and running, let us get XAMPP installed. You can open the Web Browser inside your XFCE desktop or just do this part right in the terminal window.

First, download the official XAMPP Linux installer package using wget:

Bash
wget https://www.apachefriends.org/xampp-files/8.2.4/xampp-linux-x64-8.2.4-0-installer.run

Once the download finishes, make the installer file executable:

Bash
chmod +x xampp-linux-x64-8.2.4-0-installer.run

Now, launch the setup installer with superuser privileges:

Bash
sudo ./xampp-linux-x64-8.2.4-0-installer.run

If you run this inside your SSH terminal, it will walk you through a text-based setup wizard where you just hit Yfor yes. However, if you run that same command inside the terminal window within your XRDP desktop session , it pops up a graphical setup wizard!

Follow the wizard prompts, click Next a few times, and let it extract Apache, MySQL (MariaDB), and PHP to /opt/lampp.

+-----------------------------------------------------+
|                  Setup - XAMPP                      |
+-----------------------------------------------------+
|                                                     |
|  Welcome to the XAMPP Setup Wizard!                 |
|                                                     |
|  Select Components:                                 |
|  [X] XAMPP Core Files                               |
|  [X] XAMPP Developer Files                          |
|                                                     |
|  [ Cancel ]                        [ Next > ]       |
+-----------------------------------------------------+

Step 7: Launch the XAMPP Control Panel GUI

Here is where the magic happens! To open the visual control panel inside your remote desktop, open a terminal inside XFCE and run this command:

Bash
sudo /opt/lampp/manager-linux-x64.run

Look at that! A pretty graphical control panel opens up on your desktop screen.

You can now click Start next to Apache Web Server and MySQL Database to turn your local web services on. No messy CLI flags required!

To verify everything works, open Firefox inside your XRDP session and type http://localhostinto the address bar. You will be greeted by the iconic XAMPP dashboard page!

Fixing Common Pitfalls (Learn From My Mistakes!)

I promised you I would share my foolish mistakes so you don't repeat them. Here are three pesky bugs that drove me nuts during my setup.

1. The dreaded "Black Screen" upon connecting

If you connect via Remote Desktop and only see a blank black screen before getting disconnected, your user session is likely stuck.

This usually happens if your user account is already logged in locally or via another session. Make sure you log out of any active sessions, then restart the XRDP service:

Bash
sudo systemctl restart xrdp

2. The annoying "Authentication Required to Create Color Device" popup

Whenever you log into XFCE via XRDP, Linux polkit might spam you with popups asking for your password to manage color profiles. It was super annoying and almost made me throw my mouse across the room!

To silence this forever, create a polkit rule file:

Bash
sudo nano /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla

Paste these lines right into that file:

This, TOML
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Save the file ( Ctrl + O, then Enter), exit Nano ( Ctrl + X), and restart your server. Problem solved forever!

3. phpMyAdmin Access Denied (Remote Security)

By default, XAMPP restricts phpMyAdmin access to local connections. Since you are using XRDP, opening Firefox inside the VPS desktop counts as local connection ( 127.0.0.1), so it works out of the box!

However, if you ever try accessing phpMyAdmin directly through your server's public IP address from your home browser, Apache will block it.

To fix that, edit the XAMPP configuration file:

Bash
sudo nano /opt/lampp/etc/extra/httpd-xampp.conf

Look for the <Directory "/opt/lampp/phpmyadmin">section and change Require localto Require all granted. Restart XAMPP with sudo /opt/lampp/lampp restartafterwards.

Final Thoughts & Security Tips

Setting up an Ubuntu VPS with XRDP and XAMPP takes a little patience, but the convenience of having a remote GUI is totally worth it. You get the raw hosting power of Linux paired with the visual ease of Windows.

One last piece of friendly advice: always keep your firewall active. Leaving port 3389 exposed to the entire internet can invite brute-force automated login bots.

If possible, restrict port 3389 access so only your home IP address can reach it:

Bash
sudo ufw allow from YOUR_HOME_IP to any port 3389

Happy hosting, and enjoy your brand new Linux remote desktop workstation!

Belum ada Komentar untuk "How to Install XRDP on Ubuntu VPS for XAMPP (And Why I Almost Broke My Keyboard)"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel