Saturday 28 June 2014

Installing VNC on instance


Install GNOME Desktop Environment (since my image did not have desktop)
  • To install GNOME desktop environment, login to your instance using SSH and enter th following command: 
    • # yum -y groupinstall "GNOME Desktop"

Installing VNC server
  • Next we need to install VNC server:
    • #yum -y install tigervnc-server

Configuring VNC server
  • TigerVNC configuration file should be copied to its desired location:
    • # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
  • Edit the VNC server configuration file "/etc/systemd/system/vncserver@:1.service" using any editor:
    • #nano /etc/systemd/system/vncserver@:1.service 
  • Replace the following lines of the file
    • ` ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i" `
    • ` PIDFile=/home/<USER>/.vnc/%H%i.pid `
  • with:
    • ` ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i" `
    • ` PIDFile=/root/.vnc/%H%i.pid `

  • Use following command to create a file /etc/sysconfig/desktop with some contents. If you won't do this you will get grey screen upon connecting to VNC:
    • #echo 'PREFERRED="$(type -p gnome-session)"' >> /etc/sysconfig/desktop 
  • Set the password for VNC user:
    • # vncpasswd

Configuration done!

To enable:
  • #systemctl enable vncserver@:1.service && systemctl start vncserver@:1.service

VNC CLient
  • Download any VNC client to connect to the VNC server:
    • #yum install tigervnc 
  • Enter your servers IP, root username & password. The default port for the VNC is 5901.

No comments:

Post a Comment