您的位置:首页 > 运维架构 > Linux

linux下源码安装realvnc

2015-08-19 18:06 477 查看
今天安装了realvnc,使用的系统是64位OpenSuSE12.3。在这里写下安装的步骤,供大家参考。

1、从官网下载源码包,www.realvnc.com。在这里选择相应的源码包进行下载。我下载的是VNC-5.2.2-Linux-x64-ANY.tar.gz。

2、解压该源码包,使用命令:

tar -zxvf VNC-5.2.2-Linux-x64-ANY.tar.gz

3、进入到刚解压到的安装目录(用cd VNC-5.2.2-Linux-x64/ 命令),使用如下的命令进行安装:

./vncinstall /usr/local/bin/

4、运行命令vnserver,可能会出现如下的错误:

VNC(R) Server 5.2.2 (r7974) 64-bit (Nov 28 2014 14:43:49)

Copyright (C) 2002-2014 RealVNC Ltd.

VNC is a registered trademark of RealVNC Ltd in the U.S. and in other

countries.

Protected by UK patent 2481870; US patent 8760366.

See http://www.realvnc.com for information on VNC.

For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.2/acknowledgements.txt
Error: No license keys found.

Run vnclicense to apply a license key. [NoLicense]

这里的错误是说,缺少通行证,可以在网上随便找个。这里我使用的是:WHJRK-UXY7V-Q34M9-CZU8L-8KGFA。

使用如下的命令进行通行证的添加:

vnclicense -add WHJRK-UXY7V-Q34M9-CZU8L-8KGFA

5、添加完通行证后,再次执行: vncserver,可能会出现如下问题:

VNC(R) Server 5.2.2 (r7974) 64-bit (Nov 28 2014 14:43:49)

Copyright (C) 2002-2014 RealVNC Ltd.

VNC is a registered trademark of RealVNC Ltd in the U.S. and in other

countries.

Protected by UK patent 2481870; US patent 8760366.

See http://www.realvnc.com for information on VNC.

For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.2/acknowledgements.txt
xauth: (argv):1: bad display name "linux-o70w:2" in "add" command

Error: could not run xauth

主要是下面两句,在网上找了很久,都说在网上查资料发现这个错误是由于/etc/hosts文件中缺少配置造成的,应该在/etc/hosts文件中添加一句127.0.0.1 localhost的语句在最后。但当我打开该文件时,发现里面已经有这句了。通过向实验室的另一个人请教,他告诉了我如下可行方法。

注意到上述错误中,我设置成红色的部分(linux-o70w:2),这里有linux-o70w,将linux-o70w添加到//etc/hosts中,方法如下:

打开/etc/hosts文件,在其中添加下面这句,根据你的错误对linux-o70w进行相应的修改:

127.0.0.1 linux-o70w

下面是我的/etc/hosts的文件内容,我只在里面加了一行:127.0.0.1 linux-o70w

#

# hosts This file describes a number of hostname-to-address

# mappings for the TCP/IP subsystem. It is mostly

# used at boot time, when no name servers are running.

# On small systems, this file can be used instead of a

# "named" name server.

# Syntax:

#

# IP-Address Full-Qualified-Hostname Short-Hostname

#

127.0.0.1 localhost

127.0.0.1 linux-o70w

# special IPv6 addresses

::1 localhost ipv6-localhost ipv6-loopback

fe00::0 ipv6-localnet

ff00::0 ipv6-mcastprefix

ff02::1 ipv6-allnodes

ff02::2 ipv6-allrouters

ff02::3 ipv6-allhosts

211.69.192.12 hust hust

6、再次输入vncserver命令,出现以下类似输出说明是对的:

VNC(R) Server 5.2.2 (r7974) 64-bit (Nov 28 2014 14:43:49)

Copyright (C) 2002-2014 RealVNC Ltd.

VNC is a registered trademark of RealVNC Ltd in the U.S. and in other

countries.

Protected by UK patent 2481870; US patent 8760366.

See http://www.realvnc.com for information on VNC.

For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.2/acknowledgements.txt
If a desktop environment fails to load for this virtual desktop, please see:
http://www.realvnc.com/kb-345
Running applications in /root/.vnc/xstartup

VNC Server catchphrase: "Flute recycle Oliver. Forward detect penguin."

signature: 17-4e-07-97-3f-26-02-57

Log file is /root/.vnc/linux-o70w:2.log

New desktop is linux-o70w:2 (211.69.192.12:2)

注意红色部分,它是进行远程登录时所会用到的IP和端口。

7、使用vncviewert,连接到远程控制服务器。假设,另外一台电脑已经装有vncviewet,上述安装vnc的方法,会同时安装vncserver和vncviewer。使用下面的命令连接远程的电脑:

命令行输入:vncviewer

在弹出的 窗口:VNC Server一栏中输入上述红色部分:211.69.192.12:2

单击connect,在弹出框中输入远程主机的用户名和密码即可。

二:

源码安装如下:

首先远程到服务器.

1.从网上下载:VNC软件包

[root@www root]#wget http://www.realvnc.com/dist/vnc-4.0-x86_linux.tar.gz

--14:00:42-- http://www.realvnc.com/dist/vnc-4.0-x86_linux.tar.gz

=> `vnc-4.0-x86_linux.tar.gz'

Resolving www.realvnc.com... done.

Connecting to /]www.realvnc.com[146.101.152.142]:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1,625,390 [application/x-gzip]

100%[====================================>] 1,625,390 104.15K/s ETA 00:00

14:01:00 (104.15 KB/s) - `vnc-4.0-x86_linux.tar.gz' saved [1625390/1625390]

2.发现4.0版本安装起来更加方便,解压后按照README文档操作即可:

[root@www root]# ls

anaconda-ks.cfg install.log install.log.syslog vnc-4.0-x86_linux.tar.gz

[root@www root]# tar -zxvf vnc-4.0-x86_linux.tar.gz

vnc-4.0-x86_linux/

vnc-4.0-x86_linux/README

vnc-4.0-x86_linux/vncinstall

vnc-4.0-x86_linux/Xvnc

vnc-4.0-x86_linux/Xvnc.man

vnc-4.0-x86_linux/vncviewer

vnc-4.0-x86_linux/vncviewer.man

vnc-4.0-x86_linux/vncpasswd

vnc-4.0-x86_linux/vncpasswd.man

vnc-4.0-x86_linux/vncconfig

vnc-4.0-x86_linux/vncconfig.man

vnc-4.0-x86_linux/vncserver

vnc-4.0-x86_linux/vncserver.man

vnc-4.0-x86_linux/x0vncserver

vnc-4.0-x86_linux/x0vncserver.man

vnc-4.0-x86_linux/vnc.so

vnc-4.0-x86_linux/LICENCE.TXT

vnc-4.0-x86_linux/java/

vnc-4.0-x86_linux/java/index.vnc

vnc-4.0-x86_linux/java/logo150x150.gif

vnc-4.0-x86_linux/java/vncviewer.jar

[root@www root]# ls

anaconda-ks.cfg install.log.syslog vnc-4.0-x86_linux.tar.gz

install.log vnc-4.0-x86_linux

[root@www root]# cd vnc-4.0-x86_linux

[root@www vnc-4.0-x86_linux]# ls

java vncconfig.man vncserver vncviewer.man Xvnc.man

LICENCE.TXT vncinstall vncserver.man x0vncserver

README vncpasswd vnc.so x0vncserver.man

vncconfig vncpasswd.man vncviewer Xvnc

[root@www vnc-4.0-x86_linux]# ./vncinstall /usr/local/bin

Can't install manual pages to /usr/local/man/man1

Copying Xvnc to /usr/local/bin

Copying vncviewer to /usr/local/bin

Copying vncpasswd to /usr/local/bin

Copying vncconfig to /usr/local/bin

Copying vncserver to /usr/local/bin

Copying x0vncserver to /usr/local/bin

[root@www vnc-4.0-x86_linux]# mkdir -p /usr/local/vnc/classes

[root@www vnc-4.0-x86_linux]# cp java/* /usr/local/vnc/classes

3.此时即可启动vncserver:

第一次启动要设置密码.VNC远程密码

[root@www vnc-4.0-x86_linux]# vncserver

You will require a password to access your desktops.

Password:

Verify:

New 'www.janny.com:1 (root)' desktop is www.janny.com:1

Creating default startup script /root/.vnc/xstartup

Starting applications specified in /root/.vnc/xstartup

Log file is /root/.vnc/www.janny.com:1.log

上面这段话表示起动了一个图形终端,编号为1,要记住这个编号,等下登录时需要提供这个编号。

如果你要停止这个进程,使用

代码::

$vncserver -kill :1

4.如果上面的没有成功,发出现以下提示:缺少libstdc++库文件.

You will require a password to access your desktops.

vncpasswd: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory

5.请到这里下载

http://rpm.pbone.net/index.php3/stat/4/idpl/843376/com/compat-libstdc++-7.3-2.96.118.i386.rpm.html

rpm -ivh compat-libstdc++-7.3-2.96.118.i386.rpm

6.如果存在防火墙,还需要开放防火墙,然后就可以通过浏览器在5801端口访问vncserver了.

可以通过如下命令确认端口已经正常启动:

[root@www vnc-4.0-x86_linux]# netstat -an|grep 01

tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN

unix 2 [ ACC ] STREAM LISTENING 4904 /tmp/orbit-root/linc-5ee-0-121b01141620a

unix 2 [ ACC ] STREAM LISTENING 4964 /tmp/orbit-root/linc-5ec-0-121b011493273

unix 2 [ ACC ] STREAM LISTENING 4994 /tmp/orbit-root/linc-5f1-0-121b0114bb267

unix 2 [ ACC ] STREAM LISTENING 3010 /tmp/orbit-root/linc-527-0-7af285a063ec3

unix 3 [ ] STREAM CONNECTED 5036 /tmp/orbit-root/linc-5ec-0-121b011493273

unix 3 [ ] STREAM CONNECTED 5013 /tmp/.X11-unix/X0

unix 3 [ ] STREAM CONNECTED 5012

unix 3 [ ] STREAM CONNECTED 4997 /tmp/orbit-root/linc-5f1-0-121b0114bb267

unix 3 [ ] STREAM CONNECTED 4967 /tmp/orbit-root/linc-5ec-0-121b011493273

unix 3 [ ] STREAM CONNECTED 4907 /tmp/orbit-root/linc-5ee-0-121b01141620a

7.PS:

在/root/.vnc/xstartup

把twm & 改为gnome-session& or kde&

保存修改配置后.重启服务器.(之后多出现了xwindows)

8.再运行开启vncserver命令.开启一次图形终端,编号为1,

如果要开启两个图形终端就运行两次vncserver命令.但第二个图形终端在远程的时候.要以:XXX.XXX.XXX.XXX:2 这样的格式.表示远程图形终端2

9.客户端远程的时候.一般是用WIndows 系统.在客户端安装

10.*** 开机自动启用 VNC Server 的方法:

执行ntsysv , 把 vncserver 设为启用

原文转载地址:http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5974461

1.在ubuntu上安装vncserver,使用命令:# apt-get install vnc4server

2.开启vnc服务,输入命令:#vncserver

首次启动会要求设置密码,后面可以使用vncpasswd修改;

看到 New ‘****:1 (****)’ desktop is ****:1 (****代表主机名)即表示启动vnc成功,在主目录下产生一个.vnc目录;

3.在客户端下载“vnc客户端”软件,进行链接

在服务器栏输入:ip:1

但是,这个页面好像不是我们想要的图形化界面。vncserver默认使用的窗口管理器是twm,这是一个很简陋的窗口管理器,下面我们把桌面改成GNOME或KDE。

4. 备份原有xstartup文件: #cp ~/.vnc/xstartup ~/.vnc/xstartup.bak

下面我们需要修改vnc启动文件,使用命令:#vi ~/.vnc/xstartup

打开后如下图所示



我们需要把上图中“x-window-manager &”这一行注释掉,然后在下面加入一行“gnome-session
&”,或者是“startkde &”,分别启动GNOME桌面和KDE桌面。这里我们安装的是GNOME桌面。修改后如下图所示:(具体修改步骤:打开文件后,点击“insert”按钮,这时就可以输入了,在“x-window-manager &”前加“#”,然后回车输入“gnome-session &”,然后点击“Esc ”退出编辑模式,输入“:wq!”保存修改即可)

5.这时我们需要杀掉原桌面进程,输入命令:# vncserver -kill :1//这里的:1是桌面号

再次输入: #vncserver :1生成新的会话

6.下面我们开始安装gnome桌面环境

这里的安装有些慢,需要您耐心等待下。

(1)安装x-windows的基础 :#sudo apt-get install x-window-system-core

(2)安装登录管理器:#sudo apt-get install gdm (还可以为kdm/xdm)

(3)安装Ubuntu的桌面:#sudo apt-get install ubuntu-desktop(还可以为Kubunut-desktop/
Xubuntu-desktop )

另外:

安装命令:apt-get install gnome-core可以安装GNOME的一些基础。apt-get install firefox/gaim/xmms可以安装 Firefox
浏览器、Gaim 聊天程序、XMMS 音乐播放器。您可以按照自己的喜好来安装。

7.下面我们重复步骤5,, 输入命令:# vncserver -kill :1杀掉原桌面进程,

再次输入:#vncserver :1生成新的会话。然后使用vnc客户端连接,就可以看到图形化界面,如图:

注意:ubuntu10.10操作系统,安装后测试快捷键D无法正常使用,输入d时会使终端桌面显示、消失。这是因为快捷点冲突造成的(ubuntu 12.04无此问题)。

解决此问题,请按照以下步骤:

1)System->Preferences->Keyboard Shortcuts

找到系统快捷键设置菜单

3) 输入“Backspace”键,将这个快捷键Disable。

4) 输入命令:# vncserver -kill :1杀掉原桌面进程, 再次输入:#vncserver :1生成新的会话。

5)编辑/etc/rc.local在文件最后一行加入:

su root -c '/usr/bin/vncserver -name my-vnc-server -depth 16 -geometry 1280x800 :1'即可实现开机自启动
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: