Article source: blog.csdn.net/zlinsc/arti…

Blog.csdn.net/ownfire/art… \

Windows remote CentOS desktop (the prerequisite is that CentOS is installed in desktop version, not minimized installation) \

1.VNC

Virtual Network Computing (VNC) is a piece of software that can remotely control a remote computer. It supports Linux remote desktop management and applies to other operating systems. Putty and SSH can only be used for remote management in command mode. \

Check whether VNC is installed on the host.

rpm -q vnc vnc-server

If the output is:

package vnc is not installed\

Installation is required.

* * * *

Server Configuration

1) vncserver installation

[plain]  view plain copy

  1. yum install -y vnc-server  

2) Modify the configuration

[plain]  view plain copy

  1. vi /etc/sysconfig/vncservers  

The last two lines go to # and set them respectively as follows

Line1: “1:username”

Line2: “… 1024 * 768…”

3) Set a password

[plain]  view plain copy

  1. vncserver  

4) Modify the firewall

[plain]  view plain copy

  1. vi /etc/sysconfig/iptables  

Add -a INPUT -m state –state NEW -m TCP -p tcp-dport 5901 -j ACCEPT

Run the vncserver command to start the VNC service. The command format is vncserver: Desktop NUMBER, where desktop number is a number. Each user must occupy one desktop.

The port number used by the VNC service is related to the desktop number. VNC uses TCP ports starting from 5900. The mapping is as follows:

The desktop number is 1. —- The port number is 5901

The desktop number is 2. —- The port number is 5902

The desktop number is 3. —- The port number is 5903

\

5) Restart the firewall service

[plain]  view plain copy

  1. service iptables restart  

6) Restart the VNC service

[plain]  view plain copy

  1. service vncserver restart   

7) Ping [client IP address]

Verify connectivity

\

Client Configuration

1) Open the VNC client and enter IP address 5901

2) Enter your password

\

Linux Remote Windows desktop

1.rdesktop

\

Client configuration \

1) installation rdesktop

[plain]  view plain copy

  1. yum install -y rdesktop  

2) Use the rdesktop command to connect to the Win desktop

[plain]  view plain copy

  1. rdesktop -a 16 x.x.x.x:3389 -u username -p password -f  

\

Server Configuration

1) Enable remote access

2) Cancel firewall blocking

\

———————————————————————————————————————— ———————————————————————-

Install and configure vncserver/vncviewer in CentOS7

Hsuehwee.blog.51cto.com/10114119/16… \

Installed a.

  1. Run the following command as root user to install vncServer.

    yum install tigervnc-server 

  2. Also run the following command to install vncViewer;

    yum install vnc

  3. Stop and disable the firewall.

    systemctl stop firewalld.service

    systemctl disable firewalld.service

Configuration of two.

  1. Vncviewer is basically unconfigured;

  2. For the configuration of vNCServer, create a new configuration file, using window 1 as an example (you can also open multiple Windows at the same time, modify the number), as follows:

    cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:1.service

    Or add another window:

    cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:2.service

  3. Edit/lib/systemd/system/vncserver @ : 1. The service, set up the user root related parameters, eventually content is as follows:

12345678910 [Unit]``Description=Remote desktop service (VNC)``After=syslog.target network.target``[Service]``Type=forking``# Clean any existing files in /tmp/.X11-unix environment``ExecStartPre= /bin/sh  -c  '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'``ExecStart= /sbin/runuser  -l root -c  "/usr/bin/vncserver %i"``PIDFile= /root/ .vnc/%H%i.pid``ExecStop= /bin/sh  -c  '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
  • It is better to set the above content as the root user, otherwise you may see the following error:
1234567891011 vncserver@:1.service - Remote desktop service (VNC)``    Loaded: loaded ( /usr/lib/systemd/system/vncserver @:1.service; enabled)``    Active: failed (Result:  exit -code) since Tue 2015-04-14 10:09:24 CST; 1min 36s ago``   Process: 3258 ExecStart= /sbin/runuser  -l sysadmin -c  /usr/bin/vncserver  %i (code=exited, status=1 /FAILURE ) ` ` Process: 3254 ExecStartPre= /bin/sh  -c  /usr/bin/vncserver  - kill  %i >  /dev/null  2>&1 || : (code=exited, status=0 /SUCCESS )``Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Starting Remote desktop service (VNC)... ``Apr 14 10:09:24 F1A-VMHOST-SWPE runuser[3258]: Password:``Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: vncserver@:1.service: control process exited, code=exited status=1``Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Failed to start Remote desktop service (VNC).``Apr 14 10:09:24 F1A-VMHOST-SWPE systemd[1]: Unit vncserver@:1.service entered failed state.``Warning: Unit file  changed on disk,  'systemctl daemon-reload'  recommended.

Application three.

  1. Update systemctl to take effect;

    systemctl daemon-reload 

  2. Set the password of the vNCServer.

     vncpasswd root

    Enter and confirm the password as prompted

  3. Start the service to enable VNC window 1;

    Systemctl start vncServer @:1.service or vncserver :1

    Close Window 1:

    Systemctl stop vncserver@:1.service or vncserver -kill :1

  4. Set to start automatically upon startup;

    systemctl enable vncserver@:1.service

    End.                            

This article from “Feng Xuewei – met once you” blog, please be sure to keep the source hsuehwee.blog.51cto.com/10114119/16…

———————————————————————————————————————— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — \

Centos7 Remote desktop VNC/VNC-server Settings \

* * uchase.blog.51cto.com/880483/1545… 支那

Centos7 is very different from Centos6.x.

It took a lot of detours to install a remote desktop on a server. Write this blog post, pure for record, if encounter the same problem later, can trace back.

1. Assuming you don’t have any VNC software installed on your system, install VNC first

1 yum -y  install  tigervnc-server tigervnc

Before Centos7, VNC installation generally requires configuration

12 [root@localhost ~] # cat /etc/sysconfig/vncservers ``# THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/[email protected]

However, as mentioned above, Centos7 needs to configure the files in

12 [root@localhost ~] # ll /lib/systemd/system/[email protected]``-rw-r--r--. 1 root root 1744 Jun 10 14:15  /lib/systemd/system/vncserver @.service

3. The document contains the following tips

123456 # Quick HowTo:``# 1. Copy this file to /etc/systemd/system/vncserver@:<display>.service``# 2. Edit <USER> and vncserver parameters appropriately``#   ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")``` # 3. Run systemctl daemon-reload ````# 4. Run systemctl enable vncserver@:.service“

\

4. Copy a file and rename it vncServer @:1.service

1 [root@localhost ~] # cp /lib/systemd/system/[email protected] /lib/systemd/system/vncserver@:1.service

5. Replace the <User> in the file with your current User, and replace % I with 1

123456789101112 [Unit]``Description=Remote desktop service (VNC)``After=syslog.target network.target``[Service]``Type=forking``# Clean any existing files in /tmp/.X11-unix environment``ExecStartPre= /bin/sh  -c  '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'``ExecStart= /sbin/runuser  -l root -c  "/usr/bin/vncserver :1 -geometry 1280x720 -depth 24"``PIDFile= /root/ .vnc/%H%i.pid``ExecStop= /bin/sh  -c  '/usr/bin/vncserver -kill :1 > /dev/null 2>&1 || :'``[Install]``WantedBy=multi-user.target

Update systemctl

1 systemctl daemon-reload

7. Set it to automatic start

1 systemctl  enable  vncserver@:1.service

8. Start the VNC service

1 systemctl start vncserver@:1.service

Add port 5901 to iptables (if there are other users, add port 5901 to iptables) VNC port default is 5900 + n)

12345678910111213141516 [root@localhost system] # cat /etc/sysconfig/iptables``# sample configuration for iptables service``# you can edit this manually or use system-config-firewall``# please do not ask us to add additional ports/services to this default configuration``*filter``:INPUT ACCEPT [0:0]``:FORWARD ACCEPT [0:0]``:OUTPUT ACCEPT [0:0]``-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT``-A INPUT -p icmp -j ACCEPT``-A INPUT -i lo -j ACCEPT``-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT``-A INPUT -p tcp -m state --state NEW -m tcp --dport 5901 -j ACCEPT``-A INPUT -j REJECT --reject-with icmp-host-prohibited``-A FORWARD -j REJECT --reject-with icmp-host-prohibited``COMMIT

Note:

Connect: Connection timed out(10060) if you do not configure and enable a firewall and connect using VNC Viewer, “Connect: Connection timed out(10060)” is reported. \

2. This document uses the root user as an example. If other users also need to log in, then you need to copy the file as

1 cp  /lib/systemd/system/vncserver @.service  /lib/systemd/system/vncserver @:2.service

At the same time, change % I to 2 in the file and set up vncpasswd for the corresponding user.

These are available from UltraVNC, TigerVNC, or RealVNC Viewer, all of which I have been able to access under Windows 7

In this paper, from the “Chase” blog, please be sure to keep the source uchase.blog.51cto.com/880483/1545…

\