Monday, June 10, 2019

Access CentOS from the other machine (via VNC)

On target machine

yum groupinstall "GNOME Desktop"
Set default target to GUI:
systemctl set-default graphical.target
yum install tigervnc-server xorg-x11-fonts-Type1
Choose a VNC display to use for accessing this particular computer (here we'll use display 5 which equals to the port 5905)
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:5.service
Add user (if you need one) whose Desktop will be accessed:
adduser admin
passwd admin
Access file:
vi /etc/systemd/system/vncserver@:5.service
Then:
  1. Go to [Service]
  2. ExecStart  - here - change <USER> with admin
  3. PIDFile - here - change <USER> with admin
firewall-cmd --permanent --zone=public --add-port=5905/tcp 
firewall-cmd --reload

su - admin
Execute vncserver command to assign VNC password for needed user (admin in our case)

systemctl daemon-reload 
systemctl start vncserver@:5.service
systemctl enable vncserver@:5.service
systemctl status vncserver@:5.service
Check that vncserver is listening to the ports other that localhost:
lsof -i -P | grep -i "listen" | grep Xvnc

If some kind of problem appears do below:
Remove not needed VNC display sessions (if any):
rm -f /tmp/.X11-unix/*
rm -f /tmp/.X*-lock
systemctl restart vncserver@:5.service
ps aux | grep vnc

On client machine

yum install tigervnc
Open TigerVNC Viewer (Applications > Internet) or vncviewer (from bash)
Specify serverNameOrIp:5095
Specify VNC password
then login using needed login and password (admin in our case)
Use F8 to make full-screen and to change other settings.



No comments:

Post a Comment