I decided to write this blog post because I struggled to find one myself on the internet on how to install GUI on RHEL VM on Azure, the process seems pretty much easy on premises or on virtualization solutions like Hyper-v or VMware but on Azure it generated a lot of errors due to some conflicts with other components that has been installed on Azure VMs but I was able to do it finally and here you go the steps:
First of all it's recommended to use ssh to authenticate VMs on any cloud solution, so let's start with how to generate ssh.
how to generate ssh?
You can use puttygenerator where after you download and install it , find putty generator application on your machine and open it to generate the ssh, you will need to move your mouse in random moves over s mall rectangular area just to generate a random ssh key, after that you will need to save the private and the public keys to use them later. you will need to open the public key in notepad, copy it and paste inside the text box in the VM creation console in Azure that is asking for it and you are good to go or you can do it from the bash, up to you.
chmod 700 ~/.ssh
ssh-keygen -t rsa
Now after creating the RHEL virtual machine, we need to connect to it.
ssh -i [filelocation of private key] user@server
how to install desktop?
sudo yum makecache
sudo yum update
sudo yum upgrade
sudo yum -y groupinstall “Desktop Platform” “X Window System” “Fonts”
sudo yum -y groupinstall “General Purpose Desktop"
sudo yum -y install xterm twm xsetroot
sudo yum install xorg-x11-fonts-base xorg-x11-fonts-misc xorg-x11-font-utils xorg-x11-fonts-Type1
sudo yum install tigervnc-server -y
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-1.el6.nux.noarch.rpm
sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo yum install xrdp -y
We need to change the password for your user, in my case I'm logging in with root, In Azure the root user doesn't have a password at the time of provisioning of the VM.
sudo passwd root
it will prompt you to change the password.
sudo service xrdp start
sudo iptables -I INPUT -p tcp -m tcp --dport 3389 -j ACCEPT
sudo service iptables save
You need to allow RDP in Azure management portal for this machine by configuring the NSG to enable Inbound RDP for port 3389.
after you do this, you can connect to the machine using RDP client from your machine.
this will prompt you to enter the username and password on xrdp window and then will connect you will be connected successfully.
create OMS workspace
for log analytics
To enable log analytics on your linux virtual machines, you need to install dependency agent for linux VM
wget url of the agent that you can get from the OMS work space itself.
To enable Service Map on your new linux VM:
sh location of the dependencyagentlinux.