centos6和7安装vnc

centos6安装vnc

yum安装

yum groupinstall -y "Desktop" yum install -y tigervnc-server tigervnc-server-module

安装这两个yum就够了,装第一个Desktop的时候可能会遇到缺少相关库等等,把镜像源替换成阿里云的就可以了。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

`wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

安装完vnc,配置完密码之后按照下边修改配置文件然后再启动vnc,再用vnc连就可以了。

vi /etc/sysconfig/vncservers
#注释以下两行
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
#添加以下两行
VNCSERVERS="1:root"??
VNCSERVERARGS[1]="-geometry?1024x768"

vi /root/.vnc/xstartup
#注释以下两行
#ixterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
#添加gnome-session?&?
gnome-session?&?
#xstartup赋权
chmod 777 /root/.vnc/xstartup

centos7安装vnc

yum安装

yum groupinstall "GNOME Desktop" yum install -y tigervnc-server tigervnc-server-module

yum安装,正常用阿里云的源这个"GNOME Desktop"是可以正常装上去的。装完配置完密码就按照vnc配置文件里提示的步骤改配置文件就行了

# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/[email protected]
# 2. Replace <USER> with the actual user name and edit vncserver
#    parameters appropriately
#    (ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
#     PIDFile=/home/<USER>/.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable [email protected]:<display>.service`
  1. 拷贝配置文件到 /etc/systemd/system/[email protected]
    cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service
  2. 编辑 /etc/systemd/system/[email protected]:1.service`
    [Unit]
    Description=Remote desktop service (VNC)
    After=syslog.target network.target
    
    [Service]
    Type=forking
    user=root
    # Clean any existing files in /tmp/.X11-unix environment
    ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
    ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver :1"
    PIDFile=/root/.vnc/%H:1.pid
    ExecStop=/bin/sh -c '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'
    
    [Install]
    WantedBy=multi-user.target
    

    参照上边的配置文件修改就可以了,根据自己的需要改,不是root用户启动的vnc可以把root换成其他用户。

    3.执行提示的第三步和第四步,让配置文件生效,和开启服务

    systemctl daemon-reload

    systemctl enable [email protected]:<display>.service

    systemctl start [email protected]:1.service

注意点

执行./runInstaller之后可能会报错,并且安装图形化状况不弹出来,则需要在root账户下执行xhost +,然后切换到oracle账户,执行export DISPLAY=:0.0,然后再执行./runInstaller,图形化界面应该就可以弹出来了,不过还是要视具体报错来看。

参考报错

[[email protected] database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 28019 MB    Passed
Checking swap space: 0 MB available, 150 MB required.    Failed <<<<
Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

Continue? (y/n) [n] y

>>> Ignoring required pre-requisite failures. Continuing...
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-09-11_11-21-23PM. Please wait ...
DISPLAY not set. Please set the DISPLAY and try again.
Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:
- For csh:              % setenv DISPLAY 192.168.1.128:0.0
- For sh, ksh and bash:     $ DISPLAY=192.168.1.128:0.0; export DISPLAY
Use the following command to see what shell is being used:
    echo $SHELL
Use the following command to view the current DISPLAY environment variable setting:
    echo $DISPLAY
- Make sure that client users are authorized to connect to the X Server.
To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:
% xhost +
To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':
    % <full path to xclock.. see below>
If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.
Typical path for xclock: /usr/X11R6/bin/xclock

记得主机名也是要配置的,配置自己主机实际IP和主机名,

原文地址:https://www.cnblogs.com/dhzg/p/11515063.html

时间: 2024-08-28 03:18:35

centos6和7安装vnc的相关文章

centos6中yum安装vnc

yum groupinstall "X Window System" -y(中文桌面,可以不用安装) yum install fontforge -y(如果不安装fontforge,vncviewer客户端连接上来时,文字会变成方块) yum groupinstall "Desktop" -y(gnome桌面) yum install tigervnc-server -y vi /etc/sysconfig/vncservers VNCSERVERS="1

centos7安装vnc

前言: centos6和centos7安装VNC的方法略有不同,主要体现在安装后的配置上.本文的安装是采用yum安装的,如果不太清楚网络yum源和光盘yum源搭建的请看我的其它文档. 1.安装前先确认是否已经安装了vnc: [[email protected] ~]# rpm -qa vnc 或者 [[email protected] ~]# rpm -qa | grep vnc 2.查看yum服务器上的vnc相关的软件包: [[email protected] ~]# yum list | g

(转)centos6.5安装VNC

在Linux下用VNC远程桌面是个很不错的玩意.但在CentOS中默认没有安装VNC的.可以用下面语句查询,如果出现下面情况说明没有安装vnc #rpm -q tigervnc tigervnc-server package tigervnc is not installed package tigervnc-server is not installed 1.安装VNC服务 yum install tigervnc tigervnc-server 然后就等待安装完成. 2.为vncserver

CentOS6.5 安装VNC服务器

1.下载并按照vnc-server 1.1 检查是否已经安装 默认情况下,vnc服务是没有被系统安装的,可以通过以下命令查看: # rpm -qa | grep vnc #执行查询命令 tigervnc-1.1.0-18.el6.x86_64 #有内容说明已经安装了服务.我这里已经安装,所以会有结果出来. tigervnc-server-1.1.0-18.el6.x86_64 执行查询命令,如果没有内容说明还没有安装vnc服务,需要安装. 1.2 下载和安装 其实这个步骤很简单,都交给系统去做了

CentOS6.5下安装Open vSwitch

准备 # yum install openssl-devel redhat-rpm-config kernel-devel -y #yum install kvm libvirt python-virtinst qemu-kvm virt-viewer 编译 # wget http://openvswitch.org/releases/openvswitch-1.9.3.tar.gz #tar -zxf openvswitch-1.9.3.tar.gz # cd openvswitch-1.9.

安装VNC(使用gonme桌面环境)

最小话系统安装vnc使用gonme桌面环境 1:安装gonme桌面环境 a:安装gonme需要安装两个组 [[email protected] ~]# yum groupinstall "X Window System"(图形界面用户接口支持)[[email protected] ~]# yum groupinstall "Desktop"(centos6.3之后gonme的默认名称是desktop) b:启动Gnome桌面[[email protected] ~]

Linux下安装VNC Server

操作系统centos6.5,在其之上安装vnc server,可利用windows上的vnc client远程登录. 1. 安装 yum install tigervnc-server.x86_64 2. 设置密码 vncpasswd xxx 3. 执行 vim /etc/sysconfig/vncservers 设置 将下面两行注释去掉: VNCSERVERS="1:root" # 1:root (桌面号:用户),配置启动一号桌面 VNCSERVERARGS[2]="-ge

CentOS6.3下安装kvm和创建kvm虚拟机

一.安装kvm 1 在安装CentOS6.3时可以选择安装好kvm 2 如果未安装好kvm,请按照下列方式安装 [创建本地yum源] 挂载iso文件mount -o loop -t iso9660 CentOS-6.3-x86_64-bin-DVD1.iso /mnt 设置本地yum源在/etc/yum.repos.d/创建   "任意文件名.repo"    文件  vi 刚才新建的文件名编辑[localyum]任意名称 ,不能有空格.name= local yum  任意名称bas

centos6.5上安装guacamole

一.工作安排 在centos6.5上安装guacamole.安装guacamole前需要先安装jdk和tomcat. 二.具体步骤 一.安装jdk 1.下载jdk压缩文件 本次选择jdk1.8.0_65 2.新建/usr/java文件夹,将jdk压缩包解压到 /usr/java下,改名为jdk1.8 3.配置java环境变量 编辑 /etc/profile文件 # vim /etc/profile JAVA_HOME=/usr/java/jdk1.8 PATH=$JAVA_HOME/bin:$P