6/22/2011

Buồn buồn viết TUT chơi

Mục đích:
cài GUI cho vps chạy linux OS và remote vào GUI đó, vì mặc định buy vps linux đa phần chạy CLI thôi.

Mục tiêu: CentOS (thằng Redhat chắc cũng tương tự, còn mấy ku bên nền debian thì lệnh khác hẳn, anh em tự xử )

Âu cơ bắt đầu nhé, trước tiên download SSH client để truy xuất VPS.
Nil dùng phần mền pú ti
http://the.earth.li/~sgtatham/putty/.../x86/putty.exe

1. Cài GUI
Log vào VPS bằng acc root và cài như sau (2 dòng lệnh, nó hỏi Yes / No gì thì cứ ấn Y rồi Enter:
Code:
yum groupinstall "X Window System" "GNOME Desktop Environment"
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
2. Cài VNC Server
Code:
yum install vnc-server
3. Cấu hình VNC Server
Code:
vi /etc/sysconfig/vncservers
Lệnh trên sẽ mở file config và dùng trình soạn thảo VI để chỉnh sửa, anh em thích chơi cái NANO cũng đc, nano dễ xài hơn VI.

Xài VI (còn gọi là vim editor) sao anh em google tự xử nhé.
Mình chỉ sơ sơ cho ai ko biết thôi: dùng mấy phím mũi tên di chuyển đến chỗ muốn xóa hay thêm bớt, ấn x để xóa, ấn i rồi viết chữ vào, viết xong ấn ESC. Chỉnh sửa hết rồi thì ấn :wq để save + exit.

Sửa thành thế này:

Code:

# 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
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# 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="1:root"
VNCSERVERARGS[1]="-geometry 800x600"

4. Chạy vnc server và cấu hình linh tinh:
Run vnc server
Code:
vncserver
Nó sẽ bắt tạo pass truy cập VNC, anh em nhập pass tự chế vào

Config

Code:
vi /root/.vnc/xstartup
Sửa thành thế này (bỏ 2 dấu thăng ở đầu dòng unset và exec)

Code:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
Restart vnc server để chấp nhận
Code:
/etc/init.d/vncserver restart
Sau đó thêm mấy dòng lệnh linh tinh này vào (chức năng là gì thì google
Code:
chkconfig vncserver on
/etc/init.d/iptables stop
chkconfig iptables off
5. Remote desktop

Download cái này về:
http://www.realvnc.com/products/free/4.1/download.html

Cài xong chọn trong menu start cái này:
VNC Viewer 4 / Run Listening VNC Viewer

Nó sẽ mở 1 cái icon của realvnc ở taskbar, anh em click phải vào chọn connection, mục option chỉnh colour level thành full cho nó đẹp.

Rồi IP gõ như sau: ip:1
đợi tí nó connect thì gõ pass tự chế ở trên

lưu ý 1 đây là port anh em chỉnh ở trên đoạn 1:root, nếu ở trên anh em chỉnh số khác thì lúc remote sẽ dùng số đó


Hết tut, mong anh em ủng hộ

---------- Post added 12-10-2010 at 12:06 AM ----------

show thêm cái hình đề phòng mấy tên gian thần bẩu trẫm nói dối


SHARE THIS

Author:

Tôi là PHƯỚC kỹ sư công nghệ thông tin. chuyên thiết kế web và làm dịch vụ MMO.

0 comments: