将VNC 安装在Centos 7步骤

( Virtual Network Computing)VNC允许Linux系统可以类似实现像Windows中的远程桌面访问那样访问Linux桌面。本文配置机器是兴宁市网络信息中心的一台Centos 7 HP服务器环境下运行。

首先试试服务器装了VNC没

[[email protected] ~]# rpm -q tigervnc tigervnc-server

没安装的话会直接出现

package tigervnc is not installed
package tigervnc-server is not installed

如果没有安装X-Windows 桌面的话要先安装Xwindows

[[email protected] ~]# yum check-update
[[email protected] ~]# yum groupinstall "X Window System"
[[email protected] ~]# yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts
[[email protected] ~]# unlink /etc/systemd/system/default.target
[[email protected] ~]# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
[[email protected] ~]# reboot

第一步,安装VNC packages:

[[email protected] ~]# yum install tigervnc-server -y

第二步,修改配置信息,在/etc/systemd/system/下建立文件夹[email protected]:1.service 把example config 文件从/lib/systemd/system/[email protected]复制到里面

[[email protected] ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service

然后打开这个配置文件/etc/systemd/system/[email protected]:1.service替换掉默认用户名

找到这一行

ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid

这里我直接用root 用户登录,所以我替换成

ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid

如果是其他用户的话比如linoxide替换如下

ExecStart=/sbin/runuser -l linoxide -c "/usr/bin/vncserver %i"
PIDFile=/home/linoxide/.vnc/%H%i.pid

第三步,重加载 systemd

[[email protected] ~]# systemctl daemon-reload

第四步,为VNC设密码

[[email protected] ~]# vncpasswd

第五步,由于我这边的Centos 7 是用iptable防火墙的所以

vim /etc/sysconfig/iptables

在合适位置加上

-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT

重启iptable

service iptables restart

如果是用Centos 7 默认防火墙的可能需要

[[email protected] ~]# firewall-cmd --permanent --add-service vnc-server
[[email protected] ~]# systemctl restart firewalld.service

如果还是有问题可以试试关闭防火墙

  1. 停止并禁用防火墙;
    systemctl stop firewalld.service
    systemctl disable firewalld.service

第六步,设默认启动并开启VNC

[[email protected] ~]# systemctl enable [email protected]:1.service
[[email protected] ~]# systemctl start [email protected]:1.service

如果出现如下错误

Job for [email protected]:1.service failed. See ‘systemctl status [email protected]:1.service’ and ‘journ 
alctl -xn’ for details.

把 [email protected]:1.service 中的 Type 參數設置為 simple 
再執行 systemctl daemon-reload和启动开启VNC

这样基本上Centos 端就设好了,Windows 端要去下一个VNC Viewer 的软件。连接一下试试看着有点简陋但是上去了的

时间: 2024-08-30 15:12:34

将VNC 安装在Centos 7步骤的相关文章

VM安装虚拟机 centos 7 、kaili 2019.3 的主要步骤

(本文仅为平时学习记录,若有错误请大佬指出,如果本文能帮到你那我也是很开心啦) 一.VM的网络设置: 1.net模式 NAT(网络地址转换协议)使用的网卡为vmnet8,可在宿主机的网络链接中查看 VM启用VM DHCP服务,会给我们选择NAT模式的机器分配IP 查看分配的IP地址范围:编辑 --> 虚拟网络编辑器 --> 选中NAT模式 -->(先修改子网IP和子网掩码)DHCP设置 --> 在里面设置IP地址池 DHCP 动态地址分配协议 使用户端PC可以自动获取IP 客户端P

移动硬盘中安装Linux(CentOS)

最近想在自己的笔记本上搞个Linux,可是自己60G的硬盘空间实在吃紧.所以决定在移动硬盘上装一个CentOS.     在移动硬盘上安装Linux和在本地硬盘上安装有以下区别:(我这里讨论的都是ISO文件安装) (1).一般在本地硬盘安装双系统的Linux是利用windows的boot.ini和grub来启动Linux的安装程序,然后再利用grub改写硬盘的mbr,使硬盘可以引导安装完成的Linux. (2).而在移动硬盘中有些不同如果你仍旧想利用本地硬盘中的boot.ini和grub,那你就

linux网络配置、环境变量以及JDK安装(CentOS 6.5)

由于需要搭建hadoop平台,但是苦于没有现成可用的linux服务器,只好自己下载了CentOS 6.5从头装起,安装过程中遇到了很多问题,比如网络配置.时钟同步.环境变量配置.以及各种服务的启停,还有jdk的安装等(虽然系统自带JDK,但是本人过于低端,自带的JDK的安装路径都搞不明白,就干脆自己装了一个),时间长了容易忘记,所以在这里写下来作为记录,顺便也分享给与我一样的菜鸟玩家,高手们可以退散了,当然了如果有批评指正小弟跪迎. 新建用户 新安装的linux一般只有root管理员用户,由于我

Oracle Enterprise Linux 64-bit下安装apache-tomcat-7.0.53步骤

测试环境:VMware Workstation v9.0.2软件中安装好Oracle Enterprise Linux 5.8 64-bit虚拟机 安装软件:jdk-7u40-linux-x64.rpm+apache-tomcat-7.0.53.tar.gz 安装说明:从官网下载jdk-7u40-linux-x64.rpm和apache-tomcat-7.0.53.tar.gz到Linux虚拟机中的/u02目录下 安装步骤:打开VMware虚拟机,使用root用户登录Linux虚拟机,进入系统后

安装beanstalkd - centos

安装: wget https://github.com/kr/beanstalkd/archive/v1.9.tar.gz mv v1.9 beanstalkd_v1.9 mv beanstalkd_v1.9 beanstalkd_v1.9.tar.gz tar -zxvf beanstalkd_v1.9.tar.gz cd beanstalkd-1.9/ mkdir /usr/local/beanstalkd make install PERFIX=/usr/local/beanstalkd

在虚拟机(VMware)中安装Linux CentOS 6.4系统(图解) 转

一.下载最新版本Linux CentOS     1.打开官网地址:http://www.centos.org/,点击Downloads->Mirrors         2.点击CentOS Public Mirror List          3.点击South American, Asian, Oceania, Middle Eastern, African and Other Regional Mirrors(选择你就近镜像)          4.选择离你的地方,点击HTTP   

安装Nvidia k80驱动步骤

安装Nvidia k80驱动步骤 ------------------ 环境介绍: CentOS6 远程终端使用Xshell -------------------- 安装Nvidia k80驱动步骤 目录 操作过程... 1 问题以及解决方案: 3 参考资料... 4   操作过程 在网上查看安装Nvida Tesla K80M , 使用./XXX-NVIDIA.run --no-opengl-files   估计 --no-opengl-files 与OpenGL有关 , 我没有时候用后面参

CentOS_6.5_x64:VNC安装配置

1.安装软件前首先检查下系统是否已经安装了这个软件:rpm -qa tigervnc-server 2.根据前面命令的查询,显示系统还是没有安装VNC服务器端软件,那么我们就使用命令进行安装一下:yum install tigervnc-server -y 3.首先服务器端需要运行级别为5的图形界面.可以使命令进行查询一下:runlevel 4.使用vncserver 命令配置一下vnc远程使用的密码:vncserver 5.编辑vnc启动图形界面的文件vim /root/.vnc/xstart

Configure VNC Server on CentOS 7 / RHEL 7

The following simple guide help you to setup the VNC server on RHEL 7/CentOS 7 machines, VNC help to share the desktop with the other machines which has a client installed. VNC server and client are not installed by default, you need to setup the vnc