【一步一步走(1)】远程桌面软件VNC的安装与配置

本文分享了在PhotonVPS上搭建Python Web环境的经验,包括选择系统、安装VNC、配置桌面服务等步骤,并提供了VNC服务器的初始化密码设置和配置文件修改指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在VPS上搭建Python Web环境,走了很多弯路,借此记下。

先说说购买的VPS(PhotonVPS),我可不是打广告,只是感觉这个VPS服务提供商还不错推荐给你大家,我之前也是体验过阿里云的,体验结果就不说了,反正不适合我。

使用系统是CentOS 64位,版本是 6.5,至于VNC的介绍,大家可以移步官网查看,下面就开始VNC的下载与配置了。 

1. 通过SSH远程连接VPS主机,Windows的小伙伴们可以下载SSH客户端进行连接。

[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. ssh [用户名]@[IP地址]  


2. 通过yum安装VNC


[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. yum install tigervnc tigervnc-server -y  

3. 安装桌面服务(VPS自带的系统一般都不会有桌面服务)

[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. yum groupinstall -y "Desktop" "X Window System"  

4. 安装完成后,执行vncserver,初始化密码

[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. [root@sunth ~]# vncserver  
  2.   
  3. You will require a password to access your desktops.  
  4.   
  5. Password:  
  6. Verify:  
  7. xauth:  creating new authority file /root/.Xauthority  
  8. xauth: (stdin):1:  bad display name "sunth.localdomain:1" in "add" command  
  9.   
  10. New 'sunth.localdomain:1 (root)' desktop is sunth.localdomain:1  
  11.   
  12. Creating default startup script /root/.vnc/xstartup  
  13. Starting applications specified in /root/.vnc/xstartup  
  14. Log file is /root/.vnc/sunth.localdomain:1.log  

5. 修改刚刚生成的文件    /root/.vnc/xstartup

[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. vi /root/.vnc/xstartup  

将文件最后一行的 twn & 更改为 gnome-session &

更改后的文件:

[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. #!/bin/sh  
  2.   
  3. [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n  
  4. export LANG  
  5. export SYSFONT  
  6. vncconfig -iconic &  
  7. unset SESSION_MANAGER  
  8. unset DBUS_SESSION_BUS_ADDRESS  
  9. OS=`uname -s`  
  10. if [ $OS = 'Linux' ]; then  
  11.   case "$WINDOWMANAGER" in  
  12.     *gnome*)  
  13.       if [ -e /etc/SuSE-release ]; then  
  14.         PATH=$PATH:/opt/gnome/bin  
  15.         export PATH  
  16.       fi  
  17.       ;;  
  18.   esac  
  19. fi  
  20. if [ -x /etc/X11/xinit/xinitrc ]; then  
  21.   exec /etc/X11/xinit/xinitrc  
  22. fi  
  23. if [ -f /etc/X11/xinit/xinitrc ]; then  
  24.   exec sh /etc/X11/xinit/xinitrc  
  25. fi  
  26. [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources  
  27. xsetroot -solid grey  
  28. xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &  
  29. gnome-session &  

6. 修改配置文件 /etc/sysconfig/vncservers

[plain]  view plain copy print ? 在CODE上查看代码片 派生到我的代码片
  1. vi /etc/sysconfig/vncservers  
  2. aibang.com/show/293725186-420492730/product/15408209.html
    aibang.com/show/293725186-420492730/product/15408237.html
    aibang.com/show/293725186-420492730/product/15408263.html
    aibang.com/show/293725186-420492730/product/15408281.html
    aibang.com/show/293725186-420492730/product/15408451.html
    aibang.com/show/293725186-420492730/product/15408537.html
    aibang.com/show/293725186-420492730/product/15408617.html
    aibang.com/show/293725186-420492730/product/15408631.html
    aibang.com/show/293725186-420492730/product/15408669.html
    aibang.com/show/293725186-420492730/product/15408699.html
    aibang.com/show/293725186-420492730/product/15408719.html
    aibang.com/show/293725186-420492730/product/15408817.html
    aibang.com/show/293725186-420492730/product/15408861.html
    aibang.com/show/293725186-420492730/product/15408907.html
    aibang.com/show/293725186-420492730/product/15408933.html
    aibang.com/show/293725186-420492730/product/15408969.html
    aibang.com/show/293725186-420492730/product/15408987.html
    aibang.com/show/293725186-420492730/product/15409009.html
    aibang.com/show/293725186-420492730/product/15409031.html
    aibang.com/show/293725186-420492730/product/15409261.html
    aibang.com/show/293725186-420492730/product/15409299.html
    aibang.com/show/293725186-420492730/product/15409323.html
    aibang.com/show/293725186-420492730/product/15409375.html
    aibang.com/show/293725186-420492730/product/15409409.html
    aibang.com/show/293725186-420492730/product/15409449.html
    aibang.com/show/293725186-420492730/product/15409483.html
    aibang.com/show/293725186-420492730/product/15409493.html
    aibang.com/show/293725186-420492730/product/15409713.html
    aibang.com/show/293725186-420492730/product/15409997.html
    aibang.com/show/293725186-420492730/product/15410017.html
    aibang.com/show/293725186-420492730/product/15410033.html
    aibang.com/show/293725186-420492730/product/15410059.html
    aibang.com/show/293725186-420492730/product/15410077.html
    aibang.com/show/293725186-420492730/product/15410097.html
    aibang.com/show/293725186-420492730/product/15410111.html
    aibang.com/show/293725186-420492730/product/15410129.html
    aibang.com/show/293725186-420492730/product/15410145.html
    aibang.com/show/293725186-420492730/product/15410165.html
    aibang.com/show/293725186-420492730/product/15410179.html
    aibang.com/show/293725186-420492730/product/15410201.html
    aibang.com/show/293725186-420492730/product/15410213.html
    aibang.com/show/293725186-420492730/product/15410243.html
    aibang.com/show/293725186-420492730/product/15410259.html
    aibang.com/show/293725186-420492730/product/15410313.html
    aibang.com/show/293725186-420492730/product/15410331.html
    aibang.com/show/293725186-420492730/product/15410341.html
    aibang.com/show/293725186-420492730/product/15410361.html
    aibang.com/show/293725186-420492730/product/15410389.html
    aibang.com/show/293725186-420492730/product/15410397.html
    aibang.com/show/293725186-420492730/product/15410415.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值