更新yum源,备份/etc/apt/sources.list
root@mgw-virtual-machine:~# nano /etc/apt/sources.list #添加源
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverseroot@mgw-virtual-machine:~# apt-get update #更新缓存
安装vnc server:
root@mgw-virtual-machine:~# apt-get install vnc4server
root@mgw-virtual-machine:~# apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal #安装所需软件
配置vncserver:
root@mgw-virtual-machine:~# vncserver #设置密码
You will require a password to access your desktops.
Password:
Verify:New 'mgw-virtual-machine:2 (root)' desktop is mgw-virtual-machine:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/mgw-virtual-machine:2.log
root@mgw-virtual-machine:~# vncserver -kill :1 #结束vncserver进程
Killing Xvnc4 process ID 27879
root@mgw-virtual-machine:~# pkill Xvnc4
root@mgw-virtual-machine:~# vncserver -geometry 1366x768 :1 // 其中-geometry 指定客户端窗口的大小,:1 指的是客户端连接号,和分辨率New 'mgw-virtual-machine:1 (root)' desktop is mgw-virtual-machine:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/mgw-virtual-machine:1.logroot@mgw-virtual-machine:~# nano .vnc/xstartup #配置vnc启动文件
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
gnome-session &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
vncconfig -nowin &root@mgw-virtual-machine:~# apt-get install chkconfig #安装chkconfig工具,设置vncserver开启机启动
root@mgw-virtual-machine:~# chkconfig --add vnc4server
root@mgw-virtual-machine:~# chkconfig –levels 345 on vnc4server
关于ubuntu vim编辑问题处理:
由于Ubuntu预安装的是tiny版本,就会导致我们在使用上的产生不便。所以我们要安装vim的full版本。
首先,先卸掉旧版的vi,
root@mgw-virtual-machine:~# apt-get remove vim-common #卸载
root@mgw-virtual-machine:~# apt-get install vim #安装full版的vim
root@mgw-virtual-machine:~# vim /etc/vim/vimrc.tiny
注释:
vimrc.tiny 拥有者是root用户,所以要在root的权限下对这个文件进行修改。很简单,这个文件里面的倒数第二句话是“set compatible”,将“compatible”改成“nocompatible”非兼容模式就可以解决方向键变ABCD的问题了。
接下来要解决Backspace键的问题也很简单,在刚才那句话后面再加一句: set backspace=2