1. Installing Tigervnc-server
Yum Install Tigervnc-server
2. setting up the Vncserver server
Copy the file provided by default to the /etc/systemd/system
following command:
CP /lib/systemd/system/[email protected]/etc/systemd/system/[email protected]:1. Service
Modify Configuration
vi/etc/systemd/system/vncserver@:1.service
Replace it with the <USER>
user name you want, I use the account root, add parameters to set the resolution -geometry 1280x720
, all the content is as follows
# The Vncserver service unitfile# # Quick howto:#1. Copy thisfileTo/etc/systemd/system/[email protected]:<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 [email protected]:<display>. Service ' # ... [Unit] Description=Remote Desktop Service (VNC) after=Syslog.target Network.target[service]type=forking# Clean any existing filesinch/tmp/. x11-Unix Environmentexecstartpre=/bin/SH-C'/usr/bin/vncserver-kill%i >/dev/null 2>&1 | |:'Execstart=/sbin/runuser-lRoot-C"/usr/bin/vncserver%i -geometry 1280x720 "Pidfile=/Root/.vnc/%h%i.pid # Normal user may have path to/home/<user>/.vnc/%h%i.pidexecstop=/bin/SH-C'/usr/bin/vncserver-kill%i >/dev/null 2>&1 | |:'[Install]wantedby=multi-user.target
Reload the configuration:
Systemctl Daemon-reload
If required can be set to boot up:
SYSTEMCTL enable [email protected]:1. Service
3. Setting up a firewall
First decide firewalld
whether to start
Firewall-cmd--state
If it is not started, start the firewall first
Systemctl Start Firewalld
Add Port number 5901-5905 exceptions
Firewall-cmd--permanent--zone=public--add-port=5901-5905/tcp
Reload the firewall
Firewall-cmd--reload
You can use the following command to see if the port number is joined
Firewall-cmd--list-all-zones
4. Setting the VNC password
Via SSH, log in to the server with the Oracle user name and execute the following command
Vncserver
The terminal will prompt you to enter the password, as follows
You'll require a password to access your desktops. Password:Verify:Would to enter a view-only Password (y/n)? 'lenmomdesktop:1 (root)' Desktop is lenmomdesktop:1/root/. vnc//root/.vnc/ in/root/.vnc/file is/root/.vnc/lenmomdesktop: 1. Log
If you want to change your password, you can use it vncpasswd
. Now that a VNC service is running, but we need to start with the service we just configured, we need to kill the VNC service first and use the following command:
Vncserver-Kill :1
Next, restart the service:
Systemctl Daemon-reload
Systemctl restart [email protected]:1.service
Use the following command to see if the service is running correctly
SYSTEMCTL status [email protected]:1. service-l
If it starts correctly, the output should be:
[Email protected]:1. Service-Remote Desktop Service (VNC) loaded:loaded (/etc/systemd/system/[email protected]:2. service; enabled; vendor preset:disabled) Active:active (running) since day .- -- at +: -: *CST; 12h agoprocess:8720Execstart=/usr/sbin/runuser-l oracle-c/usr/bin/vncserver%i-geometry 1280x720(Code=exited, status=0/SUCCESS) Process:8716execstartpre=/bin/SH-c/usr/bin/vncserver-Kill%i >/dev/NULL 2>&1|| : (Code=exited, status=0/SUCCESS) Main PID:8744(XVNC) CGroup:/system.slice/system-vncserver.slice/[email protected]:2. Service?8744/USR/BIN/XVNC:2-desktop127.0.0.1:2(Oracle)-auth/home/oracle/. Xauthority-geometry 1280x720-rfbwait30000-rfbauth/home/oracle/.vnc/passwd-rfbport5902-FP Catalogue:/etc/x11/fontpath.d-pn7 Month at +: -: + 127.0.0.1systemd[1]: Starting Remote Desktop Service (VNC) ... July at +: -: * 127.0.0.1systemd[1]: Started Remote Desktop Service (VNC).
If you want to configure multi-user access at the same time, you need to change the above, and [email protected]:1.service
[email protected]:2.service
then configure the user name, resolution parameters, and then follow the steps above to do it again.
Windows Remote Desktop Connection CentOS 7