在Ubuntu安装VNC-server,即可在自己电脑使用机房的服务器进行深度学习模型训练

VNC Server配置

一、下载VNC Server

realVNC官网下载软件,通过Filezilla传到服务器

image-20210514155229046

二、安装软件

# For 32-bit system
sudo dpkg -i VNC-Server-6.3.1-Linux-x86.deb
# For 64-bit system
sudo dpkg -i VNC-Server-6.3.1-Linux-x64.deb

三、运行软件

# 运行服务
systemctl start vncserver-x11-serviced.service
# 启动开机自启
sudo systemctl enable vncserver-x11-serviced.service

打开VNC Server,输入许可证Key

image-20210514155136732

image-20210514155156999

VNC注册码:
BQ24G-PDXE4-KKKRS-WBHZE-F5RCA
BQ24G-PDXE4-KKKRS-WBHZE-F5RCA
8ZEZH-QPANM-NX3A5-8C4TS-8B97A
7AB4X-3YNXF-C5MRR-59DJG-7HGNA
UPL8P-CN2MT-85ERA-N3E3B-GERDA
3YHED-MNEHC-RMJT5-4UAAK-6A5HA
FBV9V-7Z3V9-MED3U-47SEU-85T3A
HA7MG-J8R3J-R3528-HC6P5-HTQ6A
B7SLM-7MAX5-B4M74-UTDBE-K5WFA
7736G-H4YBP-6ZCEU-AM3H4-QBTWA
NUQQ6-UP89V-9XGPU-GUYU9-U6VTA

四、本地连接服务器

本地下载VNC View,输入服务器ip,用户名及密码即可远程操控

image-20210514155539063

image-20210514155611475

![image-20210514155710187](/Users/oujiajie/Library/Application Support/typora-user-images/image-20210514155710187.png)

五、Scripting Deployment and Start-up on Linux

提供官方命令行代码

############# Download #############
# Download and unpack the latest binary on a 64-bit Debian-compatible system:
curl -L -o VNC https://www.realvnc.com/connect/download/binary/latest/debian/64-bit/
# Download the latest binary on a 32-bit Debian-compatible system:
# curl -L -o VNC https://www.realvnc.com/connect/download/binary/latest/debian/32-bit/
# Download the latest binary on a 64-bit Red Hat-compatible system:
# curl -L -o VNC https://www.realvnc.com/connect/download/binary/latest/redhat/64-bit/
# Download the latest binary on a 32-bit Red Hat-compatible system:
# curl -L -o VNC https://www.realvnc.com/connect/download/binary/latest/redhat/32-bit/


############# Install VNC Server #############
# Install VNC Server on a Debian-compatible system (assuming download file named as above):
sudo dpkg -i VNC
# Install VNC Server on a Red Hat-compatible system:
# sudo rpm -U VNC


############# License VNC Server #############
# For any subscription, start VNC Server in Service Mode (see below) and sign in to the GUI using your RealVNC account credentials.
# Alternatively, for Enterprise subscription only, apply your license key. More information:
# man vnclicense
# Apply your license key, available from the Deployment page of your RealVNC account:
sudo vnclicense -add XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
# Optionally enable cloud connectivity for VNC Server in Service Mode (token available with key):
sudo vncserver-x11 -service -joinCloud <your-token>
############# Specify a VNC password for VNC Server #############
# Mandatory for Home subscription (except Raspberry Pi). Not required for Professional or Enterprise subscription. More information:
# man vncpasswd
# Specify a VNC password for VNC Server in Service Mode:
sudo vncpasswd -service
# Enterprise subscription only. Specify a VNC password for VNC Server in Virtual Mode:
vncpasswd -virtual
############# Enable domain users to connect to VNC Server using system credentials #############
# Recommended for Enterprise and Professional subscriptions (by default, only local password store is checked). More information:
# man vncinitconfig
# Share the common PAM configuration on a Debian-compatible system with VNC Server:
echo -e '@include common-auth\n@include common-account\n@include common-session' | sudo tee /etc/pam.d/vncserver.custom
# Share the common PAM configuration on a Red Hat-compatible system with VNC Server:
# echo -e 'auth include password-auth\naccount include password-auth\nsession include password-auth' | sudo tee /etc/pam.d/vncserver.custom
# Register the common PAM configuration with VNC Server:
echo 'PamApplicationName=vncserver.custom' | sudo tee -a /etc/vnc/config.d/common.custom
############# Configure and start VNC Server in Service Mode #############
# Mandatory for Home and Professional subscriptions. More information:
# man vncserver-x11-serviced
# Optionally change registered users and permissions (by default, root user and admin group have full access):
# echo 'Permissions=%admin:f,dev.acme.com\\johndoe:d,janedoe:v' | sudo tee -a /root/.vnc/config.d/vncserver-x11
# Optional for Enterprise subscription only. Change the listening port for direct connections (by default, 5900):
# echo 'RfbPort=4999' | sudo tee -a /root/.vnc/config.d/vncserver-x11

# Start VNC Server on a Linux system using initd:
sudo /etc/init.d/vncserver-x11-serviced start
# Start VNC Server on a Linux system using systemd:
# sudo systemctl start vncserver-x11-serviced.service

# Restart VNC Server each time a Debian-compatible system is booted using initd:
sudo update-rc.d vncserver-x11-serviced defaults
# Restart VNC Server each time a Red Hat-compatible system is booted using initd:
# sudo chkconfig --add vncserver-x11-serviced
# Restart VNC Server each time a Linux system is booted using systemd:
# sudo systemctl enable vncserver-x11-serviced.service
############# Prepare a system for VNC Server in Virtual Mode #############
# Enterprise subscription only, plus Home on Raspberry Pi. Recommended for Ubuntu 13.04+ and Fedora 19+. More information: https://help.realvnc.com/hc/en-us/articles/360003474792/
# Install a desktop environment suitable for virtualization (for example, LXDE) on Ubuntu 13.04+:
sudo apt-get install lxde
# Install LXDE on Fedora 19+:
# sudo yum install @lxde-desktop
# Use LXDE instead of the console desktop environment (if any) for all virtual desktops:
echo -e '#!/bin/sh\nDESKTOP_SESSION=LXDE\nexport DESKTOP_SESSION\nstartlxde\nvncserver-virtual -kill $DISPLAY' | sudo tee /etc/vnc/xstartup.custom
sudo chmod +x /etc/vnc/xstartup.custom
# Note also the following: hostname must be resolvable, xauth on PATH, and iptables suitably configured.
############# Configure and start VNC Server in Virtual Mode #############
# Enterprise subscription only, plus Home on Raspberry Pi. The daemon may be more convenient; see below. More information:
# man vncserver-virtual
# Optionally change registered users and permissions (by default, user starting VNC Server has full access):
# echo 'Permissions=:f,dev.acme.com\\johndoe:d,janedoe:v' | tee -a ~/.vnc/config.d/Xvnc
# Optionally specify virtual desktop geometries (first is the default, largest is the maximum). Connected users can cycle between using xrandr:
# echo 'RandR=1280x800,800x600,1024x768,1200x900,1280x720,1800x1024' | tee -a ~/.vnc/config.d/Xvnc
# Start VNC Server on port 5900+<next-available-display>, for example 5901. Note, do not start as root user:
vncserver-virtual
############# Configure and start VNC Server in Virtual Mode daemon #############
# Enterprise subscription only, plus Home on Raspberry Pi. More information:
# man vncserver-virtuald
# Mandatory if SELinux is Enforcing. Turn Avahi service discovery off:
echo 'ServiceDiscoveryEnabled=false' | sudo tee -a /etc/vnc/config.d/Xvnc
# Recommended. Restrict registered users and permissions (by default, any user can connect using system credentials):
echo 'Permissions=root:f,%teachers:d,%pupils:v' | sudo tee -a /root/.vnc/config.d/vncserver-virtuald
# Optionally change the listening port (by default, 5999):
# echo 'DaemonPort=6051' | sudo tee -a /root/.vnc/config.d/vncserver-virtuald

# Start VNC Server on a Linux system using initd:
sudo /etc/init.d/vncserver-virtuald start
# Start VNC Server on a Linux system using systemd:
# sudo systemctl start vncserver-virtuald.service

# Restart VNC Server each time a Debian-compatible system is booted using initd:
sudo update-rc.d vncserver-virtuald defaults
# Restart VNC Server each time a Red Hat-compatible system is booted using initd:
# sudo chkconfig --add vncserver-virtuald
# Restart VNC Server each time a Linux system is booted using systemd:
# sudo systemctl enable vncserver-virtuald.service