CentOS7 installation graphical interface method

 

1. Linux installation (root user operation)

1. Install vncserver;

yum install tigervnc-server

2. Install vncviewer;

yum install vnc

3. Set password:

vncpasswd

4. Start vncserver:

vncserver

4. Stop and disable the firewall;

systemctl stop firewalld.service
systemctl disable firewalld.service

5. Install linux graphic desktop

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

Two, arrangement

1. Modify the startup file

vim /root/.vnc/xstartup

Fill it with the following:

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1200x800"
gnome-session &

Indicates that the window is based on geome's desktop configuration

2. Create a new configuration file, take window 1 as an example (you can also open multiple windows at the same time, just change the number), the method is 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

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

Copy code
[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=/usr/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 || :' [Install] WantedBy=multi-user.target
Copy code
 

#Start window 1

# To kill the process may exist 
vncserver -kill: 1
# Start
vncserver: 1

#View startup list status

vncserver -list

The successful start result should be as follows:

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/eunke-network002:1.log

Check the log for the port number:

cat /root/.vnc/eunke-network002:1.log

If the startup fails, enter the folder, delete the X1 file, and restart window 1:

Copy code
cd /tmp/.X11-unix 
rm -rf X1 #kill
window 1
vncserver -kill: 1 #start
window 1
vncserver: 1
Copy code

Four, Windows install VNC viewer

1. 64bit download address: https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.19.923-Windows-64bit.exe

2. Enter IP: Port after installation, as follows:

 

 

 

 

 

 

After you press Enter, you can open the remote Linux desktop (if you see a black window, you can restart the Linux server).

 

 

Guess you like

Origin www.cnblogs.com/lcword/p/12683398.html