Thursday, April 6, 2017

Connect to ubuntu server from mac - GUI

How to connect to a unity in ubuntu server from mac

There are a plenty of tools out there to connect from your mac to Ubuntu server, right from your trusted command prompt to webdmin. They are different from each other or most of these do not connect you to ubuntu GUI server.

I prefer to work on terminal, but I can't speak for all. Many love ubuntu desktop and for them not seeing it on their server is a big let down.

For those, here's how I got it working, please try and let me know if this works for you too.

Ensure you have the basic installation of these packages done on your ubuntu server
Open terminal and navigate to you home directory, install the following

sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

If you are asked for permission to change the file system during installtion process, say 'yes' or 'y'

Install VNC server
sudo apt-get install vnc4server


Launch VNC server
vncserver :1

With all this setup, try to connect from your mac to ensure there are no connectivity issues
ssh -L 5901:127.0.0.1:5901 my_user_name@server_name
ssh -L 5901:127.0.0.1:5901 my_user_name@server_ip

If all is well, it's time to connect through VNC
Install RealTimeVNC Viewer from here https://www.realvnc.com/download/viewer/

Post installation, open the vnc viewer, add a new connection. Make sure you IP address is followed by :1. e.g. it should be something like 192.160.4.1:1



When you attempt to open the connection, you'll be prompted for encryption and password.



Punch in the password. Now you should be connected



Back to your LINUX server

Kill vnc session
vncserver -kill :1

Browse to your home directory and open up the file .vnc/xstartup. Add the following contents to it
#!/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 &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &

Save and exit

Start VNC server
vncserver :1

Here's what I see after all of this in my VNC Server - Mac

Here's how the connected server looks like


You should see a familiar basic unity show up. If you don't see it. Disconnect and re-connect

No comments:

Post a Comment