This article focuses on how to install the graphical interface for CentOS virtual machines on Azure. The system version used in this article is CentOS6.8.
1. Prepare the installation environment
Because you need to use the root account to install the graphical interface, you need to set the root password before you start, and then use the command Su-switch to root. As shown in the following:
Use the sudo passwd root command to set the root account, enter the password and enter the password again. If you set the password too simple, you will receive a hint that is too easy. After the password setting is complete, use Su-
The command switches to the root account, enters the Su-command and returns, asks you to enter the password (the password of the account you created when you created the Azure virtual machine).
Enter Yum grouplist to view the available software collections.
2. Install the desktop environment
First run the Yum groupinstall-y ' X Window System '
Then run the Yum groupinstall-y "Desktop"--skip-broken
Installation Complete
3. Installing VNC Server
Install TIGERVNC using the Yum install-y tigervnc* command
TIGERVNC Installation Complete
Installing Libxfont
Complete the installation of the Libxfont
Installing Pixman, xterm, XORG-X11-TWM
Complete Pixman, xterm, XORG-X11-TWM installation
4. Setting up VNC Server
Use VI to edit/etc/sysconfig/vncservers, insert two lines of content
Vncservers= "1:root"
vncserverargs[1]= "-geometry 800x600"
Setting up a VNC password
To set the VNC password using the VNCPASSWD command
Set Cento s resolution
Open/boot/grub/grub.conf, preferably add a row of parameters in the file vga=789
vga=789 means 800x600,16m color
5. Start the VNC service
Use the vncserver:1 command to start the service. Note: There are spaces before 1, such as
6. Configuring NSGS
You need to set the NSG to allow Port 5901 inbound. In the virtual machine network, add the add-on port rule, see
Enter 5901 in the port range, name input VNC
The graphical configuration of the CentOS virtual machines in Azure is good. Then download and install the VNC Viewer to connect the CentOS virtual machine in Azure in a graphical way.
In the VNC Viewer, fill in the server+ port number you want to connect to, such as the IP of the CentOS machine I experimented with is 52.187.145.18, the connection configuration as
After clicking Connect, prompt for no encrypted connection
Continue can do it.
Then enter the password and confirm OK
Successfully connected to a CentOS virtual machine in Azure, such as
One of the Azure Linux virtual machine image configurations: CentOS configuration