How to install VNC server on CentOS 6

参考: https://rbgeek.wordpress.com/2012/06/26/how-to-install-vnc-server-on-centos-6/

VNC is a protocol that is used to share the desktop with other users/computers over the network/Internet.In order to share a desktop, VNC server must be install and configure on the computer and VNC client must be run on the computer that will access the shared desktop.

When we install the minimal copy of CentOS Server, it only gives us the “Command Line” interface.
But some people prefer GUI instead and for this they install Full version of Gnome on CentOS. Actually there is a better way and that is to install VNC. VNC provides a lightweight virtual desktop than full blown version of Gnome.

To run the VNC Server on CentOS, we have to install these required packages:
sudo yum groupinstall Desktop
sudo yum install tigervnc-server
sudo yum install xorg-x11-fonts-Type1

This is optional:
sudo yum install vnc

To start VNC Server on boot
sudo chkconfig vncserver on
To setup users’ VNC password:

vncpasswd
Edit the /etc/sysconfig/vncservers file:
sudo nano /etc/sysconfig/vncservers

Add the following to the end of the file:
VNCSERVERS=“1:root”
VNCSERVERARGS[1]="-geometry 1024x600" 次行删掉默认文件多余的字符才能运行正常

The iptables rules need to be amended to open the VNC ports:
sudo iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT 去掉5后运行正常
sudo service iptables save
sudo service iptables restart

Restart the VNC Server:
sudo service vncserver restart

Now kill the VNC Server:
vncserver -kill :1

Edit the xstartup file in .vnc directory:
nano .vnc/xstartup

Comment the last line and run the Gnome:
#twm &
exec gnome-session & 有的文件中不存在这一行

Restart the service:
sudo service vncserver restart

Ability to connect for multiple users:
Create a local user, using the following command:
sudo adduser ali

Create a password for newly created user:
sudo passwd ali

Switch to the newly created user and run vncpasswd command for it:
su ali
vncpasswd

Edit the /etc/sysconfig/vncservers file:
sudo nano /etc/sysconfig/vncservers

Add these lines for new user:
VNCSERVERS="1:arbab 2:ali"
VNCSERVERARGS[1]="-geometry 1024x600"
VNCSERVERARGS[2]="-geometry 1024x600"

Restart the VNC service:
sudo service vncserver restart

Kill the vncserver session for new user and edit the xstartup file:
su ali
vncserver -kill :2
cd ~
nano .vnc/xstartup

Modify the file so it looks like this:
#twm &
exec gnome-session &

Restart the VNC service:
sudo service vncserver restart

Connect with newly created user using centos:2, Where centos is my server name

 

sudo service vncserver stop 关闭服务后节省资源

编辑 /etc/inittab 给设定启动cli还是gui

 

安装firefox和中文支持

yum install firefox

yum install "@Chinese support"

转载于:https://www.cnblogs.com/qike/p/5512657.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值