Sometime it is very useful to Access VPS remotely and with GUI(Graphical User Interface)...
Here is the Tutorial How You can access your Ubuntu vps remotely...
First Login To your ssh client e.g. putty or console window
So now you are in the server's console and you can type in it these commands. You can type commands with or without sudo since you are logged in as root but I will type it like this. Each time you are prompted with question to type Y for yes or N for no type Y of course.
So now you are in the server's console and you can type in it these commands. You can type commands with or without sudo since you are logged in as root but I will type it like this. Each time you are prompted with question to type Y for yes or N for no type Y of course.
now type
sudo apt-get update
sudo apt-get upgrade
Install XFCE environment :
sudo apt-get install xfce4
With this we have installed XFCE Desktop Environment.
For GNOME installation the code is:
Code:
sudo apt-get install ubuntu-desktop
And for KDE the code is:
Code:
sudo apt-get install kubuntu-desktop
But in order to connect the server remotely we need VNC server installed so just type this command (there is no need to download anything):
Code:
sudo apt-get install vnc4server
And follow the instructions.
The next step is to create new user and give it sudo rights. We will name it normaluser and give it password (something easy to remember). I did it like this but there could be different ways of doing it.
Code:
adduser normaluser
When prompted for password type in password.
Code:
sudo adduser normaluser sudo
And with this normaluser has sudo rights.
Now using putty we have a console from which we can change settings on our VPS. I am not sure about this (since I didn't check it 100%) but it seams that you can't connect as root on Ubuntu/Debian using Putty. So that is the main reason why I created new user and added it sudo rights.
So when Putty prompts for user you will type normaluser and enter correct password for normaluser (not root)
Now here comes the tricky part (just a little bit tricky) . In order to access remotely VPS and get proper Desktop Environment we have to do this. First open Putty again (if you closed it open again and log in as normaluser) and type this command.
Code:
vi /home/normaluser/.vnc/xstartup
This will open text editor vi and open the file xstartup. Then press the Insert key on your Keyboard and you are ready to edit the file. Hold down Delete key on Keyboard until you delete everything.
The next step is to copy this code, then open Putty again and right click on the top left corner. With that you will paste the code inside the xstartup file using Putty. This is the code you need to copy and paste.
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 80×24+10+10 -ls -title “$VNCDESKTOP Desktop†&
startxfce4 &
# twm &
For GNOME xstartup you paste:
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 80×24+10+10 -ls -title “$VNCDESKTOP Desktop†&
startx
And for KDE the xstartup file looks like :
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 80×24+10+10 -ls -title “$VNCDESKTOP Desktop†&
startkde
Since I couldn't run GNOME or KDE on my VPS I will not post Screen Shots of it running. But when I tried to connect remotely I did get message that there is not enough hardware to run GNOME and proper Close button on my VNC screen. I think that means it works.
After that you should press Esc key on Keyboard and if you did everything properly it looks like this.
To save the file type this in Putty and hit Enter.
Code:
:x
OK, so we are almost there. Next step is to run vncserver with this command.
Code:
vncserver :3000
And server is up and running on VPS. Next step is to connect it remotely via TightVNC. You can download it from here . Just install the .exe file and run TightVNC Viewer.
When you run the viewer it looks like this.
The important part is to put server's address in this form XX:XX:XX:XX:8900 so it will connect using port 8900.
If we had typed this command
Code:
vncserver :1
Then the port would be 5901. What ever you type instead of number 1 the port will be changed into 5900 + that number . In my case I typed 3000 and the port is 8900 (5900+3000).
So when you hit Connect the Screen opens and it looks like this.
So we have classic Linux Terminal and we are almost there. Just type this command in the terminal.
Code:
startxfce4
And it will start so you will get this picture.
Weather you want to hit Close or click on Next it's up to you but once everything is finished XFCE looks like this.
So there you have it. XFCE on your VPS. For Debian I think the procedure is almost the same and for Centos there are some command line differences (apt-get becomes yum) . I will see about setting up GNOME and KDE some time later and make a tutorial about that too.
Edit: I've added GNOME and KDE.
This is how the GNOME session looks like. Even on VPS such as VPS3 it was possible to run it.
No comments:
Post a Comment