sudo apt-get install xrdp
安装vnc4server
sudo apt-get install vnc4server
安装xubuntu-desktop
sudo apt-get install xubuntu-desktop
向xsession中写入xfce4-session(每个用户自己运行此行)
echo "xfce4-session" >~/.xsession
开启xrdp服务
sudo service xrdp restart
查看ip地址
其实你能连接至服务器,应该就知道IP地址了。
现在你已经设置好你的 Xrdp 服务器,是时候打开你的 Xrdp 客户端并且连接到服务器。
如果你有一台 Windows 电脑,你可以使用默认的 RDP 客户端。在 Windows 搜索栏输入“remote”,并且点击“Remote Desktop Connection”或者使用“win+R”组合键,然后输入mstsc。
这里可以选root 也可以选普通用户,我选的普通用户
如果报错Error connecting to sesman: 127.0.0.1 port: 3350
则安装xorgxrdp
体验优化
In the [globals] section, change max_bpp=24 and add the command to use compression as so:
max_bpp=128
use_compression=yes
and modify the [xrdp7] section by changing xserver_bpp=24:
xserverbpp=128
服务器本地 无法使用鼠标键盘
sudo apt install xserver-xorg-input-all
再重启
teamviewer
sudo apt-get -f install
4.停止服务。执行命令 sudo teamviewer --daemon stop
5.(此步骤可以不要,可以省去)修改配置文件。 在文件/opt/teamviewer/config/global.conf末尾增加以下内容(由于只读限制,所以可能需要用到管理员权限)
[int32] EulaAccepted = 1
[int32] EulaAcceptedRevision = 6
6.重新启动服务 sudo teamviewer --daemon start
7.获取id并设置密码 teamviewer --info print id
8.另外,通过以下命令设置登录密码 sudo teamviewer --passwd [NEWPASSWORD]
9.设置完密码后,需要重新启动服务,才可以看到id,不然是见不到Id的。
备注:在接受license的步骤存在一个坑,在安装TeamViewer的时候,认为你是以界面形式安装的,所以,会弹出一个对话框,提醒你接受license,但是,由于你用ssh登录的,所以,这个对话框看不到。
10.在实体机上安装teamviewer,输入9中的ID号,然后进行8中的密码验证,成功连上。
远程唤醒
主板要设置wake on lan 开启
以及 关机后usb设备保持电源
# 使用如下命令查看网卡是否开启了Wake-on选项
# Wake-on为g代表开启,为d代表关闭
ethtool em1 #em1为网卡
ethtool em1 | grep Wake-on
# 如果未开启,使用如下命令开启
ethtool -s em1 wol g
重启后wol会失效,所以有必要用一个自动化脚本来设置wol
sudo nano /etc/systemd/system/wol.service
写入内容
[Unit]
Description=Configure Wake On LAN
[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s INTERFACE wol g
[Install]
WantedBy=basic.target
使systemd知道新的WOL脚本
sudo systemctl daemon-reload
使能WOL脚本
sudo systemctl enable wol.service
启用WOL脚本
sudo systemctl start wol.service
在另一台主机上唤醒目标机器
wakeonlan -i xxx.tpddns.cn -p 9999 xx:xx:1A:0B:BE:41