日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > centos >内容正文

centos

centos7 vnc oracle,Centos7远程桌面的安装与vnc/vnc-server的设置

發(fā)布時(shí)間:2025/3/20 centos 87 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7 vnc oracle,Centos7远程桌面的安装与vnc/vnc-server的设置 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一.安裝 GNOME-Desktop桌面環(huán)境

1、安裝 GNOME

# yum -y groups install"GNOME Desktop"

2、完成安裝后,使用如下命令啟動(dòng)桌面

# startx

首次啟動(dòng),進(jìn)行一些初始設(shè)置

選擇系統(tǒng)語言

選擇鍵盤類型

添加在線用戶(可選)

開始使用

啟動(dòng)后的桌面環(huán)境,如下所示:

二、使用GNOME Shell

CentOS 7的默認(rèn)GNOME桌面以經(jīng)典模式開始,但如果您想使用GNOME Shell,請?jiān)O(shè)置如下:

方式一:如果以?startx?命令啟動(dòng)GNOME,設(shè)置如下:

#echo"exec gnome-session">> ~/.xinitrc# startx

單擊“登錄”按鈕旁邊的按鈕。

在列表中選擇“GNOME”。(默認(rèn)為GNOME Classic模式)

GNOME shell的啟動(dòng)后,如下所示:

三、安裝 TigerVNC Server

1. 安裝TigerVNC Server

建議使用非root用戶安裝,-y代表直接安裝

sudo yum install-ytigervnc-server

2. 配置VNC Service

以下方法是新方法,以前是要配置/etc/sysconfig/vncservers,現(xiàn)在第一步是將默認(rèn)提供的文件復(fù)制到/etc/systemd/system,命令如下sudo cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

注意上述命令參數(shù)重的“@:1”,可以將數(shù)字1換成30000內(nèi)的任意數(shù)字,“5900+數(shù)字”即為程序的顯示(監(jiān)聽)端口,如”@:1″表示監(jiān)聽5901端口。

接下來修改該配置文件sudo vim /etc/systemd/system/vncserver@:1.service

將其中替換為你想要的用戶名,所有內(nèi)容如下:# The vncserver service unit file

#

# Quick HowTo:

# 1. Copy this file to /etc/systemd/system/vncserver@.service

# 2. Replace with the actual user name and edit vncserver

#? ? parameters in the wrapper script located in /usr/bin/vncserver_wrapper

# 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 %i > /dev/null 2>&1 || :'

ExecStart=/usr/bin/vncserver_wrapper root %i

ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]

WantedBy=multi-user.target

保存文件并退出vim,重新加載配置

sudo systemctl daemon-reload

也可以設(shè)置成開機(jī)啟動(dòng)

sudo systemctl enable vncserver@:1.service

3 修改防火墻

首先判斷firewalld是否啟動(dòng),輸入以下命令判斷sudo firewall-cmd --state

如果啟動(dòng)應(yīng)該輸出running

如果是not running,執(zhí)行下面命令sudo systemctl start firewalld

添加端口號(hào)5901-5905sudo firewall-cmd --permanent --zone=public --add-port=5901-5905/tcp

重新加載防火墻sudo firewall-cmd --reload

可以使用下面命令查看端口號(hào)是否被加入firewall-cmd --list-all-zones

5. 設(shè)置VNC密碼

通過ssh,用oracle用戶名登錄到服務(wù)器,執(zhí)行下面命令vncserver

終端會(huì)提示你輸入密碼,如下You will require a password to access your desktops.

Password:

Verify:

xauth:? file /home/oracle/.Xauthority does not exist

New 'localhost.localdomain:1 (oracle)' desktop is localhost.localdomain:1

Creating default startup script /home/oracle/.vnc/xstartup

Starting applications specified in /home/oracle/.vnc/xstartup

Log file is /home/oracle/.vnc/localhost.localdomain:1.log

如果想修改密碼,可以使用vncpasswd。現(xiàn)在已經(jīng)有一個(gè)vnc服務(wù)在運(yùn)行了,但我們需要使用剛剛配置的服務(wù)來啟動(dòng),所以我們需要先殺死剛剛的vnc服務(wù),使用下面命令。vncserver -kill :1

接下來,重啟我們配置的服務(wù)sudo systemctl daemon-reload

sudo systemctl restart vncserver@:1.service

使用下面命令查看該服務(wù)是否正確運(yùn)行sudo systemctl status vncserver@:1.service -l

如果正確啟動(dòng),輸出應(yīng)為● vncserver@:2.service - Remote desktop service (VNC)

Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset: disabled)

Active: active (running) since 日 2017-07-23 21:55:35 CST; 12h ago

Process: 8720 ExecStart=/usr/sbin/runuser -l oracle -c /usr/bin/vncserver %i -geometry 1280x720 (code=exited, status=0/SUCCESS)

Process: 8716 ExecStartPre=/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/vncserver@:2.service

? 8744 /usr/bin/Xvnc :2 -desktop 127.0.0.1:2 (oracle) -auth /home/oracle/.Xauthority -geometry 1280x720 -rfbwait 30000 -rfbauth /home/oracle/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn

7月 23 21:55:32 127.0.0.1 systemd[1]: Starting Remote desktop service (VNC)...

7月 23 21:55:35 127.0.0.1 systemd[1]: Started Remote desktop service (VNC).

如果想配置多用戶同時(shí)訪問,需要將上面vncserver@:1.service,改為vncserver@:2.service,然后配置其中用戶名,再按以上步驟走一遍就可以了

四、客戶端連接

服務(wù)端配置完畢,接下來用客戶端連接。

vnc是免費(fèi)技術(shù),許多客戶端都支持該協(xié)議。本文采用App Store上免費(fèi)的“Remote Desktop – VNC”軟件進(jìn)行連接,打開后軟件界面如下:

在輸入框填寫服務(wù)器地址:vnc://ip:port,其中ip是服務(wù)器的ip或域名,port是監(jiān)聽的端口,例如5901。輸入后按回車,彈出密碼輸入框,輸入vncpasswd設(shè)置的密碼。密碼正確的話就可以看到服務(wù)器的圖形桌面。

按回車鍵進(jìn)入登錄界面,輸入登錄用戶名和密碼進(jìn)入系統(tǒng)。

接下來就可以做各種圖形操作了。

總結(jié)

以上是生活随笔為你收集整理的centos7 vnc oracle,Centos7远程桌面的安装与vnc/vnc-server的设置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。