How to install VNC Server and redhatvnc server on redhat 7

Source: Internet
Author: User

How to install VNC Server and redhatvnc server on redhat 7

Usually we usually use xshell or putty to remotely access our linux server. If our linux server has a graphic interface installed, how can we remotely use our graphical interface? Next we use vnc to implement remote linux Server

1: install VNC Server: yum-y install vnc-server

 

2: copy the configuration template of the vnc server: cp vncserver @. service vncserver @: 1. service [root @ xwq ~] # Cd/lib/systemd/system [root @ xwq system] # cp vncserver @. service vncserver @: 1. service

Note: The VNC service uses the port 5900. Given that different users use VNC, different ports are obtained for each connection. The number in the configuration file name tells the VNC server to run the service on the sub port 5900. In this example, the first VNC service runs on port 5901 (5900 + 1), increases in sequence, and runs on port 5900 + x. X indicates the configuration file name of the user, which is vncserver @: x. service.
If you want to use more user connections, you need to create a configuration file and port to add a new user and port. Create vncserver @: 2. service and replace the user name in the configuration file with the corresponding file name and port number in the subsequent steps. Make sure that you log on to the VNC server using the user name you used when configuring the VNC password.

3: edit the configuration template: vim vncserver @: 1. service adds the root user to the login user, and before modifying the vnc resolution after login: [Unit] Description = Remote desktop service (vnc?after=syslog.tar get network.tar get [Service] Type = forking # Clean any existing files in/tmp /. x11-unix environmentExecStartPre =/bin/sh-c '/usr/bin/vncserver-kill % I>/dev/null 2> & 1 |: 'execstart =/usr/sbin/runuser-l <USER>-c "/usr/bin/vncserver % I" PIDFile =/home/<USER> /. vnc/% H % I. pidExecStop =/bin/sh-c '/usr/bin/vncserver-kill % I>/dev/null 2> & 1 |: '{install}wantedby}multi user.tar get

After modification:

[Unit]
Description = Remote desktop service (VNC)
After1_syslog.tar get network.tar get

[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 =/usr/sbin/runuser-l root-c "/usr/bin/vncserver % I-geometry 1376x730"
PIDFile =/home/root/. vnc/% H % I. pid
ExecStop =/bin/sh-c '/usr/bin/vncserver-kill % I>/dev/null 2> & 1 | :'

[Install]
Wantedbypolicmulti-user.tar get

4: (1) reload systemd and scan for new or changed units: systemctl daemon-reload [root @ xwq system] # systemctl daemon-reload (2) add a password [root @ xwq system] # vncpasswd rootPassword: enter your password Verify: enter your password again (3) start vnc desktop [root @ xwq system] # vncserver: 1You will require a password to access your login tops. password: enter your Password Verify: enter your Password xauth: file/root/again /. xauthority does not existxauth: (stdin): 1: bad display name "xwq: 1" in "add" commandNew 'xwq: 1 (root) 'desktop is xwq: 1 Creating default startup script/root /. vnc/xstartupStarting applications specified in/root /. vnc/xstartupLog file is/root /. vnc/xwq: 1.log( 4) use the following command (permanent) to enable the Service [root @ xwq system] # systemctl enable vncserver @: 1. if you enter systemctl enable vncserver @: 1. the service command outputs the following code,

[Root @ xwq system] # systemctl enable vncserver @: 1. service

Ln-s '/usr/lib/systemd/system/vncserver @: 1. service ''/etc/systemd/system/multi-user.target.wants/vncserver @: 1. service'

Enter this command in the terminal: echo "127.0.0.1 xwq">/etc/hosts

(5) enter the following command to configure firewall rules:

[Root @ xwq ~] # Firewall-cmd -- permanent -- zone = public -- add-port = 5901/tcp

Success

[Root @ xwq ~] # Firewall-cmd -- reload

Success

5. Access redhat by installing vnc viewer on windows.

 

6: Other commands to disable the vnc service: systemctl stop vncserver @: 1. The service disables the VNC service from starting up: systemctl disable vncserver @: 1. The service disables the firewall: systemctl stop firewalld. service

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.