首先安装桌面环境,我选择的是xfce,轻量级桌面,小巧实用不占太多内存,(占用内存方面,xfce少于kde,kde少于gnome).输入下面命令安装:
yum groupinstall xfce-4.4
(xfce现在貌似已经更新到4.8了,但是使用yum groupinstall xfce-4.8没安装成功,提示没有,再等等吧)
(笔者在Burst VPS上尝试安装时,提示“没有合适的包”,遇到这种情况可以
输入:
yum grouplist
列出centos安装时的软件分组,其中Available Groups代表未安装的分组.
如果有xfce分组类似“XFCE-4.4”
可输入以下命令安装
yum groupinstall "XFCE-4.4" )
装完桌面之后就是安装vncserver了,输入下面命令安装:
yum install vnc vnc-server
桌面环境和vncserver都安装好之后,就开始配置,现在以root用户为例:
修改/etc/sysconfig/vncservers这个文件,用WINSCP在后面增加如下:
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800×600"
分辨率可更具自己的实际情况来调解,一般常用的1024×768(xp),1366×768(win7)
另外提醒注意一点,这个必须手动修改,如果直接使用vncserver启动只有,不能添加开机启动项。
如果想设置多个用户,可以用如下格式:
VNCSERVERS=”1:one 2:two 3:three”
VNCSERVERARGS[1]=”-geometry 800×600″
VNCSERVERARGS[2]=”-geometry 800×600″
VNCSERVERARGS[3]=”-geometry 800×600″
接着,就是给vncserver设置密码:
vncpasswd
输入两次即可。
启动vnc服务:
vncserver
这样在/root下就会生成一个.vnc文件夹,里面有相关配置,SSH下查看命令,在/root路径下输入
ls -a
然后杀掉vnc服务开始配置VNC
vncserver -kill :1
杀掉进程之后,修改/root/.vnc/xstartup这个文件,把里面的内容替换成如下:
#!/bin/sh
/usr/bin/startxfce4
保存以后,给xstartup加上执行权限:
chmod +x ~/.vnc/xstartup
配置完之后,再重新启动一下vncserver:
service vncserver restart
启动之后,用如下命令查看5901端口是否开启:
netstat -lptn
这里要注意,如果发现端口打开了却连不上,就要设置好防火墙规则,否则外面连不上 59xx端口.
然后设置vncserver开机自动启动,输入如下:
chkconfig vncserver on
在Windows客户端,就可以用该地址和端口连接了,连接上以后,和在终端操作是一样的。
客户端下载地址:http://www.crsky.com/soft/7365.html
在VPS安装xfce桌面和vncserver后,连接上去之后是英文的,要显示中文的话,还得安装CentOS的中文语言包,百度找到了几种方法,其中通过yum方式安装的最简单快速:
yum groupinstall "Chinese Support" fonts-chinese
装完中文语言包之后,它不会自己变成中文,得修改文件/etc/sysconfing/i18n,用WINSCP把里面的内容改成如下:
LANG="zh_CN.utf8"
SYSFONT="latarcyrheb-sun16"
然后再重启一下vncserver,连接上去显示的就是中文了:
service vncserver restart
安装firefox浏览器:
yum -y install firefox
重启VPS:
reboot
最后我们就可以开始使用VNC客户端连接了(需要注意的是默认端口为1(例 你的IP:1))!
(centos下安装firefox的方法:
yum install firefox
这样windows桌面端就能够通过vncviewer.exe来访问centos vps下的远程桌面了,提醒一点:vncviewer那里服务器地址是:IP:1)
-----------------------------------------------
centos服务器安装远程桌面
首先显示CENTOS系统已经安装的组件,和可以安装的组件:
yum grouplist
如果系统安装之初采用最小化安装,没有安装xwindow,那么先安装:
yum groupinstall "X Window System"
安装GNOME桌面环境
yum groupinstall "GNOME Desktop Environment"
安装KDE桌面环境
yum groupinstall "KDE (K Desktop Environment)"
如何卸载GNOME和KDE桌面
卸载GNOME桌面环境:
yum groupremove "GNOME Desktop Environment"
卸载KDE桌面环境:
yum groupremove "KDE (K Desktop Environment)"
(KDE和GNOME随意安装一种就行了,建议大家安装KDE)
接下来就是安装VNC来连接远程桌面了。
1.VNC需要java环境支持,先下载java并安装,下载地址:www.java.com
2.然后下载VNC本地电脑客户端,VNC客户端下载:(自己搜吧。以前的资源有朋友反映下不了)
在本地电脑安装好VNC后,下一步就是在VPS安装VNC服务端。
3.VPS安装VNC
yum -y install vnc vnc-server firefox x11-xorg
yum -y install fonts-chinese
4.配置,运行如下代码:
vncserver
第一次运行完后会提示你设置密码,需要输两遍。设好你的密码后,然后程序会建立一个.vnc的目录,一般情况下是/root/.vnc
杀掉VNC的进程并删除临时sockets:
pkill -9 vnc
rm -rf /tmp/.X1*
修改配置文件使其启动时同时开启桌面环境。
编辑/root/.vnc/xstartup,
vi /root/.vnc/xstartup
vi中按a进编辑模式
修改最后一行的twm
KDE则改成startkde
GNOME则改成gnome-session
esc退出编辑模式,输入ZZ保存后退出!(大写的ZZ啊)
然后重启下VPS,输入命令:
reboot
5.在本地用VNC客户端连接VPS远程桌面。
用PUTTY连接SSh,
输入命令:
vncserver
出现:
New ‘sishixiong:2 (root)’ desktop is sishixiong:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/sishixiong:2.log
说明VNC正常启动。注意:上面的“sishixiong”是我的VPS名,你的可能不同,另外注意“sishixiong”后面的数字:2
如果你只运行一次“vncserver”应该就是1,第二次就是2,这是连接VNC的端口号。要注意记下。
下面就是连接VPS的远程桌面了。如图所示:
点击确定,然后输入你设置好的VNC密码就OK啦!
一般的VPS建议安装CentOS系统,然后安装KDE桌面,个人认为KDE比较好用些。安装好KDE后,是默认带火狐浏览器的,用火狐默认的下载工具下载文件就行了。
接下来安装中文包:
yum -y install fonts-chinese
wget ftp://ftp.muug.mb.ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-chinese-3.02-12.el5.noarch.rpm
wget ftp://ftp.muug.mb.ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm
下载后,在命令行安装:
#rpm -ivh XXXX ( XXXX 代表上面那两个包的全名, rpm 不会不知道怎么用吧?)
CentOS系统安装完成后,重新启动即可。
在 ssh , telnet 终端中文显示乱码解决办法( CentOS 5.3 )
#vi /etc/sysconfig/i18n
将原内容
LANG="en_US.UTF-8"
修改为
LANG="zh_CN.UTF-8"
接下来安装输入法就简单了.
#yum -y install scim*
用Ctrl+Space就可以调出输入法
注销一下系统,好了,这样你就可以在Linux世界里尽情的体验中文了.
-------------------------------------------------------------------------
CentOS下安装KDE/GNOME+VNC实现远程桌面
人们更愿意通过像Windows下的远程桌面这样的图形远程程序来管理服务器,然而Linux下并不存在这样一个程序。
办法肯定是有的,有一个叫VNC的软件,可以实现远程图形管理!
下面就来告诉你怎么安装KDE或gnome桌面环境和VNC!你只需在ssh上运行如下代码即可!
注:VNC需要256M以上内存!
1.安装KDE
yum install kdepim
或安装Gnome(256M以上内存可两个都安装)
yum groupinstall gnome-desktop
yum install gnome-session
内存大的建议用GNOME!
再运行:
yum groupinstall "X Window System" "GNOME Desktop Environment" "KDE (K Desktop Environment)"
2.安装VNC
yum -y install vnc vnc-server firefox x11-xorg
yum -y install fonts-chinese
3.配置,运行如下代码:
vncserver
运行完后会提示你设置密码,需要输两遍。设好你的密码后,然后程序会建立一个.vnc的目录,一般情况下是/root/.vnc
杀掉VNC的进程并删除临时sockets:
pkill -9 vnc
rm -rf /tmp/.X1*
编辑/root/.vnc/xstartup:
nano /root/.vnc/xstartup
在最后一行将twm KDE则改成startkde,
GNOME则改成gnome-session
4.重新开启vncserver:
vncserver
------------------------------------------------------------------
使用vnc viewer连接vnc server失败的解决办法
在使用vncviewer连接vmware中的red hat linux server时,提示如下错误:
连接失败:套接字操作尝试一个无法连接的主机。(10065)
问题在于配置redhat的vncserver时,没有将默认的端口号5900+n添加到防火墙中。在使用vncviewer尝试连接vncserver时,被防火墙屏蔽掉了。可以尝试如下方法:
vi /etc/sysconfig/iptables
找到下面的语句:
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
在此行之前,加上下面的内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT
然后重启iptables服务:
/etc/init.d/iptables restart
即可。
--------------------------------------------------------------------------------
How To: Install and Configure a GUI on your Linux VPS
This seems to be a topic that appears often on the VPS forum, so I thought I would get around to posting a simple instruction set for getting a GUI (GNOME or KDE) working on your VPS.
These instructions are aimed towards the Fedora distribution, but should work fine with CentOS or any other Linux distro (except maybe RHEL, which has some extra steps):
Firstly, make sure that you have YUM installed, if not, you have to go find the RPM for YUM via google or rpmfind.net, and do an "rpm -Uvh <file.rpm>" once you get it. YUM works off python, so it's not a binary just a bunch of scripts (so arch. doesnt matter).
Now that YUM and its required libraries are installed (python, sqlite, etc) execute as root on your VPS command line:
"yum -y groupinstall kde" for KDE or "yum -y groupinstall gnome" for GNOME.
and then:
"yum -y install vnc vnc-server firefox x11-xorg" to install the remaining neccessary applications (VNC, FireFox, X11 libraries, etc).
If your on OpenVZ you might have to: "yum -y remove dummy-selinux-vz" or "yum -y remove vzdummyfc4" first. Oh, also make sure that you have "gpgcheck" disabled in /etc/yum.repos.d/fedora.repo, otherwise the KDE installation will fail. KDE is by far the easiest to install, but if you want GNOME you'll have to do some other advanced tricks after the "yum -y groupinstall gnome" step.
Start up VNC server like so: vncserver
This will ask you for a password, and then create your ~/.vnc directory (if running as root, it will be in /.vnc or /root/.vnc or /home/root/.vnc). It is advisable to start up VNC/your GUI as a non-root user, but hey it's your VPS .
Running 'vncserver' will also start up VNC Server and create some temp sockets.
Now, you'll see VNC server is running by executing: "ps -ef |grep vncserver" -- good. Now kill the VNC process like so: "pkill -9 vnc" and then delete the temp sockets by: "rm -rf /tmp/.X1*" -- be careful when running rm -rf as root, you could have a typo and do rm -rf / by accident and destroy your VPS!
At this point you have to go into the /.vnc directory, edit the xstartup file and delete the last line (usually has twm & or something), and replace it with: "startkde &" (without the quotes) -- this tells VNC to startup KDE instead of the default window manager, twm (or whatever the last line was).
Your pretty much done at this point, go ahead and execute the command 'vncserver' again, and VNC will startup, using the password specified earlier and create a default VNC instance on VNC port 1.
Give it a few minutes, depending on your VPS specs, to let KDE start up for the first time. Start up your RealVNC client on your PC, and put in <youripaddress>:1, and it should ask for your password that you put in earlier. If you dont see the KDE desktop, check your xstartup file again in /.vnc and make sure the last line is 'startkde &'.
You can automate the entire process just by stringing along all of the commands in a simple script. This should get you up and running with a nice GUI for your Linux VPS. Keep in mind you need at least 256 MB of guaranteed RAM, do not rely on your "burstable" rate because having a GUI running WILL cause processes/services inside your VPS to be killed because of a lack of memory. If your running a control panel such as cPanel or Plesk on the same VPS, make sure you have at least 512 MB of guaranteed RAM.
yum groupinstall xfce-4.4
(xfce现在貌似已经更新到4.8了,但是使用yum groupinstall xfce-4.8没安装成功,提示没有,再等等吧)
(笔者在Burst VPS上尝试安装时,提示“没有合适的包”,遇到这种情况可以
输入:
yum grouplist
列出centos安装时的软件分组,其中Available Groups代表未安装的分组.
如果有xfce分组类似“XFCE-4.4”
可输入以下命令安装
yum groupinstall "XFCE-4.4" )
装完桌面之后就是安装vncserver了,输入下面命令安装:
yum install vnc vnc-server
桌面环境和vncserver都安装好之后,就开始配置,现在以root用户为例:
修改/etc/sysconfig/vncservers这个文件,用WINSCP在后面增加如下:
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800×600"
分辨率可更具自己的实际情况来调解,一般常用的1024×768(xp),1366×768(win7)
另外提醒注意一点,这个必须手动修改,如果直接使用vncserver启动只有,不能添加开机启动项。
如果想设置多个用户,可以用如下格式:
VNCSERVERS=”1:one 2:two 3:three”
VNCSERVERARGS[1]=”-geometry 800×600″
VNCSERVERARGS[2]=”-geometry 800×600″
VNCSERVERARGS[3]=”-geometry 800×600″
接着,就是给vncserver设置密码:
vncpasswd
输入两次即可。
启动vnc服务:
vncserver
这样在/root下就会生成一个.vnc文件夹,里面有相关配置,SSH下查看命令,在/root路径下输入
ls -a
然后杀掉vnc服务开始配置VNC
vncserver -kill :1
杀掉进程之后,修改/root/.vnc/xstartup这个文件,把里面的内容替换成如下:
#!/bin/sh
/usr/bin/startxfce4
保存以后,给xstartup加上执行权限:
chmod +x ~/.vnc/xstartup
配置完之后,再重新启动一下vncserver:
service vncserver restart
启动之后,用如下命令查看5901端口是否开启:
netstat -lptn
这里要注意,如果发现端口打开了却连不上,就要设置好防火墙规则,否则外面连不上 59xx端口.
然后设置vncserver开机自动启动,输入如下:
chkconfig vncserver on
在Windows客户端,就可以用该地址和端口连接了,连接上以后,和在终端操作是一样的。
客户端下载地址:http://www.crsky.com/soft/7365.html
在VPS安装xfce桌面和vncserver后,连接上去之后是英文的,要显示中文的话,还得安装CentOS的中文语言包,百度找到了几种方法,其中通过yum方式安装的最简单快速:
yum groupinstall "Chinese Support" fonts-chinese
装完中文语言包之后,它不会自己变成中文,得修改文件/etc/sysconfing/i18n,用WINSCP把里面的内容改成如下:
LANG="zh_CN.utf8"
SYSFONT="latarcyrheb-sun16"
然后再重启一下vncserver,连接上去显示的就是中文了:
service vncserver restart
安装firefox浏览器:
yum -y install firefox
重启VPS:
reboot
最后我们就可以开始使用VNC客户端连接了(需要注意的是默认端口为1(例 你的IP:1))!
(Linux中的远程连接 SSH and VNC图形模式
1、VNC的启动/停止/重启
#service vncserver start/stop/restart
关闭具体的vncserver命令:vncserver -kill :1 vncserver -kill :2
2、设置密码
#vncpasswd
3、客户端登陆
在vnc客户端中输入:服务器端IP:1或服务器端IP:2
4、设置登陆到KDE桌面
a.
[root@centos ~]# vi /etc/sysconfig/vncservers
#
# Uncomment the line below to start a VNC server on display :1
# 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:>.[url]http://www.uk.research.att.com/vnc/sshvnc.html[/url]
#
# Uncomment the line below to start a VNC server on display :1
# 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:>.[url]http://www.uk.research.att.com/vnc/sshvnc.html[/url]
# VNCSERVERS="1:myusername"
VNCSERVERS="1:root"
VNCSERVERS="1:root"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[1]="-geometry 800*600 -alwaysshared -depth 24"
VNCSERVERARGS[1]="-geometry 800*600 -alwaysshared -depth 24"
-alwaysshared代表允许多用户同时登录 -depth代为色深,参数有8,16,24,32。
注:红色部分就是被修改或增加的部分
b.
[root@centos .vnc]$ vi /root/.vnc/xstartup
#!/bin/sh
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
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" &
#gnome-session & #set starting GNOME desktop
startkde & #kde desktop
#twm & #Text interface
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#gnome-session & #set starting GNOME desktop
startkde & #kde desktop
#twm & #Text interface
注:红色部分就是被修改或增加的部分
c.
重启VNC即可。
参考:
我们知道在windows下面我们可以用远程桌面连接来控制其它电脑, 但在linux环境下又怎么样来连接呢? 不过在说怎样连接之前还是要先明确一个概念,为什么我标题没有用linux中的远程桌面连接呢, 这是因为Linux下面的桌面,也就是我们所说的X Window ,只是linux下的一个应用程序而已, 所以linux中的远程连接就分为shell和X 桌面连接两种。 先说说通过SSH(Secure Shell)连接到linux下的shell,如果的操作平台是windows下, 你可以下载SSH客户端工具连接到linux,比如最常用的PuTTY,你可以去这里下载: [url]http://www.chiark.greenend.org.uk/~sgtatham/putty/[/url] 运行后,如图所示 输入你linux主机的IP,默认端口为22,然后点击Open, 就会出现登录界面,输入用户名和密码:: 登录过程就算完成了。 如果你客户端也用的linux呢,那更方便了,直接输入: ssh -l username [address of the remote host]连接, 第一次连接时会让你确认,输入yes,然后再输入口令就行了。 其实通过ssh连接,我们已经完全可以远程管理主机了, 不过有时候也需要在X Window下做一些事, 接下来就是说说怎么样远程连接到linux的桌面。 通常我们用配置XDM(X Display Manager)和VNC来远程连接, 这里我要说的是用vnc来实行远程连接。 提起VNC大家肯定不要陌生,它是一个踌平台的远程控制软件, 有linux上装好它的服务器端,我们就可以通过客户端来进行连接了。 安装就不多说了,完成后在提示符下输入: vncserver 就算是启动了,注意后面的数字1,以后连接的时候要用到 这样vnc服务器就启动了,如果你第一次运行vncserver,会要求你输入访问密码。 如果你是在windows平台下连接linux,那直接安装vnc的的客户端就行了, 也就是安装vncviewer,安装完成后启动: 输入IP加上标识号,如前面启动vnc服务是1,那这里就填1,依此类推。点击确定: 输入访问密码,回车: 连接成功。 如果你操作平台是linux,那么在提示符下输入: vncviewer IP : x (x为标识符),就可以进行连接了。 还有种情况,如果是linux主机连接windows,除了用vnc外, 在linux中有个类似于windows中的远程桌面的工具包,那就是Rdesktop,在提示符下输入: rdesktop ip 就可以了。另外你还以在gnome的工具菜单里启动: 输入IP,用户名和密码,如果没有域,就留空,然后连接,就和XP桌面一样,真是很方便 ,顺便提醒一句,如果你要连接的linux主机位于局域网内,可别忘了做端口映射,如果用SSH就映射22到主机,如果是用VNC连接,就要根据你的标识 了,比如本例中的1,就映射端口5901,依此类推。 from http://blog.csdn.net/fangaoxin/article/details/6340844) (在CentOS下安装配置VNC的过程 1. 检查vnc客户端和服务器是否已经安装: [gavin@centos ~]$ rpm -q vnc vnc-server package vnc is not installed vnc-server-4.0-8.1 cent os 5已包含vnc的安装包 2. 将用户名称加入到配置文件: (注:这里的“用户名”是指linux系统用户的名称) [gavin@centos ~]# vi /etc/sysconfig/vncservers # # Uncomment the line below to start a VNC server on display :1 # 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 # http://www.uk.research.att.com/vnc/sshvnc.html>. # VNCSERVERS="1:myusername" # VNCSERVERS="1:gavin 2:john" # use the method for more user VNCSERVERS="1:gavin 2:root 3:root" # VNCSERVERARGS[1]="-geometry 800x600" VNCSERVERARGS[1]="-geometry 1024x768" 3. 设置用户gavin的密码 [gavin@centos ~]$ vncpasswd Password: Verify: 4. 启动VNC服务 [gavin@centos ~]# /sbin/service vncserver start Starting VNC server: 1:gavin [ OK ] 5. 输入命令 [gavin@centos ~]$ cd ~/.vnc/ [gavin@centos .vnc]$ vi xstartup #!/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" & gnome-session & #set starting GNOME desktop #startkde & #kde desktop #twm & #Text interface 6. 重启vncserver [gavin@centos ~]# /sbin/service vncserver restart Shutting down VNC server: 1:gavin [ OK ] Starting VNC server: 1:gavin [ OK ] 7. Windows登陆到VNC Server (1).从IE登录 直接从IE浏览器中输入如下地址: http://xxx.xxx.xxx.xxx:5802 输入密码即可使用。 (2).从VNC view登录 在windows上安装vnc view,然后输入xxx.xxx.xxx.xxx:2,连接登录,输入密码即可。 备注:如果从vnc view登录时,提示connection refused(10061),则是因为linux防火墙的问题,登录centos系统,选择System-->Preferences-->Remote Desktop,勾选sharing中的两项,Security两项不勾,点击关闭,然后再重新用vnc view登录即可。 from http://2526575.blog.51cto.com/2516575/703806) |
(centos下安装firefox的方法:
yum install firefox
这样windows桌面端就能够通过vncviewer.exe来访问centos vps下的远程桌面了,提醒一点:vncviewer那里服务器地址是:IP:1)
-----------------------------------------------
centos服务器安装远程桌面
首先显示CENTOS系统已经安装的组件,和可以安装的组件:
yum grouplist
如果系统安装之初采用最小化安装,没有安装xwindow,那么先安装:
yum groupinstall "X Window System"
安装GNOME桌面环境
yum groupinstall "GNOME Desktop Environment"
安装KDE桌面环境
yum groupinstall "KDE (K Desktop Environment)"
如何卸载GNOME和KDE桌面
卸载GNOME桌面环境:
yum groupremove "GNOME Desktop Environment"
卸载KDE桌面环境:
yum groupremove "KDE (K Desktop Environment)"
(KDE和GNOME随意安装一种就行了,建议大家安装KDE)
接下来就是安装VNC来连接远程桌面了。
1.VNC需要java环境支持,先下载java并安装,下载地址:www.java.com
2.然后下载VNC本地电脑客户端,VNC客户端下载:(自己搜吧。以前的资源有朋友反映下不了)
在本地电脑安装好VNC后,下一步就是在VPS安装VNC服务端。
3.VPS安装VNC
yum -y install vnc vnc-server firefox x11-xorg
yum -y install fonts-chinese
4.配置,运行如下代码:
vncserver
第一次运行完后会提示你设置密码,需要输两遍。设好你的密码后,然后程序会建立一个.vnc的目录,一般情况下是/root/.vnc
杀掉VNC的进程并删除临时sockets:
pkill -9 vnc
rm -rf /tmp/.X1*
修改配置文件使其启动时同时开启桌面环境。
编辑/root/.vnc/xstartup,
vi /root/.vnc/xstartup
vi中按a进编辑模式
修改最后一行的twm
KDE则改成startkde
GNOME则改成gnome-session
esc退出编辑模式,输入ZZ保存后退出!(大写的ZZ啊)
然后重启下VPS,输入命令:
reboot
5.在本地用VNC客户端连接VPS远程桌面。
用PUTTY连接SSh,
输入命令:
vncserver
出现:
New ‘sishixiong:2 (root)’ desktop is sishixiong:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/sishixiong:2.log
说明VNC正常启动。注意:上面的“sishixiong”是我的VPS名,你的可能不同,另外注意“sishixiong”后面的数字:2
如果你只运行一次“vncserver”应该就是1,第二次就是2,这是连接VNC的端口号。要注意记下。
下面就是连接VPS的远程桌面了。如图所示:
点击确定,然后输入你设置好的VNC密码就OK啦!
一般的VPS建议安装CentOS系统,然后安装KDE桌面,个人认为KDE比较好用些。安装好KDE后,是默认带火狐浏览器的,用火狐默认的下载工具下载文件就行了。
接下来安装中文包:
yum -y install fonts-chinese
wget ftp://ftp.muug.mb.ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-chinese-3.02-12.el5.noarch.rpm
wget ftp://ftp.muug.mb.ca/mirror/centos/5.4/os/x86_64/CentOS/fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm
下载后,在命令行安装:
#rpm -ivh XXXX ( XXXX 代表上面那两个包的全名, rpm 不会不知道怎么用吧?)
CentOS系统安装完成后,重新启动即可。
在 ssh , telnet 终端中文显示乱码解决办法( CentOS 5.3 )
#vi /etc/sysconfig/i18n
将原内容
LANG="en_US.UTF-8"
修改为
LANG="zh_CN.UTF-8"
接下来安装输入法就简单了.
#yum -y install scim*
用Ctrl+Space就可以调出输入法
注销一下系统,好了,这样你就可以在Linux世界里尽情的体验中文了.
-------------------------------------------------------------------------
CentOS下安装KDE/GNOME+VNC实现远程桌面
人们更愿意通过像Windows下的远程桌面这样的图形远程程序来管理服务器,然而Linux下并不存在这样一个程序。
办法肯定是有的,有一个叫VNC的软件,可以实现远程图形管理!
下面就来告诉你怎么安装KDE或gnome桌面环境和VNC!你只需在ssh上运行如下代码即可!
注:VNC需要256M以上内存!
1.安装KDE
yum install kdepim
或安装Gnome(256M以上内存可两个都安装)
yum groupinstall gnome-desktop
yum install gnome-session
内存大的建议用GNOME!
再运行:
yum groupinstall "X Window System" "GNOME Desktop Environment" "KDE (K Desktop Environment)"
2.安装VNC
yum -y install vnc vnc-server firefox x11-xorg
yum -y install fonts-chinese
3.配置,运行如下代码:
vncserver
运行完后会提示你设置密码,需要输两遍。设好你的密码后,然后程序会建立一个.vnc的目录,一般情况下是/root/.vnc
杀掉VNC的进程并删除临时sockets:
pkill -9 vnc
rm -rf /tmp/.X1*
编辑/root/.vnc/xstartup:
nano /root/.vnc/xstartup
在最后一行将twm KDE则改成startkde,
GNOME则改成gnome-session
4.重新开启vncserver:
vncserver
------------------------------------------------------------------
使用vnc viewer连接vnc server失败的解决办法
在使用vncviewer连接vmware中的red hat linux server时,提示如下错误:
连接失败:套接字操作尝试一个无法连接的主机。(10065)
问题在于配置redhat的vncserver时,没有将默认的端口号5900+n添加到防火墙中。在使用vncviewer尝试连接vncserver时,被防火墙屏蔽掉了。可以尝试如下方法:
vi /etc/sysconfig/iptables
找到下面的语句:
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
在此行之前,加上下面的内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5903 -j ACCEPT
然后重启iptables服务:
/etc/init.d/iptables restart
即可。
--------------------------------------------------------------------------------
How To: Install and Configure a GUI on your Linux VPS
This seems to be a topic that appears often on the VPS forum, so I thought I would get around to posting a simple instruction set for getting a GUI (GNOME or KDE) working on your VPS.
These instructions are aimed towards the Fedora distribution, but should work fine with CentOS or any other Linux distro (except maybe RHEL, which has some extra steps):
Firstly, make sure that you have YUM installed, if not, you have to go find the RPM for YUM via google or rpmfind.net, and do an "rpm -Uvh <file.rpm>" once you get it. YUM works off python, so it's not a binary just a bunch of scripts (so arch. doesnt matter).
Now that YUM and its required libraries are installed (python, sqlite, etc) execute as root on your VPS command line:
"yum -y groupinstall kde" for KDE or "yum -y groupinstall gnome" for GNOME.
and then:
"yum -y install vnc vnc-server firefox x11-xorg" to install the remaining neccessary applications (VNC, FireFox, X11 libraries, etc).
If your on OpenVZ you might have to: "yum -y remove dummy-selinux-vz" or "yum -y remove vzdummyfc4" first. Oh, also make sure that you have "gpgcheck" disabled in /etc/yum.repos.d/fedora.repo, otherwise the KDE installation will fail. KDE is by far the easiest to install, but if you want GNOME you'll have to do some other advanced tricks after the "yum -y groupinstall gnome" step.
Start up VNC server like so: vncserver
This will ask you for a password, and then create your ~/.vnc directory (if running as root, it will be in /.vnc or /root/.vnc or /home/root/.vnc). It is advisable to start up VNC/your GUI as a non-root user, but hey it's your VPS .
Running 'vncserver' will also start up VNC Server and create some temp sockets.
Now, you'll see VNC server is running by executing: "ps -ef |grep vncserver" -- good. Now kill the VNC process like so: "pkill -9 vnc" and then delete the temp sockets by: "rm -rf /tmp/.X1*" -- be careful when running rm -rf as root, you could have a typo and do rm -rf / by accident and destroy your VPS!
At this point you have to go into the /.vnc directory, edit the xstartup file and delete the last line (usually has twm & or something), and replace it with: "startkde &" (without the quotes) -- this tells VNC to startup KDE instead of the default window manager, twm (or whatever the last line was).
Your pretty much done at this point, go ahead and execute the command 'vncserver' again, and VNC will startup, using the password specified earlier and create a default VNC instance on VNC port 1.
Give it a few minutes, depending on your VPS specs, to let KDE start up for the first time. Start up your RealVNC client on your PC, and put in <youripaddress>:1, and it should ask for your password that you put in earlier. If you dont see the KDE desktop, check your xstartup file again in /.vnc and make sure the last line is 'startkde &'.
You can automate the entire process just by stringing along all of the commands in a simple script. This should get you up and running with a nice GUI for your Linux VPS. Keep in mind you need at least 256 MB of guaranteed RAM, do not rely on your "burstable" rate because having a GUI running WILL cause processes/services inside your VPS to be killed because of a lack of memory. If your running a control panel such as cPanel or Plesk on the same VPS, make sure you have at least 512 MB of guaranteed RAM.
No comments:
Post a Comment