arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CentOS 7 with XFCE & VNC
#1
CentOS 7 with XFCE & VNC


This is a brief installation instruction for VNC with the XFCE desktop environment on CentOS 7 Core (a.k.a server version without a GUI). I have written this guide using a CentOS 7.6.1810 Core x86_64 (minimal installation) VM based on Virtualbox (Ubuntu 18.04 LTS host). Depending on the virtualization technology you are using you might not have the same experience.

I'm not responsible for bricked system. I recommend to perform this installation on a clean and update to date system. Fiddling around on a system that has been modified before is mostly a nightmare and almost always a guarantee for something to go really wrong.


Let's start now.


1. Connect to your server and login as root.

2. Update your system using the command below:
yum update -y

I would also recommend to reboot the server after installing all updates. And after that continue with step three.

3. Install and enable the EPEL repository using the command below:
yum install epel-release -y

4. Install the XFCE desktop environment using the command below:
yum groupinstall "XFCE" -y

Depending on the Internet connection and the performance of the server the installation process will take a while now. Just wait until it finishes the download and installation. In my case over 280 packages had to be downloaded and installed. Even on a Intel Core i5 system running on SSDs only it takes a little while.

5. Install the VNC server using the command below:
yum install tigervnc-server tigervnc-server-minimal -y

6. Run the vncserver to generate the first configurations using the command below:
vncserver

You might be asked for a password. At this point you can set a password for VNC access. So type in a password you want to use to protect the VNC access to your server. You can also set a view-only password if you like.

8. Rename the existing xstartup file into xstartup.backup using the command below:
mv ~/.vnc/xstartup ~/.vnc/xstartup.backup

9. Create a new xstartup file with nano or any other text editor (following code is using nano):
nano ~/.vnc/xstartup

10. Paste the following code into the file
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &

Save the content and exit the text editor. In nano you can use CTRL + O to save the content and CTRL + X to exit the text editor.

11. Set execution permission for the xstartup file using the command below:
chmod +x ~/.vnc/xstartup

12. Copy the X11 Xresources folder to the root home folder using the command below:
cp /etc/X11/Xresources ~/.Xresources

13. Run the vncserver again to start a session using the command from step six.

14. Now you can use the command below to check running sessions:
vncserver -list

You should see a session running at :1.

15. Create a service for the vncserver using the command below:
nano /etc/systemd/system/vncserver.service

16. Paste the following code into the file:
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=root
PIDFile=/root/.vnc/%H:1.pid
ExecStartPre=-/usr/bin/vncserver -kill :1 > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :1
ExecStop=/usr/bin/vncserver -kill :1

[Install]
WantedBy=multi-user.target

You can adjust the resolution from 1280x800px to what you prefer. Save the file and exit the text editor.

17. Reload the systemd service daemon and start the vncserver service with the commands below:
systemctl daemon-reload
systemctl start vncserver.service

You can use the command from step 14 to check if the session is running.

18. Enable the vncserver.service to be executed at boot:
systemctl enable vncserver.service

19. The VNC server will now listen on IP:5901. You need to open that port in your firewall:
firewall-cmd --permanent --zone=public --add-port=5901/tcp
firewall-cmd --reload

20. Connect to the server with a VNC client at IP:5901. Enter the password your set at step six.

21. Once logged in your will see a screen like this:
[Image: BqVG806.png]

Click on "Use default config" and it will generate a default taskbar and dock.

No idea about that XFCE PolicyKit error. Just click on OK and carry on I guess.


That's it I guess.



What have I learned? Don't attempt this on any system where you have no been working on before. You never know what exactly has been done to that system and what leftovers of possible failed attempts of previous installations there are. I could end up in a disaster like it did for me when I tried to help someone while on this clean VM it works without any big issues.

On the other hand it might be just crap OpenVZ that causes these issues. I'm not going to go into detail here. All I can say is that the system where I tried to help with has been modified before and had serve issues when attempting to install the GNOME environment (hence why I went for XFCE as that worked). So it had its fair share of issues before I even touched it. Everything actually worked until I rebooted it and it didn't come back up (neither SSH nor VNC). Would probably been half so bad if the server had a control panel I could use to start a emergency console and fix the issue that caused the server not to come back up.

P.S: I'm not really a big fan of CentOS and VNC. Sure it is really dangerous to run VNC as root. Just a tutorial for the installation though. If you plan on using this seriously I would suggest to create a special user for this and adjust a few things like the username in the service config and the PID directory. Also when running vncserver the first time you need to do it as the special user. So you bascially need to perform the whole setup as that special user and only use root where necessary (package installation, setting up permission, creating the service config and such tasks).

WARNING: If you use this guide on OpenVZ keep the following in mind! The desktop environment installs a network manager. This network manager is not capable of supporting and configuring network adapters on OpenVZ! What will happen is that it will override the network adapters with nonsense and the network will stop working after the first reboot. To fix this you have to disable the network manager service and reconfigure the network of the VPS through SolusVM (it's literally a button called "Reconfigure Network" in the control panel). After that the network connection should start to work again and also VNC should work.

Disable the network manager service using these two commands:

systemctl stop NetworkManager
systemctl disable NetworkManager


After that use the network reconfiguration button in SolusVM.



TL;DR: OpenVZ is whack crap.
[Image: zHHqO5Q.png]
#2
I recently tried it and worked.
But i made 1 mistake.
I clicked on one panel only, if you have any way to reverse this tell me because i feel like im in safe mode xd
#3
@youssefbasha

1. Right click into the empty panel and select the "Add New Items..." item.
2. In the new window select "Application Menu" and click on the "Add" button at the bottom.
3. You will see that there is now a application menu available in the panel with the XFCE mouse icon. Click on it and select "Terminal Emulator" to start a terminal.
4. In that terminal enter "xfce4-panel --quit" to stop the XFCE 4 panel process.
5. Stop the XFCE 4 configuration service with the command "pkill xfconfd".
6. Delete your current XFCE 4 configuration with the command "rm -rf ~/.config/xfce4/panel".
7. Delete settings for the XFCE 4 configuration service with the command "rm -rf ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml".
8. Start the XFCE 4 panel again with the command "xfce4-panel".

The configuration prompt will popup again. Click on the button with "default config". You're done. You can close the terminal. It will warn you about a running process. Ignore the warning. the XFC4 panel will be killed shorty and will respawn again.
[Image: zHHqO5Q.png]
#4
Right click into the empty panel and select the "Add New Items..." item
I dont have this option
Here u are what i get: [Image: Screenshot-2019-12-15-12-20-51-269-com-r...ndroid.jpg]
#5
The empty panel is the little box that appears somewhere on the screen after you have clicked on empty panel at the initial configuration popup. Whatever. It doesn't matter. Just click on "Open Terminal Here" in that menu from your screenshot and it will open a terminal where you can follow my instructions... how did you not see that option?
[Image: zHHqO5Q.png]
#6
Oh wow that really worked Heart
Thanks for sharing and helping me with this @Hidden
You deserve a rep Smile


Possibly Related Threads…
Thread
Author
Replies
Views
Last Post
6,022
04-13-2020, 06:45 AM
Last Post: Mashiro

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting