標籤:

ss和gitlab的配置

ss的配置

伺服器端

shadowsocks的安裝其實很簡單,安裝好debian8之後在root下:

apt-get install python-pipnpip install shadowsocksn

在後台運行(同樣需要root):

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

遠程編輯/etc/shadowsocks/config.json文件的內容為:

{nt"server":"0.0.0.0",nt"server_port":8388,nt"local_address": "127.0.0.1",nt"local_port":1080,nt"password":"password",nt"timeout":300,nt"method":"aes-256-cfb",nt"fast_open": falsen}n

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

開機啟動

開機啟動由於debian8使用了新的systemd,直接編輯/etc/rc.local不可。編輯完/etc/rc.local後,修改/etc/systemd/system/rc-local.service

[Unit]nDescription=/etc/rc.local Compatibilitynn[Service]nType=oneshotnExecStart=/etc/rc.localnTimeoutSec=0nStandardInput=ttynRemainAfterExit=yesnn[Install]nWantedBy=multi-user.targetn

然後

sudo systemctl enable /etc/systemd/system/rc-local.servicensudo systemctl start rc-local.servicen

本地端

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

sudo aptitude install shadowsocksn

本地編輯/etc/shadowsocks/config.json文件的內容為:

{n "server":"xxx.xxx.xxx.xxx",n "server_port":8388,n "local_address": "127.0.0.1",n "local_port":1080,n "password":"password",n "timeout":300,n "method":"aes-256-cfb",n "fast_open": false,n "workers": 1n}n

然後運行

sslocal -c /etc/shadowsocks/config.jsonn/usr/bin/chromium --proxy-server="socks5://127.0.0.1:1080"n

同樣可以讓它自啟動。

參考:

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

求助:Archlinux在轉向systemd之後,如何開機自啟動自定義腳本?(已解決!)

Configure Multiple Users · shadowsocks/shadowsocks Wiki · GitHub

shadowsocks的多用戶配置

{

"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.gitn

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 postfixn

2. Add the GitLab package server and install the package

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bashnsudo apt-get install gitlab-cen

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 reconfiguren

4. Browse to the hostname and login

Username: root

Password: 5iveL!fe

然後會在添加SSH key 的時候出現500錯誤。經查發現是調用ssh的時候無法分配足夠內存而出錯。因而給伺服器的系統增加一個swapfile。

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

dd if=/dev/zero of=/swapfile bs=2048k count=1000nmkswap /swapfilenswapon /swapfilenswapon -snchown root:root /swapfilenchmod 0600 /swapfilenecho 10 | sudo tee /proc/sys/vm/swappinessnecho vm.swappiness = 10 | sudo tee -a /etc/sysctl.confn

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

add this line :

/swapfile none swap sw 0 0n

然後去網頁上看,發現clone地址裡面還有http://gitlab.example.com。於是修改/var/opt/gitlab/gitlab-rails/etc/gitlab.yml,將host哪一行改成機器的IP。然後在本地運行:

git remote add gitlab git@xxx.xxx.xxx.xxx:yx_wh/manga-translation.gitn

並試圖 git push gitlab master,但是失敗,系統詢問我git的用戶密碼。於是進入伺服器的/var/opt/gitlab/.ssh ,刪除authorized_keys.lock並保證許可權正確。

最後終於push成功。

參考:

Download GitLab Community Edition (CE)

Gitlab 500 error when adding/removing SSH key

GitLab git user password


推薦閱讀:

如何優雅地使用 Git?
一個奇怪的git問題,求大家幫忙分析一下?
【開源必備】常用git命令

TAG:Git |