Raspberry Pi 的环境梳理

| No Comments | No TrackBacks
1.tsinghua.edu.cn的apt package不完整(安装VIM失败),而且从速度来看,也没优势,用回了原来的库:

$ cat sources.list
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi

2.系统中自带的VIM功能严重不足?从工作开发机拿来的配置基本没法用,所以重新更新安装了VIM
sudo apt-get install vim

3.下载上传不方便,安装了lrzsz
sudo apt-get install lrzsz

4.没有telnet开户端,测试网络端口不方便,需要安装:
sudo apt-get install telnet

5.安装go:
http://dave.cheney.net/2012/09/25/installing-go-on-the-raspberry-pi

Installing the prerequisites
Raspbian comes with almost all the tools you need to compile Go already installed, but to be sure you should install the following packages, described on the golang.org website.

% sudo apt-get install -y mercurial gcc libc6-dev
Cloning the source

% hg clone -u default https://code.google.com/p/go $HOME/go
warning: code.google.com certificate with fingerprint 9f:af:b9:ce:b5:10:97:c0:5d:16:90:11:63:78:fa:2f:37:f4:96:79 not verified (check hostfingerprints or web.cacerts config setting)
destination directory: go
requesting all changes
adding changesets
adding manifests
adding file changes
added 14430 changesets with 52478 changes to 7406 files (+5 heads)
updating to branch default
3520 files updated, 0 files merged, 0 files removed, 0 files unresolved

Building Go
% cd $HOME/go/src
% ./all.bash
If all goes well, after about 90 minutes you should see

ALL TESTS PASSED

---
Installed Go for linux/arm in /home/dfc/go
Installed commands in /home/dfc/go/bin
If there was an error relating to out of memory, or you couldn't configure an appropriate swap device, you can skip the test suite by executing

% cd $HOME/go
% ./make.bash
as an alternative to ./all.bash.

Adding the go command to your path
The go command should be added to your $PATH

% export PATH=$PATH:$HOME/go/bin
% go version
go version devel +cfbcf8176d26 Tue Sep 25 17:06:39 2012 +1000
Now, Go and make something awesome.


但直接更新出问题,该死的墙!需要走代理才行。
strace 进去发现网络死掉,接下载源代码,编译安装失败,看来必须翻了。

6.安装代理软件,最终我使用的是tsocks
sudo apt-get install tsocks
编辑/etc/tsosks.conf即可。
另外的privoxy安装了但没使用。

参考:
http://blog.creke.net/770.html
http://blog.ihipop.info/2011/01/1988.html
在终端下间接使用Socks5代理的几种方法(privoxy,tsocks,proxychains)

http://www.privoxy.org/
http://tsocks.sourceforge.net/faq.php

http://renyongjie668.blog.163.com/blog/static/16005312011824112410588/
http://www.51testing.com/?uid-225738-action-viewspace-itemid-246084

使用tsocks:
tsocks [application [applications arguments]]
tsocks [on|off]

举几个实例吧:
tsocks firefox  #之后再firefox上浏览网页就会默认使用tsocks配置的代理
tsocks git clone git://github.com/avikivity/kvm.git #使用proxy来git,这就是我用的原因

source tsocks on #设置当前shell的tsocks,该命令可能遇到一个小bug在下面有讲到
tsocks show    #查看当前Shell的tsocks设置,tsocks: This shell is socksified.
do_something   #这里就能默认使用tsocks的代理去do something了,前面已经设置了
source tsocks off #关闭当前shell的tsocks代理设置
tsocks show    #再次查看,tsocks: This shell is NOT socksified.
遇到的问题及解决方案:

13:01:17 libtsocks(2432): SOCKS server proxy-shz.intel.com (10.239.120.36) is not on a local subnet!
设置的代理没有与/etc/tsocks.conf文件中的local设置的网络在同一个子网中。
13:03:26 libtsocks(2451): The SOCKS server (proxy.ABCD.com) listed in the configuration file which needs to be used for this connection is invalid
配置文件的问题,我也忘了是啥时出现的错误了,但我碰到过的。
13:02:50 libtsocks(2441): Error 110 attempting to connect to SOCKS server (Connection timed out)
这个很明显了,就是你设置的proxy连接不上(可能是本来就连不上,或者没在同一个局域网内),请检查和确认配置。

ERROR: ld.so: object '/lib64/libtsocks.so' from LD_PRELOAD cannot be preloaded: ignored.
郁闷坏了,是因为有一次我在rhel5u5上安装了一个rhel6的tsock rpm包,解决办法是到http://pkgs.org/找到一个tsocks for rhel5的rpm包,安装即可。

[root@kvm-build ~]# source /usr/bin/tsocks on
basename: invalid option -- 'b'
Try `basename --help' for more information.
看到这样的错误,有可能是你的tsocks有点小bug,不过不影响使用的,接着你用tsocks show来看,一样可以看到提示说socks设置成功的,tsocks: This shell is socksified.

我的rhel5和rhel6中的tsocks都遇到这样的错误信息,你可以简单地修改一下/usr/bin/tsocks文件,将其中的basename的一行修改一下即可:

修改前:PRG="$(basename $0)"
修改为:PRG="$(basename -- $0)"

这是由于这个tsocks写后,coreutils工具做了些改动,其中basename工具需要用"--"来表示options的结束(为了保持新老版本的兼容)。这个问题在Bug-coreutils mailing list中讨论过了的,见:http://www.mail-archive.com/bug-coreutils@gnu.org/msg09912.html

替代工具机参考文档:
一个与tsocks有类似功能的工具: socat   (我暂时没怎么用)
见:http://freshmeat.net/projects/socat/
tsocks.conf配置文件:http://linux.die.net/man/5/tsocks.conf
tsocks的使用:http://www.21andy.com/blog/20100212/1678.html 
另外的人遇到的tsocks问题:http://notes.benv.junerules.com/socks-opera-and-brute-force/




--EOF--

No TrackBacks

TrackBack URL: http://www.guduo.net/cgi-bin/mt/mt-tb.cgi/398

Leave a comment

Pages

May 2016

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by 谷多 published on December 23, 2012 4:08 PM.

PS1 ANSI 的重新梳理 was the previous entry in this blog.

sudo apt-get 和dpkg命令大全 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.