Oracle Linux 7配置vncserver
DBA,在建立Oracle資料庫的過程中一般要使用dbca和netca影像化進行建庫和建立監聽(如果使用指令碼建庫另說),所以圖形化操作工具是必不可少的,在Linux作業系統中個人比較喜歡的圖形化操作軟體是VNC,今天剛好遇到了Oracle Linux 7的操作環境,就順手記錄一下配置過程。
1.檢查系統是否已經安裝vncserver軟體包
[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
沒有安裝執行以下命令進行安裝
[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 0:1.2.80-0.30.20130314svn5065.el7 will be installed --> Finished Dependency Resolution [Errno 14] curl#6 - "Could not resolve host: public-yum.oracle.com; Unknown error" Trying other mirror. [Errno 14] curl#6 - "Could 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 0:1.2.80-0.30.20130314svn5065.el7 Complete!
2.配置vncserver,之前的版本,如果安裝vnc一般都需要使用vncserver命令來設定口令,然後配置/etc/sysconfig/vncservers檔案。在Oracle Linux7中,雖然然還存在這個檔案,不過其內容只有如下一行:
[root@oracle12c /]# cat /etc/sysconfig/vncservers # THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service
先來看一下該檔案/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:590M hostB # # this will open a connection on port 590N of your hostA to hostB's port 590M # (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 with # the help of ssh, you end up seeing what hostB makes available on port 590M # # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. [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 <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] WantedBy=multi-user.target
從上面的可以看到如下資訊,這給出了操作步驟。1:是將該檔案複製一份到/etc/systemd/system目錄下並命名為vncserver@:.service;2:是將<USER>替換成你要開啟vncserver的使用者名稱;3:是執行systemctl daemon-reload;4:是執行systemctl enable vncserver@:.service來啟動vncserver服務。
# 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`
首先複製檔案:
[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--r--. 1 root root 1744 Mar 28 10:47 vncserver@:1.service
編輯vncserver@:1.service檔案將檔案中的用root替換
修改前的內容如下:
[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:590M hostB # # this will open a connection on port 590N of your hostA to hostB's port 590M # (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 with # the help of ssh, you end up seeing what hostB makes available on port 590M # # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. [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 <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] WantedBy=multi-user.target
修改後的內容如下:
[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:590M hostB # # this will open a connection on port 590N of your hostA to hostB's port 590M # (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 with # the help of ssh, you end up seeing what hostB makes available on port 590M # # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP. # # Use "-localhost" to prevent remote VNC clients connecting except when # doing so through a secure tunnel. See the "-via" option in the # `man vncviewer' manual page. [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [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] WantedBy=multi-user.target
這裡重點要注意的是Type的值要修改為simple,不能用原來的forking,否則會在執行systemctl start vncserver@:1.service時出現問題,故障資訊如下:
[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; 26s 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.設定遠端登陸的密碼
作業系統登陸,執行vncpasswd,注意這個密碼不一定與作業系統登陸的密碼一致,需要遠端桌面的所有的賬號,都需要設定一次。
[root@oracle12c /]# vncpasswd root Password: Verify:
4.設定vncserver 為自啟動
[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; 14min 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.slice/system-vncserver.slice/vncserver@:1.service 鈥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; 12s 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; 7s 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.slice/system-vncserver.slice/vncserver@:1.service 鈥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.關閉Oracle Linux的防火牆
root使用者執行操作
檢視防火牆狀態。
[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; 6s ago Main PID: 14827 (firewalld) CGroup: /system.slice/firewalld.service 14827 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
臨時關閉防火牆命令。重啟電腦後,防火牆自動起來。
[root@oracle12c tmp]# systemctl stop firewalld
永久關閉防火牆命令。重啟後,防火牆不會自動啟動。
[root@oracle12c tmp]# systemctl disable firewalld
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
6.使用vnc viewer進行遠端連線
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2065232/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux下vncserver的配置LinuxVNCServer
- 配置vncserverVNCServer
- [轉載] centos7 安裝和配置vncserverCentOSVNCServer
- linux下配置vncserver 防火牆 本地映象LinuxVNCServer防火牆
- Solaris 10配置VNCServerVNCServer
- centos 6.7安裝與配置vncserverCentOSVNCServer
- VNCServer 配置 及Vncview的使用(zt)VNCServerView
- CentOS 6.0下vncserver安裝配置 [轉]CentOSVNCServer
- Linux5.4下vncserver的安裝LinuxVNCServer
- vncserver使用教程,2步掌握vncserver的使用教程VNCServer
- Linux 7 配置網路卡(nmcli)Linux
- Oracle Linux 7 修改 hostnameOracleLinux
- Linux 下安裝配置 JDK7 配置環境(debian 7)LinuxJDK
- Linux CentOS 7 下 Redis 的配置LinuxCentOSRedis
- Oracle Linux 6.4配置NFSOracleLinuxNFS
- Oracle Linux 6.5配置XmanagerOracleLinux
- 針對 Oracle 配置 LinuxOracleLinux
- How to Change hostname in Oracle Linux 7OracleLinux
- Oracle Linux 7禁用Transparent HugePagesOracleLinux
- ubuntu安裝vncserver,ubuntu安裝vncserver的使用教程,教程詳解UbuntuVNCServer
- vncserver的自動啟動及vncserver桌面的自動準備VNCServer
- linux 5&6&7 本地yum配置Linux
- [Linux7] HA Package Yum源配置LinuxPackage
- Linux 7安裝和配置phpmyadminLinuxPHP
- Linux伺服器配置——安裝配置JDK1 7Linux伺服器JDK
- Oracle Linux 7 Configure DNSOracleLinuxDNS
- Oracle Linux 5 Update 7 downloadOracleLinux
- Oracle Linux 7上安裝Oracle 12cOracleLinux
- Linux CentOS 7 下 Apache Tomcat 7 安裝與配置(心得)LinuxCentOSApacheTomcat
- Linux NTP服務配置 for Oracle RACLinuxOracle
- 【Linux】Virtualbox 安裝 Oracle Linux 7 -64位LinuxOracle
- Linux-CentOS7環境MySQL安裝配置LinuxCentOSMySql
- Linux-RHEL7環境MySQL安裝配置LinuxMySql
- Linux(CentOS 7)VMWare下配置遠端登入LinuxCentOS
- 11. Oracle for Linux安裝和配置—11.3. Oracle安裝和配置—11.3.3. Oracle net配置OracleLinux
- vncserver: couldn't find "xauth" on your PATHVNCServer
- 11. Oracle for Linux安裝和配置——11.2. Linux安裝和配置——11.2.5. Linux配置OracleLinux
- Oracle 12c Grid Infrastructure for a Standalone Server on Oracle Linux 7OracleASTStructServerLinux