We have been asked a few times if it is possible to connect to a Linux VPS via a GUI.
The answer is of course Yes! But some configuration is required.
Below is a list of instructions that have been tried and tested on all SwitchLink VPS packages running Centos 5 x86 from an SSH Prompt.
Firstly, we need to install our required packages.
[text]yum groupinstall “X Window System” “KDE (K Desktop Environment)”
yum install vnc vnc-server firefox x11-xorg nano[/text]
There is approx 350 packages in the above combination, so depending upon your VPS Package, you may need to go get a coffee!
Next, we disable the IPTABLES Firewall and Disable SELINUX to ensure we can connect remotely to the server.
[text]chkconfig –level 12345 iptables off
service iptables stop
setenforce 0[/text]
By Default, VNC will start twm as a GUI, where we want KDE, so we are going to change the vnc config file to use KDE instead.
[text]nano ~/.vnc/xstartup[/text]
Replace the “twm &” line with “startkde &”
Now, we simply set vnc to start on startup.
[text]chkconfig –level 3 vncserver on
Ensure your VPS has all the required devices for connectivity.
[text]MAKEDEV tty pty
mknod -m 666 /dev/tty0 c 5 1[/text]
And ask SwitchLink support to configure the following on your VPS.
[text]host# vzctl set VEID –devnodes /tty:rw –save
host# vzctl set VEID –devnodes /tty0:rw –save[/text]
Now to start VNC for the first time and set a password.
[text]vncserver[/text]
You will now be prompted to enter your VNC password twice, and you wont be asked again. Please ensure you use secure passwords!
Your VPS should repond as follows;
[text]“New ‘hostname:1 (root)’ desktop is hostname:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/hostname:1.log”[/text]
You will now be able to use your VNC Viewer to connect to a KDE Environment on your Centos Linux VPS. In the response above of hostname:1, you can connect on the port 5901 to your VPS Server.
This article has been written to work with SwitchLink, but it should be easily adaptable to work on ANY Virtual Server, especially on Virtuozzo and Open-VZ.
Hope this helps many people!