921 views 八月 21, 10 by Timothy
苹果的Mac OS中,比较受欢迎的功能,就是最下面的应用程序的Dock Panel。Dock的好处,能把最常用的应用程序添加进去,能提高使用效率,比起桌面上密密麻麻的应用程序图标而言,简洁和美观多了。不过Dock程序并不是非得Mac OS中才能体验,Ubuntu中也有类似的应用,让咱们Ubuntu Fans也能过把瘾。这款工具,叫做AWN,全名是: Avant Window Navigator (下文还是简称AWN)。
AWN的安装十分方便,直接进入Ubuntu的Software Center,在应用程序搜索栏,输入AWN,就能找到它了。

安装后,在系统菜单的附件中,就能找到并启动这款工具。AWN会出现在屏幕的下方,默认只有一两个图标,其他的程序需要用户根据自己的喜好添加。
AWN的设置菜单,功能也非常丰富,包括你可以设置停靠栏的主题,图标大小,自动隐藏,停靠方向,等等……
其中的一些选项,同学们自己去摸索吧,最后来一张设置后的Ubuntu桌面效果,感觉比较赞!

604 views 八月 14, 10 by Timothy
Mono的大名,搞.NET的同学都知道。它使.NET程序在Linux下有了跨平台运行的可能。随着mono的逐步发展,现在已经逐渐趋于稳定和流行了。此文介绍一下Ubuntu中mono环境的搭建。
1.安装
1
| $ sudo apt-get install mono-gmcs libmono-system-data2.0-cil libmono-system-ldap2.0-cil libmono-system-messaging2.0-cil libmono-system-runtime2.0-cil |
当然,还有其他的一些包可选,比如:
libmono-winforms2.0-cil 提供WinForm程序开发功能
libmono-system-web2.0-cil 提供asp.net web程序开发功能
libmono-system-web-mvc1.0-cil 提供MVC的web开发框架
libmono-wcf3.0-cil 提供WCF开发功能
libmono-nunit2.4-cil Nunit,单元测试模块
2.安装好后,查看mono相关信息
1
2
3
4
5
6
7
8
| Mono JIT compiler version 2.4.4 (Debian 2.4.4~svn151842-1ubuntu4)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
GC: Included Boehm (with typed GC)
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none |
3.测试程序
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| using System;
using System.Linq;
namespace Test
{
class Program
{
static void Main()
{
Console.WriteLine("Hello Mono!");
Console.ReadLine();
}
}
} |
保存为test.cs,然后用gmcs编译,运行正常。
至此,mono环境配置成功。
371 views 七月 16, 10 by Timothy
Linux中提供方便的让我们生成随机密码的功能,并且生成的密码有一定的复杂度,符合密码规范。下面是Linux中生成随机密码的两种常用的方式:
1.用mkpasswd命令:
使用mkpasswd命令,需要事先安装expect模块,以CentOS为例:
安装好后,直接运行mkpasswd,就能生成随机密码了。并且命令还有参数,比如设置生成的随机密码的最小长度,等等,看看help就知道了。
2.用passwdgen命令:
和mkpasswd大致一致,需事先安装passwdgen模块:
1
| yum -y install passwdgen |
安装好后,直接运行passwdgen,即可得到随机密码,同样passwdgen命令也有参数,可以参考help。
548 views 六月 06, 10 by Timothy
ACL是Linux中的访问控制列表,它提供对文件、目录更好的读写、访问控制权限等功能,也是我在Ubuntu下配置用户权限经常用到的工具。ACL工具的安装非常简单:
1
| sudo apt-get install acl |
系统便会自动下载、安装ACL工具。安装好后,你就可以通过setfacl和getfacl来设置、获取文件及目录的访问控制权限了。
最近在用ACL设置权限的时候,老是提示: Operation not supported ,百思不得其解,反复检查了shell命令,并没有发现不妥之处,后来在向google老师请教后,发现Linux下的文件系统,在挂接时,有可能默认并没有开启对ACL的支持。通过如下命令可以检查:
比如,在我的VPS中,通过此命令的输出信息,就能看到,我要设置权限的目录是在/home 而此目录是和根目录在同一个文件系统,被统一加载为 / 的。这个文件系统默认并没有开启动对ACL的支持,需要我们修改/etc/fstab来开启ACL支持。做法比较简单:
在你所需要的文件系统options中,追加acl(注意是小写),如下:
#
/dev/xvda / ext3 rw,acl 0 1
修改后,保存并退出,然后直接重启系统,或者直接umount该文件系统,并重新mount。最后再用mount -l确认一下看ACL支持是否开启即可。
1,784 views 五月 22, 10 by Timothy
用惯了Windows,也经常在Windows下面用SSH跨栏。以前常用的是MyEnTunnel,后来改用Tunnelier,感觉速度要快不少。最近又常用Ubuntu看网页,所以跨栏也是避免不了的。由于Linux本身就有ssh命令,所以不用借助任何软件,就可以产生本地的SSH加密隧道。用如下的shell命令即可:
1
| ssh account@host -N -D 127.0.0.1:1080 |
如上面的例子,通过使用简单的ssh命令,即可产生本地的代理隧道,这样,配合Firefox+AutoProxy,就可以跨栏了,以前俺的文章也有介绍,呵呵。可以把上面的命令保存为一个Shell脚本,每次执行以下,输入ssh密码即可。
不过,今天要给大家介绍一款Linux下,GUI的SSH Tunnel软件,这就是: SSH Tunnel Manager 。 它是一款运行于Gnome上的用于产生SSH加密隧道代理的软件,拥有GUI的界面,而且是开源的。
Ubuntu下面安装方式也比较简单,不需要自己去下载,直接通过apt就可以安装:
1
| sudo apt-get install gstm |
安装好后,可以在Application->Internet菜单下面找到:gSTM,即可启动。
软件的界面也比较简洁,设置也比较简单,如下图:
设置的界面也很简单,输入帐号,以及SSH代理的本地端口即可。记得把转发类型设置为Dynamic。
做好简单的设置,点击Start按钮,你就可以自由的跨栏了……
836 views 五月 10, 10 by Timothy
网上收集来的Ubuntu 10.04更新源,感觉网易的速度还不错,其他几个都是国内的,大家可以试试。
使用方法:
1.sudo gedit /etc/apt/sources.list
编辑你的源列表,将原来的内容全部删除,添加下面列表中最适合你的源 (注意不要全部添加),选择一个最合适你的即可,复制到你的列表中,然后保存列表。
2.sudo apt-get update 更新源列表信息
可以在运行“sudo apt-get update ”时查看一下错误信息,把不能连接的源删除再重新运行“sudo apt-get update ”。
3.sudo apt-get upgrade 升 级
或者用ubuntu自带的更新管理器升级 也可
Ubuntu 10.04源列表:
台湾
deb http://tw.archive.ubuntu.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ lucid-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ lucid-updates universe main multiverse restricted
SRT Sources
deb http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports main restricted universe multiverse
网易(速度很快)
deb http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-updates universe main multiverse restricted
ubuntu官方上海源,提供 Kernel,Hiweed,ubuntu
deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
搜狐源:
deb http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirrors.shlug.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirrors.shlug.org/ubuntu/ lucid-updates universe main multiverse restricted
骨头源,骨头源是 bones7456架设的一个Ubuntu源 ,提供ubuntu,deepin
deb http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb-src http://ubuntu.srt.cn/ubuntu/ lucid main universe restricted multiverse
deb http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-security universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://ubuntu.srt.cn/ubuntu/ lucid-updates universe main multiverse restricted
lupaworld源:
deb http://mirror.lupaworld.com/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.lupaworld.com/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.lupaworld.com/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.lupaworld.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.lupaworld.com/ubuntu/ lucid-updates universe main multiverse restricted
rootguide 源,ubuntu官方上海源,提供 Kernel,Hiweed,ubuntu
deb http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb-src http://mirror.rootguide.org/ubuntu/ lucid main universe restricted multiverse
deb http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-security universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-proposed universe main multiverse restricted
deb http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-backports universe main multiverse restricted
deb-src http://mirror.rootguide.org/ubuntu/ lucid-updates universe main multiverse restricted
784 views 五月 02, 10 by Timothy
从Ubuntu的官网发布开始倒计时的时候,我就掰着手指,等着新版Ubuntu的最终发布。在临近发布的时候,还有爆料说Ubuntu发现重大bug,导致安装后引导程序会出现问题,不过这个BUG在最终发布的时候还是修复了。正式发布的第二天,俺就迫不及待的从官网拖了一个Ubuntu 10.04 64bit的Desktop版本,准备装在笔记本上,原因是笔记本是4G内存(嘿嘿……)。 继续按照老的套路,从U盘安装Ubuntu,这样可以不用刻光盘,避免浪费,且安装速度快,绿色,环保。整个安装过程很简洁,而且不到10分钟,就搞定了,这速度,比起安装Windows,实在有点出乎意料。而且比起自家大哥Ubuntu 9系列还要快,因为Ubuntu 9在安装时还要在线下载一些东西,会耽误一定的时间。
安装完毕,第一次进入Ubuntu 10,给人比较耳目一新的感觉,特比是菜单栏上多出的一个聊天帐号设置,包括众多兼容的实时聊天软件,这也是Ubuntu 10主打的一特色:加强的社区交互功能。另外值得一提的是Ubuntu One,Ubuntu的云集算服务功能,相当不错。目前Ubuntu对硬件的识别更加友好了,在ThinkPad的机器上,根本不用安装任何驱动,Ubuntu已经能自动识别包括:声卡/无线网卡/以太网卡/声音调整按钮/蓝牙/亮度调节 等等驱动,非常人性化。而且发现Ubuntu本身已经自带了非常流行的iBus输入法,只需要再在机器的语言支持中,装上中文和一些其他附带的东东,就可以方便的用iBus输入中文了,这又算是个亮点。
作为一款粉丝众多的Linux发行版本,Ubuntu在用户易用性和UI上花了不少的功夫,并且自带的一系列软件,足以满足用户一般的上网/图片处理/文字处理等需求,看来国内用户要逐步脱离Win的束缚,迁移到Linux的日子不远了……
本文纯属自己使用Ubuntu Linux的一些流水帐和感受,欢迎各位同学交流。
PS:本文发自 Ubuntu 10.04 LTS 64bit Desktop Edition ,小小纪念一下。
2,552 views 三月 28, 10 by Timothy
俺的VPS是基于OpenVZ的,因而不支持PPTP VPN,唯一的办法,是搭建OpenVPN。和PPTP VPN相比,OpenVPN的搭建要稍微麻烦一些。并且服务端和客户端需要生成证书,以及修改配置文件。下面把BurstNET VPS上,Ubuntu系统中搭建OpenVPS的流水账记录一下,供日后参考:
1.前期工作,OpenVPN,需要TUN支持,默认情况下,是没有开启的,需要到后台管理平台中,点击Enable Tun/Tap即可开通。开通后,用命令
如果返回 cat: /dev/net/tun: File descriptor in bad stat,表明已经成功启用TUN支持。
另外,需要iptables_nat模块支持,用命令
1
| iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j MASQUERADE |
检查,如果返回iptables: Unknown error 4294967295,表明系统还不支持,需要联系客服开通。
2.安装OpenVPN,这个最简单不过了:
1
| sudo apt-get install openvpn |
安装好后,默认的路径在 /usr/share/openvpn,进入 /usr/share/openvpn/easy-rsa/2.0 目录,用vim修改vars文件,加入自己的信息,这些信息在生成证书的时候会用到,下面是示例:
1
2
3
4
5
| export KEY_COUNTRY="CN"
export KEY_PROVINCE="SC"
export KEY_CITY="ChengDu"
export KEY_ORG="FreedomUnion"
export KEY_EMAIL="admin@xiaozhou.net" |
修改好后,保存文件,用命令 . ./var运行,注意两个点之间有个空格。运行后,会设置好变量,接下来按照下面顺序,运行命令,生成证书:
1
2
3
4
| ./build-ca
./build-key-server timothy-vps
./build-key ClientName
./build-dh |
./build-key-server 用来生成服务端证书,./build-key用来生成客户端证书,有几个客户端,就需要生成几个。
生成好后,接下来需要配置服务端配置文件,把/usr/share/openvpn/easy-rsa/2.0/keys目录下所有生成好的证书文件,拷贝到 /etc/openvpn/keys,接下来,编辑服务端配置文件:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| cd /etc/openvpn
vim server.conf
#输入以下内容到配置文件
port 1194
proto tcp
dev tun
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/timothy-vps.crt
key /etc/openvpn/keys/timothy-vps.key
dh /etc/openvpn/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
client-to-client
keepalive 10 120
comp-lzo
persist-key
persist-tun
verb 3 |
编辑好后,保存文件,用vim编辑 /etc/sysctl.conf,把net.ipv4.ip_forward=0改成 net.ipv4.ip_forward = 1,运行 sysctl -p命令,编辑/etc/init.d/iptables,加入以下规则:
/sbin/iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT –to-source Your-VPS-IP
接下来,服务端配置基本结束,运行命令,启动OpenVPN客户端:
1
| /usr/sbin/openvpn --config /etc/openvpn/server.conf & |
如果需要开机启动,把上面命令加入到/etc/rc.local即可
服务端启动成功截图

接下来,配置客户端了,Windows下使用OpenVPN,需要下载最新版的OpenVPN安装程序。安装好后,将在VPS上生成好的证书文件,下载到客户端,包括ca.crt证书,以及客户端证书:timothy.crt timothy.key,将它们统统拷贝到OpenVPS安装目录下的config目录,编写客户端文件,保存为client.ovpn,内容如下:
client
dev tun
proto tcp
remote Your-VPS-IP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert timothy.crt
key timothy.key
ns-cert-type server
comp-lzo
verb 3
保存好后,右键点击client.ovpn,选择“Start OpenVPN on this config file”,建立VPN连接,建立好后,命令行会有如下提示: Initialization Sequence Completed,表示连接成功,这下,可以VPN上网了。去ip138.com,看看你的IP,应该是VPS的IP了:
