First, you need to make sure git is installed:
yum install git -y
You can clone this repository to have access to its script:
git clone https://github.com/omomoki/vncserver.git
then you would cd
into the cloned directory and run the bash script inside.
You can also just copy this big one-liner command, which combines all the steps above and runs the bash script automatically. Just copy, paste, walk away and come back in 5 minutes and the vncserver should be ready.
yum install git -y && git clone https://github.com/omomoki/vncserver.git && cd vncserver && bash setup.sh
You may need to do port-forwarding to be able to log in after setup. This command will handle port-forwarding. enter the IP address of the cloud compute instance.
ssh -L 5901:localhost:5901 [email protected]
You can use this address to log in:
localhost:5901
The port number should change depend on the display number. If display 2 is working, the port sholud be 5902.