Step 1: 安裝vncserver和其依賴的軟體 # 修改yum為國內鏡像 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup-linux && \ wget -O /etc/yum.repo ...
Step 1: 安裝vncserver和其依賴的軟體
# 修改yum為國內鏡像 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup-linux && \ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \ yum clean all && \ yum makecache # 安裝依賴軟體 yum install -y compat-libstdc++* && \ yum install -y binutils* && \ yum install -y compat-libstdc* && \ yum install -y elfutils-libelf* && \ yum install -y gcc* && \ yum install -y glibc* && \ yum install -y ksh* && \ yum install -y libaio* && \ yum install -y libgcc* && \ yum install -y libstdc* && \ yum install -y make* && \ yum install -y sysstat* && \ yum install -y libXp* && \ yum install -y glibc-kernheaders # yum rpm -q --queryformat %-{name}-%{version}-%{release}-%{arch}"\n" \ compat-libstdc++-33 glibc-kernheaders glibc-headers libaio libgcc glibc-devel xorg-x11-deprecated-libs # 輸出無法下載和安裝的軟體,清單如下: # package compat-libstdc++-33 is not installed # package glibc-kernheaders is not installed # package glibc-headers is not installed # libaio-0.3.109-13.el7-x86_64 # libgcc-4.8.5-16.el7-x86_64 # package glibc-devel is not installed # package xorg-x11-deprecated-libs is not installed # 遇到部分無法在aliyun下載的軟體,則需要重新替換yum.repo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup-aliyun && \ cp /etc/yum.repos.d/CentOS-Base.repo.backup-linux /etc/yum.repos.d/CentOS-Base.repo && \ yum clean all && \ yum makecache && \ yum install -y compat-libstdc++* && \ # 安裝包找不到 yum install -y glibc-kernheaders* && \ yum install -y glibc-headers* && \ yum install -y libaio* && \ yum install -y libgcc* && \ yum install -y glibc-devel* && \ # 安裝包找不到 yum install -y xorg-x11-deprecated-libs* && \ # 查看VNC啟動失敗的日誌, cat ./.vnc/CNT7XORACLED01:1.log # xrdb: No such file or directory # xrdb: can't open file '/root/.Xresources' # xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1' # 根據日誌錯誤信息,安裝插件或創建目錄 touch ~/.Xresources && \ yum install -y xterm && \ yum install -y gnome-session # 如果日誌提示錯誤:xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1' # 則編輯文件,添加如下兩行內容 vi ~/.Xresources xterm*faceName:AR PL Uming CN xterm*faceSize:12 # 然後,重新啟動vncserver # 關閉vncserver , vncserver這裡是"Xvnc :1",見下麵查詢結果所得:1 # 詳情使用ps -ef | grep vncserver查看 # [root@CNT7XORACLED01 ~]# ps -ef | grep vnc # root 1608 1 0 10:20 pts/1 00:00:00 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop CNT7XORACLED01:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5901 -rfbwait 30000 # 關閉vncserver vncserver -kill :1 vncserver :1 # 然後,執行如下命令 export DISPLAY=localhost:1 xhost + # 出現如下輸出,才是成功啟動了Linux的遠程連接的圖形化界面
Step 2:客戶端連接linux伺服器
創建vnc客戶端連接如下:{linux_ip}:{vncserver進程的參數 Xvnc :1}
執行鏈接,彈出視窗如下: