Ubuntu安装SS并启用chacha20

1, 安装shadowsocks

apt-get install python-m2crypto build-essential python-pip
pip install shadowsocks

2, 编译安装libsodium

wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz
tar zxf LATEST.tar.gz
cd libsodium*
./configure
make && make install

3, 修复动态链接库

sudo echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig

4, 启动shadowsocks

ssserver -p 12345 -k password -m chacha20

Ubuntu系统安装中文UTF-8支持

第一步,安装中文包:

apt-get install language-pack-zh-hant language-pack-zh-hans

第二步,配置相关环境变量:

vi /etc/environment

在文件中增加语言和编码的设置:

LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"

我的配置文件显示如下:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
LANG="zh_CN.UTF-8"
UNZIP="-O CP936"
ZIPINFO="-O CP936"

第三步,重新设置本地配置:

dpkg-reconfigure locales

Ubuntu下设置中文locale

一般VPS刚开通不没有装中文的locale,通常会报这样的错误。

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "zh_CN.utf8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

这个要自己去设定。1.查看当前系统语言环境

locale

2.查看系统内安装的locale

root@ubuntu-vps:~# locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX

3.安装zh_CN.utf8

root@ubuntu-vps:~# cd /usr/share/locales
root@ubuntu-vps:/usr/share/locales# ls
install-language-pack remove-language-pack
root@ubuntu-vps:/usr/share/locales# ./install-language-pack zh_CN
Generating locales…
zh_CN.UTF-8… done
Generation complete.
dpkg-trigger: dpkg-trigger 必须从维护者脚本中调用(或者通过 –by-package 选项)

4.验证locale安装是否成功

root@ubuntu-vps:/usr/share/locales# locale
LANG=zh_CN.utf8
LC_CTYPE="zh_CN.utf8"
LC_NUMERIC="zh_CN.utf8"
LC_TIME="zh_CN.utf8"
LC_COLLATE="zh_CN.utf8"
LC_MONETARY="zh_CN.utf8"
LC_MESSAGES="zh_CN.utf8"
LC_PAPER="zh_CN.utf8"
LC_NAME="zh_CN.utf8"
LC_ADDRESS="zh_CN.utf8"
LC_TELEPHONE="zh_CN.utf8"
LC_MEASUREMENT="zh_CN.utf8"
LC_IDENTIFICATION="zh_CN.utf8"
LC_ALL=

Ubuntu VPS上安装 xfce 和 vnc

1. 安装显示系统 x11,命令:

root@xiaokyun:~#apt-get install xorg

这一步要安装包的大小大约是 20 来 M,如果是美国的服务器,可以眼争争的看着它完成,很快的。完了我们就有了 X11 了。

2. 安装桌面支持,Linux 著名的桌面系统有 gnome 和 KDE,还有轻量级的 xfce4,由于实际网络及系统的条件,我这里选择安装 xfce4,命令:

root@xiaokyun:~#apt-get install xfce4

这一步安装包大小 200 来 M,对于每秒 10 几 M 的下载速度可能还不够你上个小 WC,安装之前你会看到一堆东西要安装,都要安装了。

3. 现在可以安装 vnc 服务端,命令:

root@xiaokyun:~#apt-get install vnc4server

4. 现在你可以执行 vnc 服务端了,可以直接执行

root@xiaokyun:~# vncserver

现在还用不着急着去用 -geometry 1024X768 -depth 16 去指定显示分辨率和颜色深度。执行 vncserver 后正常的话会提示你输入两篇连接密码,成功的话能够看到类似的信息:

New ‘xiaokyun:1 (root)’ desktop is xiaokyun:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/xiaokyun:1.log

5. 客户端连接,vnc 客户端很多种,我也是建议你用 TightVNC, 从 http://www.tightvnc.com/download.html 下载,您只需要在你的本地电脑上安装 vncview 组件。
打开 vncview,输入服务器的 ip地址:1,然后连接,按照提示输入刚刚设置的密码就可登陆。

vnc-client-login

OK,成功登陆了,可是你现在应该也只是能看到一个命令窗口,和 ssh 分别不那么大,对的,现在还是个 xterm+tvm,所以还有点工作要做.

burst-vnc1

6. 把原来的 vncserver 结束掉,修改下 /root/.vnc/xstartup 文件

root@xiaokyun:~#vncserver -kill :1 杀了刚刚启的 vncserver 进程

root@xiaokyun:~#vi /root/.vnc/xstartup 打开 /root/.vnc/xstartup 文件,里面的内容只需要下面两行,其他的可以注释掉:

#!/bin/sh
/usr/bin/startxfce4 &

本文原始链接 http://unmi.cc/vnc-burst-vps-ubuntu-xfce/, 来自 隔叶黄莺 Unmi Blog
保存该文件,由于 /usr/bin/startxce4 本身是可执行的,其实可不用 chmod +x 加执行权限

7. 现在再执行 vncserver 来启动 vnc 服务

root@xiaokyun:~#vncserver

现在再次用 vncviewer 来连接服务器,看到的就是真正的 xfce 界面了,速度基本还是能接受的。

vnc-ubuntu-xfce

其他一些内容,自己酌情而定了,有说要执行如下两命令:

apt-get install x-window-system-core 不知具体内情
apt-get install x11vnc 好像也用不着
apt-get install xdm 或说要安装这个,用于登陆界面

另外在启动 vncserver 时可以加一些启动选项,执行 vncserver –help 可以看到支持的选项:

root@xiaokyun:~# vncserver –help
VNC4 server
Usage: vncserver [] [:<DISPLAY#>]
vncserver -kill :<DISPLAY#>
are Xvnc4 options, or:

-name
-depth
-geometry x
-httpport number
-basehttpport number
-alwaysshared
-nevershared
-pixelformat rgb
-pixelformat bgr

See vnc4server and Xvnc4 manual pages for more information.

比如执行 vncserver -geometry 800×600 后,客户端连接后的分辨率就是 800×600,还有颜色深浅的设置等,默认是 1024×768。也能用 -httpport 设置 http 连接端口,用于客户端直接用浏览器 Applet 进行连接,如 http://ipaddress:5901。

对于 /root/.vnc/xstartup 文件的修改,有不同的意见是,只注释掉原始文件的 #x-window-manager& 行,最后加上:

x-sesion-manager & xfdesktop & xfce4-panel &
xfce4-menu-plugin &
xfsettingsd &
xfconfd &
xfwm4 &

保存它来作用到 vncserver。

有些地方提到的可定制启动 vncserver 的参数,CentOS 是在 /etc/sysconfig/vncservers 文件后加上:

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800×600"
如果想设置多个用户,可以用如下格式:
VNCSERVERS="1:one 2:two 3:three"
VNCSERVERARGS[1]="-geometry 800×600"
VNCSERVERARGS[2]="-geometry 800×600"
VNCSERVERARGS[3]="-geometry 800×600"

不知道 Ubuntu 的启动参数该加到哪个文件中,反正是找不到 /etc/sysconfi/vncservers 文件,会是 xstartup 文件吗?

原文链接:http://unmi.cc/vnc-burst-vps-ubuntu-xfce/