HOWTO Remote Desktop

Caleb

McDonald's Drywall Expert
#1
Alright this is pretty cool so I figured I would type up a tutorial on how to do this real quick. I would like to note a few things to start off. This tutorial is assuming you have YUM (I think all KH VPSes do) and is for installing the KDE window manager, although you can really use whatever window manager you'd like. Some of this tutorial was borrowed from the one at WHT posted by Sean Koons of zone.net. Also, this works fine on my VPS-M with about 33MB of RAM to spare, but make sure you have at least 128MB of unused ram to allocate for VNC. I wouldn't recommend this on a highly used cpanel/plesk VPS as it can cause spikes in RAM usage and possibly kill needed processes. Here goes nothing!



First login as root to your server and run the following:

yum -y groupinstall kde (replace kde with gnome for gnome install)
yum -y install vnc vnc-server firefox x11-xorg


Ok now start up the vnc server with the 'vncserver' command and it will prompt you to enter a desired password. Just type what you want to use in and then confirm it. Now do 'pkill -9 vnc' followed by 'rm -rf /tmp/.X1*'

Now do 'cd /root/.vnc/' and then open the xstartup file in your text editor. Replace the last line with 'startkde &' (without quotes of course).

Now just type 'vncserver' to start it up and connect to your hostname on port 1 via your VNC client. I recommend RealVNC for windows users and Mac users can use VNCViewer. I tried chicken of the VNC for mac and it didn't work for me, vncviewer did, however.

Now you are able to use your VPS via a remote desktop!

When you are done simply do 'pkill -9 vnc' and then 'rm -rf /tmp/.X1*'


Any comments are welcome ;)




-Caleb
 
#2
Very cool.

I'm trying it out now on my spare plesk server.

Why do we have to "kill" it and edit that file name?

Do we have to do that every time we want to stop and then start up again VNC?

Thanks for sharing.

EDIT: It sure is downloading alot....is that normal?
 

Caleb

McDonald's Drywall Expert
#3
1) The first run is to set the password and create the .vnc directory, then we kill it and restart after editing xstartup. The edit in the xstartup file is to tell the vncserver to startup KDE when vncserver starts up.

2) I use the kill command when I am done just so it kills the vnc processes as well as the KDE processes, just something I personally do. The rm -rf command is to delete the temp sockets created by the vncserver startup. If you want to use port 1 each time, then yes you have to delete the temp file with that command. I have noticed for some reason it doesn't work on say port 3 or 4 on the vncserver when it starts on either of those ports. I would say stick with 1 for best results.

3) Yeah it has to get several things for KDE and if it's your first time running YUM on that server, it may be updating things for some reason.

Let me know how it goes ;)


-Caleb
 

Caleb

McDonald's Drywall Expert
#5
Ok are you on mac or windows?

Do you see a command prompt on the desktop or JUST a command prompt? If you are seeing just a command prompt that sounds like the plain X system. Make sure startkde & is in the xstartup file at the bottom replacing the last line.

Let me know if you are still seeing the problem.
 
#6
I'm on windows XP.

I see just a command prompt. No desktop. I'm pretty sure I changed that file correctly. Here's the xstartup file:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startdke &
 

Caleb

McDonald's Drywall Expert
#9
I'm actually not sure what ports it uses. I can see how APF would cause trouble though, but disabling it while you use vnc isn't a huge deal I would suppose. Yeah it's really cool I'm glad you enjoy it :p
 
#11
, but disabling it while you use vnc isn't a huge deal I would suppose.
I actually read that VNC is not so secure and I would think disabling APF, your firewall, would potentially be a big problem.

Can anyone comment on VNC's security and what ports or settings need to be changed in APF to allow it?
 

Caleb

McDonald's Drywall Expert
#12
I heard that VNC tunneling through SSH is the more secure option (I think that's it) but I like to learn things the hard way and don't care about insecurity until I get hacked :S
 

Caleb

McDonald's Drywall Expert
#14
That's the same way I am, I use a separate server for actual sites and VPSes for fooling around so I don't worry about security because Virtuozzo makes backup/reintalls easy :p
 
#15
just gave this a go,

I installed as the first post described. all seemed to go well on that.

however i cant actually connect on the VNC for some reason.

I type vncserver and it says.


New 'server1.500servers.net:1 (root)' desktop is server1.500servers.net:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server1.500servers.net:1.log


im assuming thats it starting up is it not? and that should then work? but i cannot connect still.

Any advice?
 

Caleb

McDonald's Drywall Expert
#16
Yep that should work make sure also you put the kdestart & line in your xstartup file.

Use RealVNC/VNCViewer to connect and if you are, I am not sure what the issue is...

Are you running any control panel?

Also another thing that may be confusing is that in the hostname box of your VNC client, only put server1.500servers.net and there should be a separate box for the port (1) (on most clients at least)

Post back here and I'll try to help best that I can ;)
 
#17
just gave this a go,

I installed as the first post described. all seemed to go well on that.

however i cant actually connect on the VNC for some reason.

I type vncserver and it says.


New 'server1.500servers.net:1 (root)' desktop is server1.500servers.net:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server1.500servers.net:1.log


im assuming thats it starting up is it not? and that should then work? but i cannot connect still.

Any advice?
Did you open up the apropriate ports in your firewall? I didint know which ports to open myself for VNC so for testing purposes I disabled my firewall(in my case APF)
 

Caleb

McDonald's Drywall Expert
#18
Did you open up the apropriate ports in your firewall? I didint know which ports to open myself for VNC so for testing purposes I disabled my firewall(in my case APF)
That's a great point APF may need to be disabled...
 
#19
The Xstartup file , that line is replaced with the last one (looks just like PPCs but without spelling mistake :p) Check,

RealVNC and using with the addition of :1 .... Check.

I have got C-panel control panel.

I do not know how to disable the APF. i must admit i am a fair noob when it comes to linux :).

Much appreciate the help. can you help me in the disabling of APF please.

EDIT: xstartup file....:

Code:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &
 
Top