2018/08/13

How to install GNOME on top of HDP Sandbox 2.6.5+

I have seen a great tutorial on how to configure your Hortonworks Sandbox to work with a UI. Unfortunately, it is obsolete from HDP 2.5+ because of some underlying changes of the sandbox itself, and the steps there are resulting in a broken Hortonworks Sandbox. Luckily I've managed to find a workaround, so if you're in dire need of the HDP Sandbox, but you also need an IDE to be running on top of it, than please, be my guest and follow the steps below:

DISCLAMER: I only tested it with Oracle VirtualBox, but I think that the steps for VMWare should be identical with the Oracle VirtualBox's description.

1. Download and Import the latest HDP Sandbox (2.6.5 at the time of writing) from https://hortonworks.com/downloads/#sandbox

2. Check and increase the size of the video memory. (I've set it to 64MB and it works like a charm)



3. Open the port forwarding settings and check the configuration.


You should be able to see that the advertised SSH connection (2222) actually connects to a docker on top of the VM, while the real SSH port has been mapped to (2122 and 2200). If these ports are changing over time, please use the ones in the new VM config. From here on out I'll only refer to the Docker SSH connection as 2222 and the VM SSH as 2122.

4. Add an optical drive to the VM's image (if you want to install Guest Additions to the VM)
I highly recommend doing so, since it will enable dynamic resizing and clipboard sharing amongst other things. Otherwise, you can skip this step. (You can add it later on as well, but it will require an additional restart)



5. Fire up the VM and wait until it initializes Once its done you should see the following screen:



5. Open an SSH connection
Once you see the welcoming screen, open a shell prompt and ssh into the host machine. The username-password combination is: root/hadoop (you'll know that you're using the right port if the prompt says sandbox-host instead of sandbox-hdp):

ssh root@localhost -p 2122




6. Update your VM
Now we'll need to make sure that every component on the VM is up to date:

yum update -y


7. Patching the VGA component
Here comes the tricky part. Without installing mesa-libEGL GNOME's VGA driver will fail to start. To fix this execute the following two commands:

yum install -y mesa-libEGL
ln -s /usr/lib/mesa/libEGL.so.1 /usr/lib


8. Install GNOME 
Now everything is set to install the packages with:

yum install -y kernel-devel

yum groupinstall -y "GNOME" "GNOME Desktop" "Graphical Administration Tools" "Development tools"


9. Set the VM's default startup from console to GUI:
systemctl set-default graphical.target


10. To Restart the VM from the ssh connection type in:
reboot now

After a few seconds you should be able to see the following screen:



The password for the packer user is packer.

+1. Setting up Guest Additions

Since we've already installed everything which is required to have the guest additions up and running all you need to do is to press the insert disk button, hit run, then restart the machine. (In some rare cases the UI can appear broken right after the Guest Additions are installed. If that's the case, you can restart the VM by using the ssh port used in the 1st part of this guide and use the reboot now command. After the reboot however everything should work as expected) To get the most out of your new environment I highly recommend to enable the shared clipboard functionality on the VM, which enables you to copy content from your host machine and paste it directly into the Hortonworks Sandbox.




That's it!
You're all set to use the Hortonworks Sandbox as your own mobile development environment with its own UI. If you have any questions, please let me know in the comment section below!

Remark: The same steps can be applied for HDF 3.1+