西西河

主题:shadowsocks的配置(2016年) -- 杨微粒

共:💬8 🌺14 新:
全看分页树展 · 主题
家园 shadowsocks的配置(2016年)

ss的配置

服务器端

shadowsocks的安装其实很简单,安装好debian8之后在root下:

apt-get install python-pip

pip install shadowsocks

在后台运行(同样需要root):

ssserver -p 8388 -k password -m aes-256-cfb --user nobody -d start

远程编辑/etc/shadowsocks/config.json文件的内容为:

{

"server":"0.0.0.0",

"server_port":8388,

"local_address": "127.0.0.1",

"local_port":1080,

"password":"password",

"timeout":300,

"method":"aes-256-cfb",

"fast_open": false

}

sudo /usr/local/bin/ssserver -c /etc/shadowsocks/config.json -d start

开机启动

开机启动由于debian8使用了新的systemd,直接编辑/etc/rc.local不可。编辑完/etc/rc.local后,修改/etc/systemd/system/rc-local.service

[Unit]

Description=/etc/rc.local Compatibility

[Service]

Type=oneshot

ExecStart=/etc/rc.local

TimeoutSec=0

StandardInput=tty

RemainAfterExit=yes

[Install]

WantedBy=multi-user.target

然后

sudo systemctl enable /etc/systemd/system/rc-local.service

sudo systemctl start rc-local.service

本地端

我的本地也是debian8。安装shadowsocks:

sudo aptitude install shadowsocks

本地编辑/etc/shadowsocks/config.json文件的内容为:

{

"server":"xxx.xxx.xxx.xxx",

"server_port":8388,

"local_address": "127.0.0.1",

"local_port":1080,

"password":"password",

"timeout":300,

"method":"aes-256-cfb",

"fast_open": false,

"workers": 1

}

然后运行

sslocal -c /etc/shadowsocks/config.json

/usr/bin/chromium --proxy-server="socks5://127.0.0.1:1080"

同样可以让它自启动。

参考:

shadowsocks/README.md at master · shadowsocks/shadowsocks · GitHub

https://github.com/shadowsocks/shadowsocks/blob/master/README.md

求助:Archlinux在转向systemd之后,如何开机自启动自定义脚本?(已解决!)

http://forum.ubuntu.org.cn/viewtopic.php?f=155&t=395231

Configure Multiple Users · shadowsocks/shadowsocks Wiki · GitHub

https://github.com/shadowsocks/shadowsocks/wiki/Configure-Multiple-Users

shadowsocks的多用户配置(死链接)

http://everet.org/shadowsocks.html

{

"server": "0.0.0.0",

"port_password": {

"8381": "foobar1",

"8382": "foobar2",

"8383": "foobar3",

"8384": "foobar4"

},

"timeout": 300,

"method": "aes-256-cfb"

}

文档中的这种写法使用软件源里面的ss2.1.0是不行的。需要新版ss。

git clone https://github.com/mengskysama/shadowsocks-rm.git

gitlab的安装

首先按照官方教程来,在服务器上运行以下操作:

1. Install and configure the necessary dependencies

If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail orconfigure a custom SMTP server. If you wish to use Exim, please configure it as an SMTP server.

On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.

sudo apt-get install curl openssh-server ca-certificates postfix

2. Add the GitLab package server and install the package

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

sudo apt-get install gitlab-ce

If you are not comfortable installing the repository through a piped script, you can find the entire script here.

3. Configure and start GitLab

sudo gitlab-ctl reconfigure

4. Browse to the hostname and login

Username: root

Password: 5iveL!fe

然后会在添加SSH key 的时候出现500错误。经查发现是调用ssh的时候无法分配足够内存而出错。因而给服务器的系统增加一个swapfile。

You need to create a swap file. Try the following steps to see if this works:

dd if=/dev/zero of=/swapfile bs=2048k count=1000

mkswap /swapfile

swapon /swapfile

swapon -s

chown root:root /swapfile

chmod 0600 /swapfile

echo 10 | sudo tee /proc/sys/vm/swappiness

echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf

If this works you can make it permanent by editing the following file: #nano /etc/fstab

add this line :

/swapfile none swap sw 0 0

然后去网页上看,发现clone地址里面还有http://gitlab.example.com。于是修改/var/opt/gitlab/gitlab-rails/etc/gitlab.yml,将host哪一行改成机器的IP。然后在本地运行:

git remote add gitlab [email protected]:yx_wh/manga-translation.git

并试图 git push gitlab master,但是失败,系统询问我git的用户密码。于是进入服务器的/var/opt/gitlab/.ssh ,删除authorized_keys.lock并保证权限正确。

最后终于push成功。

参考:

Download GitLab Community Edition (CE)

https://about.gitlab.com/installation/

Gitlab 500 error when adding/removing SSH key

https://stackoverflow.com/questions/26777690/gitlab-500-error-when-adding-removing-ssh-key

GitLab git user password

https://stackoverflow.com/questions/15495843/gitlab-git-user-password

编辑于 2016-05-27

关键词(Tags): #科学上网#nano
全看分页树展 · 主题


有趣有益,互惠互利;开阔视野,博采众长。
虚拟的网络,真实的人。天南地北客,相逢皆朋友

Copyright © cchere 西西河