centos6.8安装xfce+vnc

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.8安装xfce+vnc相关的知识,希望对你有一定的参考价值。

linux环境
[[email protected] ~]# uname -a
Linux server1.52chenqi.cn 4.10.5-1.el6.elrepo.x86_64 #1 SMP Wed Mar 22 14:55:33 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# cat /etc/issue
CentOS release 6.9 (Final)
Kernel \r on an \m

安装xfce

1.yum upgrade

[[email protected] ~]# yum upgrade
Loaded plugins: fastestmirror
Setting up Upgrade Process
Loading mirror speeds from cached hostfile
 * base: mirrors.syringanetworks.net
 * elrepo-kernel: repos.lax-noc.com
 * extras: mirror.hostduplex.com
 * updates: repos-lax.psychz.net

2.yum install -y wget

[[email protected] ~]# yum install -y wget
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirror.tocici.com
 * elrepo-kernel: repos.lax-noc.com
 * extras: mirror.hostduplex.com
 * updates: repos-lax.psychz.net
Package wget-1.12-10.el6.x86_64 already installed and latest version
Nothing to do

我已经装过了
3.wget http://www.rpmfind.net/linux/centos/6.9/extras/x86_64/Packages/epel-release-6-8.noarch.rpm

[[email protected] ~]# wget http://www.rpmfind.net/linux/centos/6.9/extras/x86_64/Packages/epel-release-6-8.noarch.rpm
--2018-05-31 09:40:29--  http://www.rpmfind.net/linux/centos/6.9/extras/x86_64/Packages/epel-release-6-8.noarch.rpm
Resolving www.rpmfind.net... 195.220.108.108
Connecting to www.rpmfind.net|195.220.108.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-rpm]
Saving to: “epel-release-6-8.noarch.rpm”

100%[======================================>] 14,540      88.7K/s   in 0.2s

2018-05-31 09:40:30 (88.7 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540]

4.rpm -ivh epel-release-6-8.noarch.rpm

[[email protected] ~]# rpm -ivh epel-release-6-8.noarch.rpm
Preparing...                ########################################### [100%]
        package epel-release-6-8.noarch is already installed

5.如果已经安装了epel-release,请先卸载,再重新安装
# rpm -e epel-release
# rpm -ivh epel-release-6-8.noarch.rpm

[[email protected] ~]# rpm -e epel-release
warning: /etc/yum.repos.d/epel.repo saved as /etc/yum.repos.d/epel.repo.rpmsave
[[email protected] ~]# rpm -ivh epel-release-6-8.noarch.rpm
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

6.安装xfce yum groupinstall xfce

[[email protected] ~]# yum groupinstall xfce
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
 * base: repos.forethought.net
 * elrepo-kernel: repos.lax-noc.com
 * epel: mirrors.develooper.com
 * extras: mirror.hostduplex.com
 * updates: repos-lax.psychz.net
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package NetworkManager-gnome.x86_64 1:0.8.1-113.el6 will be installed
--> Processing Dependency: NetworkManager-glib = 1:0.8.1-113.el6 for package: 1:NetworkManager-gnome-0.8.1-113.el6.x86_64
--> Processing Dependency: NetworkManager = 1:0.8.1-113.el6 for package: 1:NetworkManager-gnome-0.8.1-113.el6.x86_64
--> Processing Dependency: libnotify >= 0.4.3 for package: 1:NetworkManager-gnome-0.8.1-113.el6.x86_64
.......

7.安装vnc yum install vnc vnc-server

[[email protected] ~]# yum install tigervnc-server
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.syringanetworks.net
 * elrepo-kernel: repos.lax-noc.com
 * epel: mirrors.develooper.com
 * extras: mirror.hostduplex.com
.........

8.配置VNC系统及分辨率

vi /etc/sysconfig/vncservers

然后在内容中添加

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"

上面的分辨率可以根据我们自己的需要修改,比如可以改成800x600等。
9.设置VNC密码 vncserver

[[email protected] ~]#  vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  file /root/.Xauthority does not exist

New ‘server1.52chenqi.cn:1 (root)‘ desktop is server1.52chenqi.cn:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server1.52chenqi.cn:1.log

10.修改xstartup配置文件

vi /root/.vnc/xstartup

所有内容都替换成:

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop"&
#twm &
startxfce4 &

11.设置权限以及重启VNC/设置开机启动

service vncserver restart
chkconfig vncserver on

以上是关于centos6.8安装xfce+vnc的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu 18.04 安装 Xfce桌面和VNC的方法

Centos7.3+Xfce桌面+VNC服务+XRDP服务 实现远程桌面连接

centos6.8部署vnc服务

debian11 xfce fcitx不能输入中文的解决

Xubuntu VNC Xfce4

为ubuntu 18.04的VNC运行轻量级桌面xfce