Debian 安装配置 GoAgent

日期: 05 月 20日, 2014
标签:

GoAgent 是用 Python 开发的代理软件,可以用来翻(he)墙(xie)。注意,这不是完整的安装教程。

安装

安装依赖

sudo apt-get install python python-dev python-pip libffi-dev libssl-dev

安装geventpython-opensslpycryptodnslib

sudo pip install gevent --upgrade
sudo pip install pycrypto --upgrade
sudo pip install pyOpenSSL --upgrade
sudo pip install dnslib --upgrade

安装GoAgent 3.1.16

编辑install-goagent.sh

#!/usr/bin/env bash
#
# This script is used to install/uninstall goagent.
#

set -e

usage() {
	echo "Usage: $(basename $0)"
	echo "  -h, --help         Show this help"
	echo "  -i, --install      Install GoAgent"
	echo "  -u, --uninstall    Uninstall GoAgent"
}


VERSION=3.1.16
PREFIX="/usr"
DISTDIR="${PREFIX}/share/goagent"

_install() {
	local TMPDIR=$(mktemp -d /tmp/goagent-XXXXXXXX)
	pushd "${TMPDIR}" >/dev/null
	echo "Downloading GoAgent..."
	wget -q "https://github.com/goagent/goagent/archive/v${VERSION}.tar.gz"
	echo "Installing..."
	tar -zxf "v${VERSION}.tar.gz"
	cd "goagent-${VERSION}/"
	install -Dm755 "local/proxy.py" "${DISTDIR}/local/goagent"
	install -Dm755 "local/dnsproxy.py" "${DISTDIR}/local/dnsproxy.py"
	install -Dm644 "local/proxy.pac" "${DISTDIR}/local/proxy.pac"
	install -Dm644 "local/cacert.pem" "${DISTDIR}/local/cacert.pem"
	install -Dm644 "local/dnslib-0.8.3.egg" "${DISTDIR}/local/dnslib-0.8.3.egg"
	if [ -f "${DISTDIR}/local/goagent.ini" ]; then
		mv "${DISTDIR}"/local/goagent.ini{,.old}
		mv "${DISTDIR}"/local/goagent.user.ini{,.old}
	fi
	install -Dm644 "local/proxy.ini" "${DISTDIR}/local/goagent.ini"
	install -Dm644 "/dev/null" "${DISTDIR}/local/goagent.user.ini"
	cp -r "server" "${DISTDIR}/"
	rm "${DISTDIR}/server/uploader.bat"
	popd >/dev/null
	rm -rf "${TMPDIR}"
	echo "Done!"
}

_uninstall() {
	echo "Uninstalling GoAgent..."
	rm -rf "${DISTDIR}"
	echo "Done!"
}


# 无命令行参数时,显示帮助并退出
[[ "$#" -eq 0 ]] && usage && exit 0

TEMP=$(getopt -o hiu -l "help","install","uninstall" -n $(basename $0) -- "$@")
[[ $? -ne 0 ]] && exit 1
eval set -- "$TEMP"

while :; do
	case "$1" in
		-h|--help)
			usage
			exit 0
			;;
		-i|--install)
			_install
			exit 0
			;;
		-u|--uninstall)
			_uninstall
			exit 0
			;;
		--)
			shift
			break
			;;
	esac
done

exit 0

然后执行

chmod +x install-goagent.sh
sudo ./install-goagent.sh

服务器端

注册Google Appengine并创建appid。具体过程略。

使用下面的命令上传:

sudo python /usr/share/goagent/server/uploader.zip

客户端

配置GoAgent

编辑/usr/share/goagent/local/goagent.user.ini

[gae]
appid = ****

编辑/usr/share/goagent/local/goagent.ini

[listen]
ip = 0.0.0.0
port = 8080

配置GoAgent开机自启动

编辑/etc/rc.local,添加:

nohup python /usr/share/goagent/local/goagent >/dev/null 2>&1 &

浏览器代理配置



« Prev 计算 π
Next » 计算 e