Hello guys. Today I received an Ubuntu VPS order form a client. He stated in the requirements that he needs remote access to the UI of the Server and since our Ubuntu based servers are being delivered only with SSH I had to manually install a User Interface and configure VNC server for him.
So I decided to capture some screenshots and publish the steps here as a tutorial. So to begin just connect to your ubuntu server through PUTTY (in this case my client VPS) as below.
OK now we require to install “ubuntu-desktop, tightvncserver, xfce4, xfce4-goodies” packages! xfce is a super lite weight desktop environment and I choose it over Gnome because being so fast.
run following command in order to install all those packages:
# apt-get -y install ubuntu-desktop tightvncserver xfce4 xfce4-goodies
Let the installation finish! it might take some time depending your server connection and processor speed.
Now use add user command and create a new user, we are going to give VNC access to this user later on.
When you created your user open /etc/sudoers file using nano and add your user right after root like the image below to ensure your user has all privileges.
now change from root to the user you just created using “su – username” command like image below and run “vncpasswd” command to create a VNC password for this user through VNC server which we just installed.
if you faced exact outputs everything must be cool then. now we have to install the VNC server as a Service. create a file named vncserver in /etc/init.d/ directory by running:
#nano /etc/init.d/vncserver
and put following codes in there. (attention shahrooz here is my username! user the username you created in steps before instead of the word shahrooz.)
#!/bin/bash PATH="$PATH:/usr/bin/" export USER="shahrooz" DISPLAY="1" DEPTH="16" GEOMETRY="1024x768" OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}" . /lib/lsb/init-functions case "$1" in start) log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver ${OPTIONS}" ;; stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}" ;; restart) $0 stop $0 start ;; esac exit 0
now lets make sure that xfce is starting once vnc is connected! to do this edit “/home/shahrooz/.vnc/xstartup” and fill it with following line.
#!/bin/sh xrdb $HOME/.Xresources xsetroot -solid grey startxfce4 &
Use following command to update permissions and allow all users to start X server:
chown -R shahrooz. /home/shahrooz/.vnc && chmod +x /home/shahrooz/.vnc/xstartup sed -i 's/allowed_users.*/allowed_users=anybody/g' /etc/X11/Xwrapper.config
Now make “/etc/init,d/vncserver” executable and start VNC server:
chmod +x /etc/init.d/vncserver && service vncserver start
Finally add vnc server to start up automatically on reboot with following command:
update-rc.d vncserver defaults
connect to your ip:1 port through any vnc client you like! I am using RealVNC. You can use other alternatives such as TightVNC.
That’s it! hope you enjoyed the tutorial.
Incoming search terms:
- xfce tightvnc server setup
- tightvncserver xfce4
- vnc4server xfce ubuntu
- gui for ubuntu server 14
- tightvnc ui ubuntu
- tightvnc server on xfce4
- install PuTTY on XFCE Ubuntu
- install gui and vnc ubuntu server
- gui ubuntu server14 04
- design and configuration step on wireless network in ubuntu server14 04