1 配置IP
cat > /etc/network/interfaces << EOF
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.10.149
gateway 192.168.10.1
netmask 255.255.255.0
EOF
/etc/init.d/networking restart #(重启网卡服务)
2 配置DNS
echo "nameserver 202.96.134.133" > /etc/resolvconf/resolv.conf.d/base
echo "nameserver 202.96.128.68" >> /etc/resolvconf/resolv.conf.d/base
resolvconf -u
3 安装openssh
apt-get install openssh-server
reboot
升级UPDATE
apt-get update
reboot
4 安装 图形界面
apt-get install xfce4 xvfb
时间较长
5 安装x11vnc并配置
apt-get install x11vnc
设置密码两次输入(本次密码是123456)
x11vnc -storepasswd
启动:vnc
x11vnc -create -forever -bg -env FD_TAG=my_xfce_1 -env FD_SESS=xfce -rfbport 5901 -passwd 123456
6 Windows vmc客户端连接测试
如下是我的操作历史做参考:
1 vi /etc//network/interfaces
2 cat > /etc/network/interfaces << EOF
3 source /etc/network/interfaces.d/*
4 auto lo
5 iface lo inet loopback
6 auto eth0
7 iface eth0 inet static
8 address 192.168.10.149
9 gateway 192.168.10.1
10 netmask 255.255.255.0
11 EOF
12 vi /etc//network/interfaces
13 /etc/init.d/networking restart
14 ifconfig
15 ping 192.168.10.1
16 echo "nameserver 202.96.134.133" > /etc/resolvconf/resolv.conf.d/base
17 echo "nameserver 202.96.128.68" >> /etc/resolvconf/resolv.conf.d/base
18 resolvconf -u
19 apt-get update
20 apt-get openssh-server
21 apt-get openssh-
22 apt-get openssh
23 apt-get install openssh-server
24 reboot
25 ls
26 apt-get install xfce4 xvfb
27 ls
28 ll
29 apt-get install vnc4server
30 vncserver
31 ll
32 cd .vnc/
33 ls
34 vim xstartup
35 vi xstartup
36 ls
37 cp xstartup xstartup.bak
38 vi xstartup
39 ll
40 pwd
41 cat >/xstartup <<EOF
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
EOF
42 ls
43 cat xstartup
44 cat >xstartup <<EOF
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
EOF
45 ls
46 cat xstartup
47 vi xstartup
48 cat >xstartup <<EOF
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
EOF
49 cat xstartup
50 vncserver -kill :1
51 vncserver
52 vncserver -kill :1
53 vncserver -kill :2
54 ss -tunlp | grep 4901
55 apt-get install x11vnc
56 /usr/bin/x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900
57 ss -tunlp | grep 5900
58 x11vnc -storepasswd
59 /usr/bin/x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900
60 x11vnc -create -forever -bg -env FD_TAG=my_xfce_1 -env FD_SESS=xfce -rfbport 5901 -passwd 123456
61 history
root@ubuntu:~/.vnc#