【转】How to install VNC server on ubuntu 14.04

转自:https://www.krizna.com/ubuntu/install-vnc-server-ubuntu-14-04/

VNC server is used to share graphical desktop which can be controlled from other computers . This guide is helpful to install VNC server on Ubuntu Desktop 14.04, Ubuntu server 14.04 and Ubuntu cloud 14.04 .
Basically ubuntu server and ubuntu cloud editions does not contains GUI, which needs to be installed before installing VNC server. Please note that server and cloud editions are carefully designed to utilize less hardware resources ( minimal environment ), installing GUI might leads to high hardware utilization.

Install gui on ubuntu server 14.04

Issue the below command to install GUI on server and cloud editions.
krizna@leela:~$ sudo apt-get install --no-install-recommends ubuntu-desktopUse –no-install-recommends key to keep GUI minimal. this will skip extra tools and apps and will install only basic desktop environment with few supported tools . Ubuntu desktop users can skip this command .

Install VNC server on ubuntu 14.04

Step 1 » Start installing below gnome packages which helps VNC to load properly . These packages are required for all editions including ubuntu desktop .
krizna@leela:~$ sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
Step 2 » Now install vnc4server package.
krizna@leela:~$ sudo apt-get install vnc4server
Step 3 » Open /usr/bin/vncserver file and edit as follows . Before editing, make a backup copy.
krizna@leela:~$ sudo cp /usr/bin/vncserver /usr/bin/vncserver.bkp
krizna@leela:~$ sudo nano /usr/bin/vncserverFind this line ( Line no:57 )
"# exec /etc/X11/xinit/xinitrcnn".and add these lines like below

1

2

3

4

5

6

    "# exec /etc/X11/xinit/xinitrcnn".

       "gnome-panel &n".

       "gnome-settings-daemon &n".

       "metacity &n".

       "nautilus &n".

       "gnome-terminal &n".

Step 4 » Now type the command vncserver to start VNC session. you will be prompted for creating new vnc password.
krizna@leela:~$ vncserver
You will require a password to access your desktops.
Password:******
Verify:******
xauth: file /home/boby/.Xauthority does not exist
New 'leela:1 (krizna)' desktop is leela:1
Creating default startup script /home/krizna/.vnc/xstartup
Starting applications specified in /home/krizna/.vnc/xstartup
Log file is /home/krizna/.vnc/leela:1.log

Step 5 » Now you can view your remote desktop using IP address and port ( Eg : 192.168.1.10:1 ).

install vnc server on ubuntu 14.04

install gui on ubuntu server


That’s it, your VNC server is working.

VNC server as service

Just like centos and other flavours , you can run VNC server as service in ubuntu.
This is very helpful, as it automatically starts vnc sessions when restarting the server.
Step 6 » Create a file vncserver in /etc/init.d/ directory
krizna@leela:~$ sudo nano /etc/init.d/vncserverand add the below code .

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

#!/bin/bash

### BEGIN INIT INFO

# Provides:          VNCSERVER

# Required-Start:    $remote_fs $syslog

# Required-Stop:     $remote_fs $syslog

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: Start daemon at boot time

# Description:       Enable service provided by daemon.

### END INIT INFO

unset VNCSERVERARGS

VNCSERVERS=""

[ -f /etc/vncservers.conf ] && . /etc/vncservers.conf

prog=$"VNC server"

start() {

. /lib/lsb/init-functions

REQ_USER=$2

echo -n $"Starting $prog: "

ulimit -S -c 0 >/dev/null 2>&1

RETVAL=0

for display in ${VNCSERVERS}

do

export USER="${display##*:}"

if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then

echo -n "${display} "

unset BASH_ENV ENV

DISP="${display%%:*}"

export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"

su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"

fi

done

}

stop() {

. /lib/lsb/init-functions

REQ_USER=$2

echo -n $"Shutting down VNCServer: "

for display in ${VNCSERVERS}

do

export USER="${display##*:}"

if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then

echo -n "${display} "

unset BASH_ENV ENV

export USER="${display##*:}"

su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1

fi

done

echo -e "n"

echo "VNCServer Stopped"

}

case "$1" in

start)

start $@

;;

stop)

stop $@

;;

restart|reload)

stop $@

sleep 3

start $@

;;

condrestart)

if [ -f /var/lock/subsys/vncserver ]; then

stop $@

sleep 3

start $@

fi

;;

status)

status Xvnc

;;

*)

echo $"Usage: $0 {start|stop|restart|condrestart|status}"

exit 1

esac

Step 7 » Modify execute permission for the file.
krizna@leela:~$ sudo chmod +x /etc/init.d/vncserver
Step 8 » Create vncservers.conf file in /etc/ directory as stated in service code.
krizna@leela:~$ sudo nano /etc/vncservers.confand add the below lines for starting vnc session for the user krizna.

1

2

VNCSERVERS="1:krizna"

VNCSERVERARGS[1]="-geometry 1024x768"

For additional vnc users.
Login into the user
krizna@leela:~$ su - bobbyCreate VNC password by the below command . vncserver command ( step 4) is not required when starting as service .
bobby@leela:~$ vncpasswd
Password:
Verify:

Add user to the file.

1

2

3

VNCSERVERS="1:krizna 2:bobby"

VNCSERVERARGS[1]="-geometry 1024x768"

VNCSERVERARGS[2]="-geometry 1024x768"

Now user krizna can be accessed using serverip:1 ( 192.168.1.10:1 )and bobby using serverip:2 ( 192.168.1.10:2 ).
Step 9 » Issue the below command to add vncserver service to default runlevels.
krizna@leela:~$ sudo update-rc.d vncserver defaults
Step 10 » Now start/restart the service.
krizna@leela:~$ sudo /etc/init.d/vncserver start[or]
krizna@leela:~$ sudo /etc/init.d/vncserver restart

install gui on ubuntu cloud


All the best.

Also see :
» Enable remote desktop ubuntu 16.04

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/435846.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Nsis 使用1-- 依条件显示自定义页面 custom page on condition

在制作安装程序的时候,我们会经常遇到根据用户的不同选择而随后显示不同的安装信息采集页面。 其实很简单,在使用NSIS的时候发现了这么个方法,记下来防止自己忘记哈:Code; MUI 2 compatible ------!include "MUI2.nsh"!…

WINCE6.0操作系统---内核(kernel)学习

备注:这里的内核指kernel,其表现形式为kernel.dll,OS指操作系统,core指核心。 图1 WINCE6.0体系结构 1. kernel的组成和功能 WINCE6.0操作系统内(kernel)在代码中的表现形式是kernel.dll(也就是kern.dll), WINCE5…

【转】WPF调用图片路径,或资源图片

转自:https://www.cnblogs.com/sntetwt/p/5402098.html 一、加载本项目的图片 WPF引入了统一资源标识Uri(Unified Resource Identifier)来标识和访问资源。 其中较为常见的情况是用Uri加载图像。Uri表达式的一般形式为:协议授权路径 协议:pa…

如何自学java迅速成为java高手

很多网友咨询学习Java有没有什么捷径,我说“无他,唯手熟尔”。但是JAVA私塾愿意将一些经验写出来,以便后来者少走弯路,帮助别人是最大的快乐嘛! 要想学好Java,首先要知道Java的大致分类。我们知道,自从Sun推出Java以来…

WINCE6.0体系结构学习

WINCE6.0的体系结构图如下图所示: 图1 WINCE的体系结构 根据上图可以把WINCE6.0体系结构分为硬件层、OEM层、操作系统层和应用层,这四层紧密合作,相互配合来完成从应用程序的调用到对硬件的操作和交互。 1. 硬件层 硬件平台的核心是嵌入…

【转】DICOM图像像素值(灰度值)转换为CT值

转自:https://www.cnblogs.com/xuhui24/p/6193032.html https://zhuanlan.zhihu.com/p/358770379 CT值的单位是Hounsfield,简称为Hu,范围是-1024-3071。用于衡量人体组织对X射线的吸收率,设定水的吸收率为0Hu。 在DICO…

无限级分类查询

关于无限级分类的查询问题 分类表cataid parentid1 02 13 14 25 2 表 table1 id cataid title 一个分类信息表,根类别是parentid为0的 这时要查询出类别1下面的所有内容,怎么查,?转载于:https://www…

C/C++ 通过初始化列表和构造函数内赋值初始化成员变量的区别

一般我们进行成员变量初始化用两种方法 第一种是通过在构造函数内赋值 class Point{public:Point(){ _x 0; _y 0;};Point( int x, int y ){ _x 0; _y 0; }private:int _x, _y;}; 第二种是使用初始化列表 class Point{public:Point():_x(0),_y(0){};Point( int x, int y ):_…

【转】深度理解C# 的执行原理

转自:https://zhuanlan.zhihu.com/p/47177008 从编译原理说起虚拟机是什么C# 是什么,IL 又是什么.Net Framework vs MonoUnity3D 中的 C#小结作者:易立 | 腾讯IEG高级工程师为什么 Unity3D 可以运行 C#,C# 和 Mono 是什么关系&am…

C#提供的类库能够轻松实现对文件的操作

//C#写入/读出文本文件 stringfileName "c:I.txt";   StreamReader sr newStreamReader(fileName); stringstrsr.ReadLine (); sr.close();  StreamWriterrwFile.CreateText(Server.MapPath(".")"\myText.txt");   rw.WriteLine("写入…

Java程序员的推荐阅读书籍

作为Java程序员来说,最痛苦的事情莫过于可以选择的范围太广,可以读的书太多,往往容易无所适从。我想就我自己读过的技术书籍中挑选出来一些,按照学习的先后顺序,推荐给大家,特别是那些想不断提高自己技术水…

【转】Win10系统创建WiFi热点的两种方法

现在电脑和wifi已经成为很多人生活中不可缺少的一部分,上网过程只有连接WiFi才可以上网。使用windows10系统开启WiFi热点都是提示没有找到支持的无线网卡。不管你是驱动更新,重装,还是怎么操作都是不能用。为此,大家不妨参考下文方…

影院平台搭建 - (6)一个靠谱的视频播放方案的感想

折腾了我很久很久,让我一个月内天天只睡不到6个小时。总算折腾出一套至少我觉得是比较靠谱的东西了。在这里总结一下:1、如果追求画面质量,就不要用FLV格式,算法的先天缺陷导致无论怎么调试画面质量都不能上去。YouTube用MP4格式作…

【转】Win10系统怎么设置无线做AP热点_win10设置无线为ap热点的步骤

转自:http://www.win7zhijia.cn/win10jc/win10_33126.html 在win10系统中,默认情况下无线网卡大部分都用于STA模式,但是有时候需要将无线网卡的工作模式为SoftAP,这样如果有双网卡的话,就能够将本机网络共享给其他PC或…

虚析构函数解析

C 指出:当一个派生类对象通过使用一个基类指针删除,而这个基类有一个非虚的析构函数,则结果是未定义的。运行时比较有代表性的后果是对象的派生部分不会被销毁。如果一个类要被另外一个类继承,而且用其指针指向其子类对象时&#…

SQL Server 2005参考:PIVOT

SQL Server 2005参考:PIVOT 可以使用 PIVOT 和 UNPIVOT 关系运算符对表值表达式进行操作以获得另一个表。 (1)PIVOT 通过将表达式某一列中的唯一值转换为输出中的多个列来转换表值表达式,并在必要时对最终输出中所需的任何其余的列值执行聚合。 (2)UNPIV…

【转】wifi的几种工作模式

转自:https://www.cnblogs.com/Ph-one/p/12455362.html https://www.cnblogs.com/jpzhu/p/11983992.html WIFI配置具体的模式主要有以下这几种:STA模式、AccessPoint模式、Monitor模式、Ad-hoc(IBSS)模式、WDS模式、Mesh模式。 …

C++结构体实例和类实例的初始化

结构体实例(包括共用体)和类实例的初始化方法完全相同,二者都可以应用于继承层次中。不同点是结构体(包括共用体)默认成员为public,而类默认成员是private型的。 一、若类和结构体所有数据成员均为public型…

【转】WIFI-Direct(Wifi直连)、AirPlay、DLAN、Miracast功能介绍

转自:https://www.cnblogs.com/yuanqiangfei/p/11674640.html 不知道大家对无线同屏技术有多少了解,当这种技术普及的时候,我想我们的工作与生活又会方便很多吧!下面是目前三种主流同屏技术的介绍: 目前这种将终端信…

[轉]C# 中的委托和事件

轉自:http://www.cnblogs.com/jimmyzhang/archive/2007/09/23/903360.htmlpdf:http://www.tracefact.net/Document/Delegates-and-Events-in-CSharp.pdfC# 中的委托和事件 引言 委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件…