CentOS安装使用vnc进行远程桌面登录

简介:

以下介绍在CentOS 7下安装vncserver并使用vnc-viewer进行登录(使用root权限):

1、运行命令yum install tigervnc-server安装vncserver;

2、运行命令yum install vnc安装vnc;//感觉不安装也可以,安装一下也很快,不要在意这些细节

3、运行命令yum groupinstall "X Window System"安装X-Window;//之前安装发现经常无法启动vncserver,后面通过网上查资料介绍可以安装X-Window解决这个 问题

4、安装中文字符以解决界面中文乱码的问题:yum install dejavu-lgc-sans-fonts、yum groupinstall "Fonts" -y

5、禁用防火墙,如果已经禁用防火墙可以跳过这一步:systemctl stop firewalld.service、systemctl disable firewalld.service

6、配置vncserver:
拷贝创建一个新的配置文件,以开启1号窗口为例,如果需要开启多个则创建多个配置文件即可:
[root@localhost ~]# cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:1.service
修改配置文件内容
[root@localhost ~]# vi /lib/systemd/system/vncserver@:1.service

The vncserver service unit file

Quick HowTo:

1. Copy this file to /etc/systemd/system/vncserver@.service

2. Replace with the actual user name and edit vncserver

parameters appropriately

("User=" and "/home//.vnc/%H%i.pid")

3. Run systemctl daemon-reload

4. Run systemctl enable vncserver@:<display>.service

DO NOT RUN THIS SERVICE if your local area network is

untrusted! For a secure way of using VNC, you should

limit connections to the local host and then tunnel from

the machine you want to view VNC on (host A) to the machine

whose VNC output you want to view (host B)

[user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB

this will open a connection on port 590N of your hostA to hostB's port 590M

(in fact, it ssh-connects to hostB and then connects to localhost (on hostB).

See the ssh man page for details on port forwarding)

You can then point a VNC client on hostA at vncdisplay N of localhost and with

the help of ssh, you end up seeing what hostB makes available on port 590M

Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

Use "-localhost" to prevent remote VNC clients connecting except when

doing so through a secure tunnel. See the "-via" option in the

`man vncviewer' manual page.

[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=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
PIDFile=/root/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

7、运行命令systemctl daemon-reload更新systemctl;

8、运行命令vncpasswd root设置vncserver的密码;

9、运行命令systemctl start vncserver@:1.service(可以运行systemctl enable vncserver@:1.service命令设置为默认启动服务);//启动不了则重启一下系统或则查看启动日志

10、重启系统后使用VNC-Viewer连接:192.168.10.100:1,输入设置的密码即可登录。

相关文章
|
Ubuntu Linux Docker
[笔记]Centos/Ubuntu/Windows/Docker 安装使用Aria2及Aria2基本使用
[笔记]Centos/Ubuntu/Windows/Docker 安装使用Aria2及Aria2基本使用
1086 0
|
Ubuntu 网络协议 数据安全/隐私保护
使用VNC远程桌面Ubuntu【内网穿透实现公网远程】
使用VNC远程桌面Ubuntu【内网穿透实现公网远程】
828 0
|
12月前
|
安全 网络安全
gbase8a centos8(kylinv10)加载报登录 ftp失败报错530 Login incorrect 排查过程及解决办法
centos8(kylinv10)加载报登录 ftp失败报错530 Login incorrect 排查过程及解决办法
|
网络安全 Windows
Windows server 2012R2系统安装远程桌面服务后无法多用户同时登录是什么原因?
【11月更文挑战第15天】本文介绍了在Windows Server 2012 R2中遇到的多用户无法同时登录远程桌面的问题及其解决方法,包括许可模式限制、组策略配置问题、远程桌面服务配置错误以及网络和防火墙问题四个方面的原因分析及对应的解决方案。
1045 4
|
关系型数据库 MySQL Linux
在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置 MySQL 服务、登录设置等。
本文介绍了在 CentOS 7 中通过编译源码方式安装 MySQL 数据库的详细步骤,包括准备工作、下载源码、编译安装、配置 MySQL 服务、登录设置等。同时,文章还对比了编译源码安装与使用 RPM 包安装的优缺点,帮助读者根据需求选择最合适的方法。通过具体案例,展示了编译源码安装的灵活性和定制性。
990 2
|
Linux 数据安全/隐私保护
百度搜索:蓝易云【Centos7系统路由追踪安装使用教程。】
CentOS 7是一种常用的Linux操作系统,它具有广泛的应用和用户群体。路由追踪是一种网络工具,用于确定到达目标主机的网络数据包路径。
241 0
|
网络协议 Linux 网络安全
蓝易云 - centos用ssh登录连接缓慢处理
请根据自己的实际情况尝试以上方法,找出导致SSH登录缓慢的原因,并进行相应的处理。
219 1
|
Linux
linux centos7查看linux的登录日志
linux centos7查看linux的登录日志
650 2
linux centos7查看linux的登录日志
|
弹性计算 运维 安全
|
Linux 网络安全 数据安全/隐私保护
【最新教程】树莓派安装系统及VNC远程桌面连接
【最新教程】树莓派安装系统及VNC远程桌面连接