CentOS 7 安装 GitLab

https://about.gitlab.com/downloads/#centos7
国内镜像:
https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/
vi /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

sudo yum makecache
sudo yum install gitlab-ce

vi /etc/gitlab/gitlab.rb
external_url 'http://localhost' 修改为自己的IP地址或域名
如external_url 'http://testgitlab'

sudo gitlab-ctl reconfigure

在浏览器中访问http://testgitlab/,会自动跳转到root账户密码重置页面,输入新密码,登陆

CentOS 7 安装 GateOne

https://pip.pypa.io/en/latest/installing/
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

pip install 'tornado>2.4,<2.5'
or
pip install 'tornado==2.4.1'

pip install Pillow

wget https://github.com/downloads/liftoff/GateOne/gateone-1.1.tar.gz
tar -zxvf gateone-1.1.tar.gz
cd GateOne
python setup.py install

cd /opt/gateone
./gateone.py

如果你想让其后台运行
systemctl start gateone

开机自动启动服务
systemctl enable gateone

查看操作记录(需会话结束之后才能显示):
/opt/gateone/logviewer.py /opt/gateone/users/ANONYMOUS/logs/20161130103312565927.golog
直接访问:
出于安全性考虑,最好修改一下端口和URL后缀
vi /opt/gateone/server.conf
port = xxx
url_prefix = "/xxx/"
"log_file_max_size": 104857600 // Which is the result of: 100 * 1024 * 1024 = 100MB
"log_file_num_backups": 10 // The maximum number of backups to keep of Gate One's web server logs.

若出现Access denied for origin
vi /opt/gateone/server.conf
在 origins = 行引号中追加 ;https://服务器当前IP地址或域名:端口
session_timeout = "20m"

防火墙放行
iptables -I INPUT -p tcp --dport 端口 -j ACCEPT
通过Nginx访问:
vi /opt/gateone/server.conf
#不允许外网访问GateOne
address = "127.0.0.1"
#禁用自带证书
disable_ssl = True
#要与Nginx转发端口一致
port=10443
#要与Nginx路径一致
url_prefix="/gateone/"
#允许使用Nginx listen port端口登录
origins = "...;http://127.0.0.1:nginxport"
session_timeout = "20m"

使用Basic HTTP Authentication:
yum install httpd-tools
htpasswd -c /etc/nginx/.htpasswd_gateone gateone
# 输入8位密码

vi /etc/nginx/conf.d/default.conf
server {
...
	# GateOne
	# 与GateOne中的url_prefix要一致
	location /gateone/ {
            auth_basic "Private Property";
            auth_basic_user_file /etc/nginx/.htpasswd_gateone;

	    #与GateOne中的port要一致
	    proxy_pass http://127.0.0.1:10443;

	    proxy_redirect off;
	    proxy_pass_header Server;
	    proxy_set_header Host $http_host;
	    proxy_set_header X-Real-IP $http_address;
	    proxy_set_header X-Scheme $scheme;

	    proxy_http_version 1.1;
	    proxy_set_header Upgrade $http_upgrade;
	    proxy_set_header Connection "upgrade";
	}
}

MinGW 编译 libCurl

Win32 - Generic curl-7.50.3.zip
https://curl.haxx.se/download.html

解压
编译libcurl
cd lib
mingw32-make -f Makefile.m32

编译curl
cd src
mingw32-make -f Makefile.m32

复制 include\curl 到项目目录
复制 lib 目录下 libcurl.a libcurldll.a libcurl.dll 到项目 lib 目录下

修改Clion输出目录 Setting - Build - CMake,Build output path: bin
拷贝 libcurl.dll 到 bin/Debug

测试程序
#include 
#include "include/curl/curl.h"

using namespace std;

int main(int argc, char * argv[])
{
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "https://www.xxx.com/");
        //curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
        //curl_easy_setopt(curl, CURLOPT_PROXY, "10.59.77.11:8118");
        res = curl_easy_perform(curl);

        if(CURLE_OK == res) {
            char *ct;
            /* ask for the content-type */
            res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);

            if((CURLE_OK == res) && ct)
                printf("We received Content-Type: %s\n", ct);
        }

        /* always cleanup */
        curl_easy_cleanup(curl);
    }

    cout << endl;
    system("pause");
    return 0;
}


编译libcurl-7.50.3 with openssl-1.0.2j,use tdm-gcc-5.1.0-3 and git bash 2.9.0_x64
http://www.stringcat.com/company_blog/2015/12/07/compiling-openssl-on-windows-mingw32/
Requirements
1、perl http://www.activestate.com/activeperl
perl -v

2、Mingw32
gcc -v

3、GNU make
make -v
或
mingw32-make -v

4、tar
tar --version

Dynamic link libraries
cd openssl-1.0.2j
1.perl Configure mingw shared
it should do some stuff ( a minute or so) and should end with something like:
Configured for mingw.

2.
./config -t
./config threads shared
复制 mingw32-make 为 make
make depend

make
或
mingw32-make
会生成 libcrypto.a libssl.a libssl.dll.a libcrypto.dll.a 这四个文件和相应的dll文件

把libssl.dll.a libcrypto.dll.a拷贝到out文件夹里,重命名为"libssl32.a" "libeay32.a"
再次把libssl.dll.a libcrypto.dll.a拷贝到out文件夹里,重命名为"libssl.a" "libcrypto.a"

cd zlib-1.2.8
cp win32/makefile.gcc makefile.gcc
mingw32-make -f makefile.gcc

cd curl-7.50.3/lib
修改Makefile.m32
OPENSSL_PATH = ../../openssl-1.0.2j
ZLIB_PATH = ../../zlib-1.2.8

mingw32-make -f Makefile.m32 SSL=1 ZLIB=1

cd curl-7.50.3/src
修改Makefile.m32
OPENSSL_PATH = ../../openssl-1.0.2j
ZLIB_PATH = ../../zlib-1.2.8

mingw32-make -f Makefile.m32 SSL=1 ZLIB=1

MinGW使用-lxxx来链接库的时候,搜索库的顺序如下:
libxxx.dll.a 
xxx.dll.a 
libxxx.a 
cygxxx.dll (*) 
libxxx.dll 
xxx.dll

把 curl-7.50.3\lib\libcurldll.a 拷贝到项目 lib 目录下并引入
把 openssl-1.0.2j 目录下 libeay32.dll ssleay32.dll 拷贝到项目输出目录下
把 zlib-1.2.8 目录下 zlib1.dll 拷贝到项目输出目录下