To run the VNC Server on CentOS, we have to install these required packages:
To start VNC Server on boot
To setup users’ VNC password:
Edit the /etc/sysconfig/vncservers file:
Add the following to the end of the file:
The iptables rules need to be amended to open the VNC ports:
Now kill the VNC Server:
Edit the xstartup file in .vnc directory:
Restart the service:
Now, download VNCViewer onto our desktop computer from which we want to access the shared desktop.
Connect using ServerIP/Name:1 (:1 is for the VNC server window)
http://www.realvnc.com/download/viewer/
Enter the password that we created using the vncpasswd command:
Ability to connect for multiple users:
Create a local user, using the following command:
Create a password for newly created user:
Switch to the newly created user and run vncpasswd command for it:
su ali
Edit the /etc/sysconfig/vncservers file:
Add these lines for new user:
Restart the VNC service:
Kill the vncserver session for new user and edit the xstartup file:
Connect with newly created user using centos:2, Where centos is my server name:
Enter the password that we created using the vncpasswd command:
Code: [Select]
yum groupinstall Desktop
yum install tigervnc-server
yum install xorg-x11-fonts-Type1
yum install vnc
To start VNC Server on boot
Code: [Select]
chkconfig vncserver on
To setup users’ VNC password:
Code: [Select]
vncpasswd
Edit the /etc/sysconfig/vncservers file:
Code: [Select]
nano /etc/sysconfig/vncservers
Add the following to the end of the file:
Code: [Select]
VNCSERVERS="1:arbab"
VNCSERVERARGS[1]="-geometry 1024x600"
The iptables rules need to be amended to open the VNC ports:
Code: [Select]
iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT
service iptables save
service iptables restart
Restart the VNC Server:
Code: [Select]
service vncserver restart
Now kill the VNC Server:
Code: [Select]
vncserver -kill :1
Edit the xstartup file in .vnc directory:
Code: [Select]
nano .vnc/xstartup
Comment the last line and run the Gnome:
Code: [Select]
#twm &
exec gnome-session &
Restart the service:
Code: [Select]
service vncserver restart
Now, download VNCViewer onto our desktop computer from which we want to access the shared desktop.
Connect using ServerIP/Name:1 (:1 is for the VNC server window)
http://www.realvnc.com/download/viewer/
Enter the password that we created using the vncpasswd command:
Ability to connect for multiple users:
Create a local user, using the following command:
Code: [Select]
adduser ali
Create a password for newly created user:
Code: [Select]
passwd ali
Switch to the newly created user and run vncpasswd command for it:
su ali
Code: [Select]
vncpasswd
Edit the /etc/sysconfig/vncservers file:
Code: [Select]
nano /etc/sysconfig/vncservers
Add these lines for new user:
Code: [Select]
VNCSERVERS="1:arbab 2:ali"
VNCSERVERARGS[1]="-geometry 1024x600"
VNCSERVERARGS[2]="-geometry 1024x600"
Restart the VNC service:
Code: [Select]
service vncserver restart
Kill the vncserver session for new user and edit the xstartup file:
Code: [Select]
su ali
vncserver -kill :2
cd ~
nano .vnc/xstartup
Modify the file so it looks like this:
Code: [Select]
#twm &
exec gnome-session &
Restart the VNC service:
Code: [Select]
service vncserver restart
Connect with newly created user using centos:2, Where centos is my server name:
Enter the password that we created using the vncpasswd command:
No comments:
Post a Comment