前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS7.6服务器部署VNC

CentOS7.6服务器部署VNC

作者头像
拓荒者
发布2019-07-18 15:12:02
2.2K0
发布2019-07-18 15:12:02
举报
文章被收录于专栏:运维经验分享

CentOS7.6服务器部署VNC

2019年04月22日 16:50:39 sukysun125 阅读数 268

CentOS7.6服务器部署VNC

安装vnc服务器

代码语言:javascript
复制
[root@localhost ~]# yum install tigervnc-server
  • 1

开启vnc

代码语言:javascript
复制
[root@localhost ~]# vncserver 

You will require a password to access your desktops.

Password:				//输入密码
Verify:					//重复密码
Would you like to enter a view-only password (y/n)? n		//只可看的密码,一般选n
A view-only password is not used
xauth:  file /root/.Xauthority does not exist

New 'localhost.VD:1 (root)' desktop is localhost.VD:1

Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.VD:1.log
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

开启远程端口

代码语言:javascript
复制
[root@localhost ~]# vncserver :1

New 'localhost.VD:1 (root)' desktop is localhost.VD:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.VD:1.log
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

查看服务器ip

代码语言:javascript
复制
[root@localhost ~]# ifconfig | grep inet
        inet 10.10.41.43  netmask 255.255.252.0  broadcast 10.10.43.255
        inet6 2400:dd01:1001:1040:3b37:b445:ad5b:ad2f  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::bdd8:8bd:8871:f736  prefixlen 64  scopeid 0x20<link>
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

关闭防火墙和selinux

1. 关闭防火墙

将firewalld服务设置为disable

代码语言:javascript
复制
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  • 1
  • 2
  • 3

查看状态,成功关闭

代码语言:javascript
复制
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Apr 22 10:06:35 localhost.VD systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 22 10:06:37 localhost.VD systemd[1]: Started firewalld - dynamic firewall daemon.
Apr 22 15:31:38 localhost.VD systemd[1]: Stopping firewalld - dynamic firewall daemon...
Apr 22 15:31:39 localhost.VD systemd[1]: Stopped firewalld - dynamic firewall daemon.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2. 关闭selinux

  • 临时修改
代码语言:javascript
复制
[root@localhost ~]# setenforce 0
  • 1
  • 永久修改,下次开机生效
代码语言:javascript
复制
[root@localhost ~]# vim /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled				//开启时显示为enforcing,将其改为disabled
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 查看状态,成功关闭
代码语言:javascript
复制
[root@localhost ~]# getenforce
Permissive
  • 1
  • 2

远程访问

打开vnc-viewer,输入需要访问的ip和端口号即可进行访问,本文中使用的ip为:10.10.41.43::5901

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • CentOS7.6服务器部署VNC
    • CentOS7.6服务器部署VNC
    • 安装vnc服务器
    • 开启vnc
    • 开启远程端口
    • 查看服务器ip
    • 关闭防火墙和selinux
    • 远程访问
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档