Configure VNC Server in Oracle Linux 7

Source: Internet
Author: User
Tags windows remote desktop

Configure VNC Server in Oracle Linux 7

DBAs, in the process of creating an Oracle database, dbca and netca images are generally used for database creation and listening (if you use a script to create a database). Therefore, graphical operation tools are essential, in the Linux operating system, my personal favorite graphical operation software is VNC. Today, we just met the Oracle Linux 7 operating environment, so we can easily record the configuration process.

1. Check whether the vncserver software package has been installed.
[Root @ oracle12c ~] # Rpm-qa | grep tigervnc
Tigervnc-server-minimal-1.2.80-0.30.20130314svn5065.el7.x86_64
Tigervnc-license-1.2.80-0.30.20130314svn5065.el7.noarch

Not Installed run the following command to install
[Root @ oracle12c Packages] # pwd
/Run/media/yong/OL-7.0 Server. x86_64/Packages
[Root @ oracle12c Packages] # yum-y install tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64.rpm
Loaded plugins: langpacks
Examining tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64.rpm: tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64
Marking tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64. 2.80-0.30.20130314svn5065.el7 will be installed
--> Finished Dependency Resolution
Unknown [Errno 14] curl #6-"cocould not resolve host: public-yum.oracle.com; Unknown error"
Trying other mirror.
Unknown [Errno 14] curl #6-"cocould not resolve host: public-yum.oracle.com; Unknown error"
Trying other mirror.

Dependencies Resolved

========================================================== ========================================================== ========================================================== ========================================================== ========
Package Arch Version Repository Size
========================================================== ========================================================== ========================================================== ========================================================== ========
Installing:
Tigervnc-server x86_64 1.2.80-0.30.20130314svn5065.el7/tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64 488 k

Transaction Summary
========================================================== ========================================================== ========================================================== ========================================================== ========
Install 1 Package

Total size: 488 k
Installed size: 488 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing: tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64 1/1
Verifying: tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64 1/1

Installed:
Tigervnc-server.x86_64. 2.80-0.30.20130314svn5065.el7

Complete!


2. Configure vncserver. in earlier versions, if you install vnc, you generally need to use the vncserver command to set the password, and then configure the/etc/sysconfig/vncservers file. Although this file still exists in Oracle Linux7, it contains only one line as follows:
[Root @ oracle12c/] # cat/etc/sysconfig/vncservers
# This file has been replaced by/lib/systemd/system/vncserver @. service


First, let's take a look at the content of this file/lib/systemd/system/vncserver @. service.
[Root @ oracle12c system] # cat/lib/systemd/system/vncserver @. service
# The vncserver service unit file
#
# Quick HowTo:
#1. Copy this file to/etc/systemd/system/vncserver @:. service
#2. Edit 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'
#
# 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: 590 M hostB
#
# This will open a connection on port 590N of your hostA to hostB's port 590 M
# (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
# The help of ssh, you end up seeing what hostB makes available on port 590 M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting tables t when
# Doing so through a secure tunnel. See the "-via" option in
# 'Man vncviewer 'manual page.


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

[Install]
Wantedbypolicmulti-user.tar get


You can see the following information from the above, which provides the operation steps. 1: copy the file to the/etc/systemd/system directory and name it vncserver @:. service; 2: replace <USER> with the USER name you want to enable vncserver; 3: Execute systemctl daemon-reload; 4: Execute systemctl enable vncserver @:. to start the vncserver service.
#1. Copy this file to/etc/systemd/system/vncserver @:. service
#2. Edit 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'

Copy the file first:
[Root @ oracle12c system] # cp/lib/systemd/system/vncserver @. service/etc/systemd/system/vncserver @: 1. service

[Root @ oracle12c/] # cd/etc/systemd/system
[Root @ oracle12c system] # ls-lrt vnc *
-Rw-r --. 1 root 1744 Mar 28 :47 vncserver @: 1. service

Edit vncserver @: 1. Replace the file with root in the service file.
The content before modification is as follows:
[Root @ oracle12c system] # cat/lib/systemd/system/vncserver @. service
# The vncserver service unit file
#
# Quick HowTo:
#1. Copy this file to/etc/systemd/system/vncserver @:. service
#2. Edit 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'
#
# 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: 590 M hostB
#
# This will open a connection on port 590N of your hostA to hostB's port 590 M
# (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
# The help of ssh, you end up seeing what hostB makes available on port 590 M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting tables t when
# Doing so through a secure tunnel. See the "-via" option in
# 'Man vncviewer 'manual page.

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

[Install]
Wantedbypolicmulti-user.tar get

The modified content is as follows:
[Root @ oracle12c system] # vi vncserver @: 1. service
# The vncserver service unit file
#
# Quick HowTo:
#1. Copy this file to/etc/systemd/system/vncserver @:. service
#2. Edit 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'
#
# 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: 590 M hostB
#
# This will open a connection on port 590N of your hostA to hostB's port 590 M
# (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
# The help of ssh, you end up seeing what hostB makes available on port 590 M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting tables t when
# Doing so through a secure tunnel. See the "-via" option in
# 'Man vncviewer 'manual page.


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

[Service]
Type = simple
# 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"
PIDFile =/root/. vnc/% H: 1.pid
ExecStop =/bin/sh-c '/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 | :'

[Install]
Wantedbypolicmulti-user.tar get

Note that the Type value must be changed to simple, and the original forking cannot be used. Otherwise, the system CTL start vncserver @: 1. service will fail. The fault information is as follows:
[Root @ oracle12c system] # systemctl start vncserver @: 1. service
Job for vncserver @: 1. service failed. See 'systemctl status vncserver @: 1. service' and 'journalctl-xn 'for details.
[Root @ oracle12c system] # systemctl status vncserver @: 1. service
Vncserver @: 1. service-Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver @: 1. service; enabled)
Active: failed (Result: resources) since Mon 2016-03-28 10:57:03 CST; 26 s ago
Process: 11898 ExecStart =/sbin/runuser-l root-c/usr/bin/vncserver % I (code = exited, status = 0/SUCCESS)
Process: 11895 ExecStartPre =/bin/sh-c/usr/bin/vncserver-kill % I>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)

3. Set the Remote Login Password
Log on to the operating system and run vncpasswd. Note that this password is not necessarily the same as the password for logging on to the operating system. You need to set this password for all accounts on the Remote Desktop.
[Root @ oracle12c/] # vncpasswd root
Password:
Verify:

4. Set vncserver to self-start
[Root @ oracle12c system] # systemctl daemon-reload
[Root @ oracle12c system] # systemctl enable vncserver @: 1. service
[Root @ oracle12c system] # systemctl start vncserver @: 1. service
[Root @ oracle12c system] # systemctl status vncserver @: 1. service
Vncserver @: 1. service-Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver @: 1. service; enabled)
Active: active (running) since Mon 2016-03-28 13:14:47 CST; 14 min ago
Process: 7237 ExecStop =/bin/sh-c/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)
Process: 9030 ExecStartPre =/bin/sh-c/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)
Main PID: 9080 (Xvnc)
CGroup:/system. Server/system-vncserver.slice/vncserver @: 1. service
Listen 9080/usr/bin/Xvnc: 1-desktop oracle12c: 1 (root)-auth/root /. xauthority-geometry 1024x768-rfbwait 30000-rfbauth/root /. vnc/passwd-rfbport 5901-f...

Mar 28 13:14:47 oracle12c systemd [1]: Started Remote desktop service (VNC ).

[Root @ oracle12c system] # systemctl stop vncserver @: 1. service
[Root @ oracle12c system] # systemctl status vncserver @: 1. service
Vncserver @: 1. service-Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver @: 1. service; enabled)
Active: inactive (dead) since Mon 2016-03-28 13:31:08 CST; 12 s ago
Process: 10703 ExecStop =/bin/sh-c/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)
Process: 9080 ExecStart =/sbin/runuser-l root-c/usr/bin/vncserver: 1 (code = exited, status = 0/SUCCESS)
Process: 9030 ExecStartPre =/bin/sh-c/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)
Main PID: 9080 (code = exited, status = 0/SUCCESS)

Mar 28 13:14:47 oracle12c systemd [1]: Started Remote desktop service (VNC ).
Mar 28 13:31:08 oracle12c systemd [1]: Stopping Remote desktop service (VNC )...
Mar 28 13:31:08 oracle12c systemd [1]: Stopped Remote desktop service (VNC ).
[Root @ oracle12c system] # systemctl start vncserver @: 1. service
[Root @ oracle12c system] # systemctl status vncserver @: 1. service
Vncserver @: 1. service-Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver @: 1. service; enabled)
Active: active (running) since Mon 2016-03-28 13:31:29 CST; 7 s ago
Process: 10703 ExecStop =/bin/sh-c/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)
Process: 10733 ExecStartPre =/bin/sh-c/usr/bin/vncserver-kill: 1>/dev/null 2> & 1 |: (code = exited, status = 0/SUCCESS)
Main PID: 10783 (Xvnc)
CGroup:/system. Server/system-vncserver.slice/vncserver @: 1. service
Listen 10783/usr/bin/Xvnc: 1-desktop oracle12c: 1 (root)-auth/root /. xauthority-geometry 1024x768-rfbwait 30000-rfbauth/root /. vnc/passwd-rfbport 5901 -...

Mar 28 13:31:29 oracle12c systemd [1]: Starting Remote desktop service (VNC )...
Mar 28 13:31:29 oracle12c systemd [1]: Started Remote desktop service (VNC ).


5. Disable the firewall for Oracle Linux
The root user performs the operation.
View the Firewall Status.
[Root @ oracle12c tmp] # systemctl status firewalld
Firewalld. service-firewalld-dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld. service; enabled)
Active: active (running) since Mon 2016-03-28 14:51:40 CST; 6 s ago
Main PID: 14827 (firewalld)
CGroup:/system. slice/firewalld. service
14827/usr/bin/python-Es/usr/sbin/firewalld -- nofork -- nopid

Temporarily disable the firewall command. After the computer is restarted, the firewall automatically starts up.
[Root @ oracle12c tmp] # systemctl stop firewalld

Permanently disable firewall commands. The firewall will not start automatically after it is restarted.
[Root @ oracle12c tmp] # systemctl disable firewalld
Rm '/etc/systemd/system/basic.tar get. wants/firewalld. Service'
Rm '/etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service'

6. Use vnc viewer for remote connection

Install VNC Server in CentOS 6.5 for graphical access

VNC installation Configuration

Install and configure VNC in CentOS 6.3

In Linux, the dependency installation VNC is not detected.

CentOS6 VNC service installation and configuration

Configure and install VNC in CentOS

VNC remote control installation and Setup

Windows accesses Ubuntu through VNC

Install VNC for accessing Ubuntu 12.04 through Windows Remote Desktop

This article permanently updates the link address:

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.