Linux 컴퓨터에 브라우저로 원격 액세스
여기서 소개하는 것 외에도 다음 방법을 생각할 수 있습니다.
Linux 컴퓨터의 데스크톱 화면에 원격으로 액세스하고 싶습니다.
동기 부여
1. 설치
다음 두 개의 패키지 설치
tigervnc-server
tigervnc-server-applet
CentOS DVD 첫 번째 마운트 및
tigervnc-server
설치# yum --disablerepo=\* --enablerepo=centos-dvd -y install tigervnc-server
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-5.el6_4.1 will be installed
--> Processing Dependency: xorg-x11-fonts-misc for package: tigervnc-server-1.1.0-5.el6_4.1.x86_64
--> Running transaction check
---> Package xorg-x11-fonts-misc.noarch 0:7.2-9.1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================
Package Arch Version Repository Size
============================================================================================================
Installing:
tigervnc-server x86_64 1.1.0-5.el6_4.1 centos-dvd 1.1 M
Installing for dependencies:
xorg-x11-fonts-misc noarch 7.2-9.1.el6 centos-dvd 5.8 M
Transaction Summary
============================================================================================================
Install 2 Package(s)
Total download size: 6.9 M
Installed size: 9.7 M
Downloading Packages:
------------------------------------------------------------------------------------------------------------
Total 227 MB/s | 6.9 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : xorg-x11-fonts-misc-7.2-9.1.el6.noarch 1/2
Installing : tigervnc-server-1.1.0-5.el6_4.1.x86_64 2/2
Verifying : xorg-x11-fonts-misc-7.2-9.1.el6.noarch 1/2
Verifying : tigervnc-server-1.1.0-5.el6_4.1.x86_64 2/2
Installed:
tigervnc-server.x86_64 0:1.1.0-5.el6_4.1
Dependency Installed:
xorg-x11-fonts-misc.noarch 0:7.2-9.1.el6
Complete!
tigervnc-server-applet
# yum --disablerepo=\* --enablerepo=centos-dvd -y install tigervnc-server-applet
Loaded plugins: fastestmirror, priorities, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server-applet.noarch 0:1.1.0-5.el6_4.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================
Package Arch Version Repository Size
============================================================================================================
Installing:
tigervnc-server-applet noarch 1.1.0-5.el6_4.1 centos-dvd 106 k
Transaction Summary
============================================================================================================
Install 1 Package(s)
Total download size: 106 k
Installed size: 114 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tigervnc-server-applet-1.1.0-5.el6_4.1.noarch 1/1
Verifying : tigervnc-server-applet-1.1.0-5.el6_4.1.noarch 1/1
Installed:
tigervnc-server-applet.noarch 0:1.1.0-5.el6_4.1
Complete!
2. VNC 설정
2.1 VNC 액세스용 사용자 생성
# grep ^admin /etc/group
# groupadd -g 20001 admin
# grep ^admin /etc/group
admin:x:20001:vagrant
vncuser
를 만들고 admin 그룹에 속합니다.# groupadd -g 20002 vncuser
# useradd -u 20002 -g 20002 vncuser
# gpasswd -a vncuser admin
# grep ^admin /etc/group
admin:x:20001:vagrant,vncuser
# id vncuser
uid=20002(vncuser) gid=20002(vncuser) 所属グループ=20002(vncuser),20001(admin)
# passwd vncuser
ユーザー vncuser のパスワードを変更。
新しいパスワード:
新しいパスワードを再入力してください:
passwd: 全ての認証トークンが正しく更新できました。
# su - vncuser
$ vncpasswd
Password:
Verify:
2.2 VNC 설정
/etc/sysconfig/vncservers
말미에 이하 2행을 추기한다VNCSERVERS="1:vncuser"
는 <ディスプレイ番号>:<アクセスするユーザ>
를 지정한다 VNCSERVERARGS[1]="-geometry 800x600"
는 -geometry <画面解像度>
를 지정한다 /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see this URL:
# http://kbase.redhat.com/faq/docs/DOC-7028
# 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.
# VNCSERVERS="2:myusername"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="1:vncuser"
VNCSERVERARGS[1]="-geometry 1024x768"
/etc/sysconfig/vncservers
VNCSERVERS="1:vncuser 2:root"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 800x600"
2.3 시작 스크립트 수정
# /etc/rc.d/init.d/vncserver start
VNC サーバー を起動中: 1:vncuser
New 'centos65.example.com:1 (vncuser)' desktop is centos65.example.com:1
Starting applications specified in /home/vncuser/.vnc/xstartup
Log file is /home/vncuser/.vnc/centos65.example.com:1.log
[ OK ]
xauth: (stdin):1: bad display name "centos65.example.com:1" in "add" command
xstartup
수정 /home/vncuser/.vnc/xstartup
#!/bin/sh
[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
case "$WINDOWMANAGER" in
*gnome*)
if [ -e /etc/SuSE-release ]; then
PATH=$PATH:/opt/gnome/bin
export PATH
fi
;;
esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & ← コメントアウト
#twm & ← コメントアウト
gnome-session & ← 追記
# /etc/rc.d/init.d/vncserver restart
VNC サーバー を停止中: 1:vncuser [ OK ]
VNC サーバー を起動中: 1:vncuser
New 'centos65.example.com:1 (vncuser)' desktop is centos65.example.com:1
Starting applications specified in /home/vncuser/.vnc/xstartup
Log file is /home/vncuser/.vnc/centos65.example.com:1.log
[ OK ]
# chkconfig vncserver on
# chkconfig --list vncserver
vncserver 0:off 1:off 2:on 3:on 4:on 5:on 6:off
3. 동작 확인
3.1 VNC 서버 시작 상태 확인
5800+<ディスプレイ番号>
, 5900+<ディスプレイ番号>
# netstat -lntp | egrep ":590|:580"
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 3305/Xvnc
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN 3305/Xvnc
3.2 Java 예외 사이트 설정
http://<LinuxゲストIPアドレス>:5801
추가 http://<LinuxゲストIPアドレス>:5801
를 지정하여 액세스 Reference
이 문제에 관하여(Linux 컴퓨터에 브라우저로 원격 액세스), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/mashumashu/items/6ab7579efa5c29e2a0dd텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)