linux中,在在shadowsoks下怎么更新软件

在shadowsoks下怎么更新软件

先描述一下我的情况。我们学校不给大一开通校园网,我自己租用了搬瓦工的vps服务器,搭建shadowsocks,(使用ipv6地址才能连接),开始了自己悲催的上网生活。

也就是说,我所有的网络全部来源于socks代理,但是我在系统设置网络里面设置好之后,任然无法通过输入命令

sudo apt-get update

来更新软件源

使用本机自带的software updater 也总是提醒我检查网络连接。

好吧,得想办法将

sudo apt-get update

时的网络连接给转到socks代理去

google查询得知了

该文地址如下:

http://blog.ihipop.info/2011/01/1988.html?utm_source=textarea.com&utm_medium=textarea.com&utm_campaign=article

按照该文的方法配置好之后,使用proxychains4命令放在其他命令前面,可以把网络连接转到socks代理去,总算是好了。

使用

sudo proxychains4 apt-get update

的时候电脑能联网检查更新了。

但是,当我

sudo apt-get install XXXX

时又出现问题了

如下:

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/d/dpkg/dpkg-dev_1.17.5ubuntu5.5_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/b/build-essential/build-essential_11.6ubuntu6_amd64.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/f/fakeroot/libfakeroot_1.20-3ubuntu2_amd64.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/f/fakeroot/fakeroot_1.20-3ubuntu2_amd64.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/liba/libalgorithm-diff-perl/libalgorithm-diff-perl_1.19.02-3_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/liba/libalgorithm-diff-xs-perl/libalgorithm-diff-xs-perl_0.04-2build4_amd64.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/liba/libalgorithm-merge-perl/libalgorithm-merge-perl_0.08-2_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/c/chardet-whl/python-chardet-whl_2.2.1-2~ubuntu1_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/p/python-colorama/python-colorama_0.2.5-0.1ubuntu2_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/p/python-colorama/python-colorama-whl_0.2.5-0.1ubuntu2_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/d/distlib/python-distlib_0.1.8-1ubuntu1_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/d/distlib/python-distlib-whl_0.1.8-1ubuntu1_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/h/html5lib/python-html5lib_0.999-3~ubuntu1_all.deb Size mismatch


Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/h/html5lib/python-html5lib-whl_0.999-3~ubuntu1_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/s/six/python-six-whl_1.5.2-1ubuntu1_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/p/python-urllib3/python-urllib3-whl_1.7.1-1ubuntu4_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/r/requests/python-requests-whl_2.2.1-1ubuntu0.3_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/p/python-setuptools/python-setuptools-whl_3.3-1ubuntu2_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/p/python-pip/python-pip-whl_1.5.4-1ubuntu3_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/p/python-setuptools/python-setuptools_3.3-1ubuntu2_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/universe/p/python-pip/python-pip_1.5.4-1ubuntu3_all.deb Size mismatch

Failed to fetch http://cn.archive.ubuntu.com/ubuntu/pool/main/w/wheel/python-wheel_0.24.0-1~ubuntu1_all.deb Size mismatch

密密麻麻一片错误信息看着就心慌,仔细看一下也许也不是没有解决办法,错误信息里面把安装包的位置都说出来了,

那么,我们用

proxychains wget url 

将安装包下载后再安装就是了(将url替换成错误信息里面的网址)

那么多文件,一个一个下载太麻烦了,弄一些小动作:

vim down.sh

按 I 进入插入模式

将上面包涵网址的错误信息全部复制下来,粘贴到down.sh里面去,把Failed to fetch全部替换成wget ,把末尾的 Size mismatch 删除。

执行

chmod +x down.sh

proxychians4 ./down.sh

就会依次下载各个需要的安装包了。

使用

dpkg -i 包名

就可以安装了,包名就是你下载好的deb文件的全部文件名

再处理一下刚才的down.sh文件,文件内容改成这样:

dpkg -i dpkg-dev_1.17.5ubuntu5.5_all.deb

dpkg -i build-essential_11.6ubuntu6_amd64.deb

dpkg -i libfakeroot_1.20-3ubuntu2_amd64.deb

dpkg -i fakeroot_1.20-3ubuntu2_amd64.deb

dpkg -i libalgorithm-diff-perl_1.19.02-3_all.deb

dpkg -i libalgorithm-diff-xs-perl_0.04-2build4_amd64.deb

dpkg -i libalgorithm-merge-perl_0.08-2_all.deb

dpkg -i python-chardet-whl_2.2.1-2~ubuntu1_all.deb

dpkg -i python-colorama_0.2.5-0.1ubuntu2_all.deb

dpkg -i python-colorama-whl_0.2.5-0.1ubuntu2_all.deb

dpkg -i python-distlib_0.1.8-1ubuntu1_all.deb

dpkg -i python-distlib-whl_0.1.8-1ubuntu1_all.deb

dpkg -i python-html5lib_0.999-3~ubuntu1_all.deb

dpkg -i python-html5lib-whl_0.999-3~ubuntu1_all.deb

dpkg -i python-six-whl_1.5.2-1ubuntu1_all.deb

dpkg -i python-urllib3-whl_1.7.1-1ubuntu4_all.deb

dpkg -i python-requests-whl_2.2.1-1ubuntu0.3_all.deb

dpkg -i python-setuptools-whl_3.3-1ubuntu2_all.deb

dpkg -i python-pip-whl_1.5.4-1ubuntu3_all.deb

dpkg -i python-setuptools_3.3-1ubuntu2_all.deb

dpkg -i python-pip_1.5.4-1ubuntu3_all.deb

dpkg -i python-wheel_0.24.0-1~ubuntu1_all.deb

 然后执行
sudo ./down.sh
等待安装完成就好了。
 
PS:这些安装示范是我安装python-pip的时候用的。
文章首发在:
https://www.textarea.com/suppermary/zai-shadowsoks-xia-zenme-gengxin-ruanjian-559/
posted @ 2016-03-06 12:35  SupperMary  阅读(1083)  评论(0编辑  收藏  举报