[转载] Ubuntu 16.04 LTS 一键安装VNC

  1. 安装 X11VNC:
    sudo apt install x11vnc -y
  2. 配置访问密码:
    sudo x11vnc -storepasswd /etc/x11vnc.pass
  3. 创建服务:

    vi /lib/systemd/system/x11vnc.service

     #粘贴如下代码,最后 :wq 保存,请使用root用户,否则没有权限。
    [Unit]
    Description=Start x11vnc at startup.
    After=multi-user.target
    [Service]
    Type=simple
    ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport -shared
    [Install]
    WantedBy=multi-user.target
  4. 配置防火墙,配置和启动服务
     sudo ufw allow 5900
    sudo systemctl enable x11vnc.service
    sudo systemctl daemon-reload
  5. 重启

脚本:

 su root
wget https://github.com/longhr/ubuntu1604hub/raw/master/ubuntu1604VNC.sh
chmod u+x ubuntu1604VNC.sh
./ubuntu1604VNC.sh

https://github.com/longhr/ubuntu1604hub/raw/master/ubuntu1604VNC.sh

 # #################################################################
# 脚本名称 : ubuntu1604VNC
# 脚本描述 : 自动安装配置和自动启动X11Vnc
# 编写日期 : 2016.6.
# 作 者 : longhr
# 作者网站 : blog.csdn.net/longhr
# 软件版本 : 0.1
# 注意事项: 运行完5秒内会重启
# 免责声明 : 使用*,后果自付
# ################################################################# # 步骤 - 安装 X11VNC
# #################################################################
sudo apt-get install x11vnc -y # 步骤 - 配置访问密码
# ################################################################# sudo x11vnc -storepasswd /etc/x11vnc.pass # 步骤 - 创建服务
# ################################################################# cat > /lib/systemd/system/x11vnc.service << EOF
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target [Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport -shared [Install]
WantedBy=multi-user.target
EOF # 步骤 - 配配置防火墙端口,配置和启动服务
# ################################################################ echo "Configure firewall"
sudo ufw allow
echo "Configure Services"
sudo systemctl enable x11vnc.service
sudo systemctl daemon-reload # 步骤 - 重启
# ################################################################
sleep 5s
sudo shutdown -r now
上一篇:Scrum Meeting 3 -2014.11.5


下一篇:Vue学习笔记-rest_framework_jwt 学习