by agate - Published: 2010-01-04 [8:42 上午] - Category: 系统操作

出于中国某种不可抗拒的力量所致, 我们很多的 apt 源都无法正常访问. 所以使用代理翻墙是必不可免的. 可是如何让 apt 也同样使用这个代理有很多人不是很清楚. 其实有两种方法:

1. apt 配置修改法 (推荐)
编辑 /etc/apt/apt.conf

$ sudo vi /etc/apt/apt.conf
Acquire::http::Proxy "http://server:port/";

2. 给 bash 设定 http_proxy 和 ftp_proxy

$ export http_proxy=http://server:port/
$ export ftp_proxy=http://server:port/

现在只要执行 apt 的各个命令就是通过 proxy 走了.

Tags: [ , ] - Comments: Comments
by agate - Published: 2009-08-17 [9:02 上午] - Category: 软件使用

Fitx 这个开源的优秀输入法让我在 linux 下体会到如同 windows 下搜狗输入法那样的舒服. 良好的速度, 流畅的输入体验, 完整的用户词库导出导入功能. 我觉得在 linux 下, 没有什么输入法能让我如此着迷的了.

Fitx 是 http://fit.coollittlethings.com/ 出品的. 同样地, 也有 mac 版本. 同样是好用得不得了. 但是可惜的是目前免费的 MAC 版本官方已经不再更新了. 我想估计是资金问题吧. 不过如果好用的话, 我会考虑购买一个的.

不过说回来, 我还是喜欢免费的午餐. 特别是 linux 下. 我们可以通过 svn 导出 http://code.google.com/p/fitx/ 里头的源文件. 然后自行编译安装.

具体步骤如下.
1. $ svn co http://fitx.googlecode.com/svn/branches/fitx-autotool fitx-autotool
2. $ cd fitx-autotool
3. $ ./autogen.sh
4. $ make deb && sudo dpkg -i ../fitx_*.deb

其中遇到任何错误基本是没有安装完整的编译工具导致. 请查看 log 并安装对应的编译帮助工具即可.
最后执行那个生成的 deb 安装包就 ok 咯!

Tags: [ , , ] - Comments: Comments
by agate - Published: 2009-04-05 [9:36 上午] - Category: 开发环境

今天在新的 Ubuntu 上面安装 rails 的时候碰到了这样的问题:

`require_frameworks': no such file to load -- net/https (RuntimeError)

原来是缺少 libopenssl-ruby library:
解决方案:
$sudo apt-get install libopenssl-ruby
本文作为 Ubuntu下部署rbuy on rails开发环境 补充

Tags: [ , , ] - Comments: Comments
by agate - Published: 2008-12-07 [8:18 上午] - Category: 开发环境

i feel uncomfortable while i using vim and having to move way up to reach Escape key. so i swaped the Escape and CapsLock keys by under steps:

first, open your terminal. and type:
$vim ~/.xmodmap

second, add under statements into ./xmodmap file.
remove Lock = Caps_Lock
keysym Caps_Lock = Escape
keysym Escape = Caps_Lock
add Lock = Caps_Lock

last, restart your X env.
(maybe you can use CTRL + ALT + BackSpace)

after these configurations, i found it's easier than move way up to reach Esc while using vim.

ps. thanks forrest, thanks leon! i found i fell in love with vim!!! it's really powerful!

Tags: [ , , ] - Comments: Comments
by agate - Published: 2008-11-15 [9:03 上午] - Category: 系统操作

不知道大家有没有觉得在默认情况下, 我们的 Ubuntu 在出现警告音的时候不是像 windows 那样亲切地 "叮叮叮", 而是才用 PC 的蜂鸣器来大声地 "嘟嘟嘟". 特别是在我们使用 shell 不全, 或者 vim 在行首/尾时候也会出现这个愤恨的声音. google 了一下找到了解决方法.
1. 就是干脆把 x 环境和 shell 环境通通关闭声音.
方法就是编辑你的 ~/.bashrc 文件, 加入
xset b off
2. 如果你像我一样只是烦恼 shell 下开发烦人问题的话, 就只要把 gnome-terminal 的 profile 中的那个 "终端响铃" 去掉就好了!

Tags: [ , ] - Comments: Comments
by agate - Published: 2008-11-09 [10:45 下午] - Category: 未分类

一直使用的是 ubuntu 的 linux 系统. 都说 linux 比 windows 快, 可是我就没有发现出来. 开了 firefox 感觉卡得要死了! 反正感觉都很慢... 无意间看到一个叫做 xfce 的东西, 就装了. 根据配置使用之后发现就是一个和 gnome/kde 一样的 X 环境. 不过我的机器从此"正常"的跑起来了. 内存占用及其小, 开什么都很顺畅, firefox 也没有过去卡了! 也许 firefox 针对 win 下真的做过很大的优化! 反正感觉就是好多了!
ubuntu 下使用 apt-get 安装 xubuntu 就完事了!
$sudo apt-get install xubuntu-desktop

Tags: [ , , ] - Comments: Comments
by agate - Published: 2008-11-09 [11:36 上午] - Category: 系统操作

nautilus 是 gnome 中默认的文件管理器, file-roller 是 gnome 中默认的压缩解压缩软件图形前端.
thunar 是 xfce 中默认的文件管理器, xarchiver 是 xfce 中默认的压缩解压缩软件图形前端.

所以, 在 gnome 的终端下输入 nautilus 便会启动文件管理器. 在 xfce 的终端下输入 thunar 同样效果.

Tags: [ , , ] - Comments: Comments
by agate - Published: 2008-11-09 [8:55 上午] - Category: 系统操作

常常在 Ubuntu 这种使用 Gnome 的操作西统辖打开一个文件夹, 可是不能往里头添加东西, 或者删除东西等等. 这个是因为我们的权限不够.

在终端下我们可以
1. 单独一个命令
$sudo 命令
2. 长效权限
$sudo -s

但是这些都是终端下的, 很多时候我们喜欢在 GUI 环境中寻找东西并修改/删除/添加. 这里给出多种解决方案:
1. 使用终端命令:
$sudo nautilus
2. 使用 nautilus-scripts 扩展右键, 在 ~/.gnome2/nautilus-scripts 下建立一个名为 "作为ROOT浏览" 的文件. 内容如下:
#!/bin/bash
script-worker browse $NAUTILUS_SCRIPT_SELECTED_URIS root

然后把这个文件改为可执行的属性.(在属性中改, 或者在终端中 chmod +x 都可以)
3. 干脆直接安装帮助扩展
sudo apt-get install nautilus-gksu
安装后会多出 "以管理员打开"

Tags: [ , ] - Comments: Comments
by agate - Published: 2008-11-08 [8:55 下午] - Category: 系统操作

$sudo apt-get install nautilus-open-terminal
这样便会在每个文件夹的右键菜单中出现 "在终端中打开" 的一个选项, 选择便会打开一个终端, 路径为当前文件夹!

当然, 可以使用 nautilus-scripts 添加右键扩展. 在 ~/.gnome2/nautilus-scripts/ 目录下新建一个文件名为 "从这里打开终端", 内容如下:
gnome-terminal --working-directory=$PWD
之后把这个文件设置为可执行(在属性中选择, 或者命令行 chmod +x 怎么设置随你开心)
然后在右键有个 "脚本" 里头就有了!

记得重启 X环境噢! Ctrl + Alt + Backspace

Tags: [ , ] - Comments: Comments
by agate - Published: 2008-10-07 [9:29 上午] - Category: 系统操作

一般来说 crontab 的格式是 "xxx时间 xxx用户 xxx命令". 其中 xxx时间 又是由五个区间段组成. 例如 "12 3 * * *", 无意中在查看开机自动运行方法中发现了原来 cron 可以通过 @reboot 实现开机自动运行. 于是便寻觅缘由, 被我发现了其他的 "at" 命令!

关键字          含义
------         -------
@reboot        在启动的时候执行一次.
@yearly        每年执行一次, 相当于 "0 0 1 1 *".
@annually      (和 @yearly 一回事)
@monthly       每月执行一次, 相当于 "0 0 1 * *".
@weekly        每周执行一次, 相当于 "0 0 * * 0".
@daily         每日执行一次, 相当于 "0 0 * * *".
@midnight      (和 @daily 一回事)
@hourly        每小时执行一次, 相当于 "0 * * * *". 

用以上 8 个关键字可十分方便地替代原来 5 个时间区间的常用部分. 当然其中特别要说明一下的是 @reboot . 这是一种十分方便的方法, 可以让每一个用户在启动的时候执行某个命令而不需要 root 身份!

Tags: [ , ] - Comments: Comments