goproxy gitlab 搭建go 私有仓库
gitlab搭建
服务器:
192.168.0.60 gitea gitlab 和 安装nginx 和 go px 代理环境
192.168.0.61 或windows 机器,作为客户端.
# vi /etc/sysconfig/network-scripts/ifcfg-ens33
# systemctl restart network
# hostnamectl set-hostname node70
# logout
192.168.0.60 安装
- 安装 nginx
作为http或者https代理域名使用# yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel wget vim# cd /usr/local/src/
# wget http://nginx.org/download/nginx-1.19.10.tar.gz
# tar xvf nginx-1.19.10.tar.gz
# cd nginx-1.19.10
# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
# make && make install
# /usr/local/webserver/nginx/sbin/nginx -v
# /usr/local/webserver/nginx/sbin/nginx # ps -ef | grep nginx
# vi /usr/local/webserver/nginx/conf/nginx.conf 修改配置文件
# 重新加载配置 /usr/local/webserver/nginx/sbin/nginx -s reload
- 添加本地https证书
nginx代理,配置ssl证书,达到https要求
放在nginx/conf/ssl目录
# cd /usr/local/webserver/nginx
# mkdir conf/ssl
# cd conf/ssl
1.创建服务器证书密钥文件 server.key:
# openssl genrsa -des3 -out server.key 1024
输入密码,确认密码,自己随便定义,但是要记住,后面会用到。
2.创建服务器证书的申请文件 server.csr
# openssl req -new -key server.key -out server.csr
输出内容为:
Enter pass phrase for root.key: ← 输入前面创建的密码
Country Name (2 letter code) [AU]:CN ← 国家代号,中国输入CN
State or Province Name (full name) [Some-State]:BeiJing ← 省的全名,拼音
Locality Name (eg, city) []:BeiJing ← 市的全名,拼音
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名
Organizational Unit Name (eg, section) []: ← 可以不输入
Common Name (eg, YOUR name) []: ← 此时不输入
Email Address []:admin@mycompany.com ← 电子邮箱,可随意填
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []: ← 可以不输入
An optional company name []: ← 可以不输入
4.备份一份服务器密钥文件
cp server.key server.key.org
5.去除文件口令
openssl rsa -in server.key.org -out server.key
6.生成证书文件server.crt
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
- 配置nginx 路由:
防止上传的时候出现错误.
nginx.conf中的http配置段中加入
# vi /usr/local/webserver/nginx/conf/nginx.conf 修改配置文件
// git.fjs.icu 是将代理的域名 和github.com类似 gitlab.comclient_max_body_size 100m;server {listen 80;server_name git.fjs.icu;listen 443 ssl;ssl_certificate ssl/server.crt;ssl_certificate_key ssl/server.key;location / {root html;proxy_pass http://192.168.0.60:5081;index index.html index.htm;}}# 重新加载配置 /usr/local/webserver/nginx/sbin/nginx -s reload
搭建gitlab服务器
挂载磁盘
https://blog.csdn.net/q610376681/article/details/88076551systemctl stop firewalld
systemctl disable firewalld
vi /etc/sysconfig/selinux
将SELINUX改为disable然后roboot重启系统
# yum -y install curl policycoreutils openssh-server openssh-clients postfix policycoreutils-python# cd /usr/local/src/# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.2.1-ce.0.el7.x86_64.rpm
# rpm -i gitlab-ce-14.2.1-ce.0.el7.x86_64.rpm
(yum install -y gitlab-ce)/opt/gitlab/bin/gitlab-ctl reconfigurevim /etc/gitlab/gitlab.rb[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
# 把注释取消然后指定新的仓库存储位置,也可以默认
git_data_dirs({ "default" => { "path" => "/data/gitlab-data" } })external_url 'http://192.168.0.60:5081'gitlab-ctl reconfigure
重启gitlab
gitlab-ctl restartvim /etc/hosts
192.168.0.60 git.fjs.icu
启动 gitlab 上传代码 创建公开仓库 , 最好是公开库吧.我觉得.
https://git.fjs.icu/
http://192.168.0.60:5081/server/go_test_1.git
go.modmodule git.fjs.icu/server/go_test_1go 1.17
go_test_1.gopackage go_test_1import "fmt"func Add() {fmt.Println("add test1")
}
上传到仓库地址,能够正常访问.
安装golang
# cd /usr/local/src
# wget https://golang.google.cn/dl/go1.17.linux-amd64.tar.gz
# tar xvf go1.17.linux-amd64.tar.gz
# vim /etc/profile
export GOROOT=/usr/local/src/go
#bin目录
export GOBIN=$GOROOT/bin
#工作目录
export GOPATH=/data/go
export PATH=$PATH:$GOPATH:$GOBIN:$GOROOTsource /etc/profile# go env -w GO111MODULE=on
# go env -w GOPROXY=https://goproxy.io,direct
# go env -w GOSUMDB=off
安装git
yum install -y git
安装 goproxy
https://goproxy.io/zh/
# mkdir /data/go/src/github.com/goproxyio -p
# cd /data/go/src/github.com/goproxyio
git clone https://github.com/goproxyio/goproxy.git
cd goproxy
make/data/go/src/github.com/goproxyio/goproxy/bin/goproxy -listen=0.0.0.0:8083 -cacheDir=/data/goproxyio -proxy https://goproxy.cn -exclude "git.fjs.icu/private"
开发机: 任意一台机器即可 windows
git config --global url.“ssh://git@git.fjs.icu”.insteadOf “https://git.fjs.icu” # 重点
go env -w GOPROXY=http://192.168.0.60:8083 #代理仓库地址
go env -w GOPRIVATE=git.fjs.icu
go env -w GOINSECURE=git.fjs.icu
go env -w GOSUMDB=off
新建另外一个文件夹
main.go
package mainimport "git.fjs.icu/server/go_test_1"func main() {go_test_1.Add()
}
go mod init
后续执行 go mod tidy
问题1:
git.fjs.icu/go_test_1: cannot find module providing package git.fjs.icu/go_test_1: unrecognized import path “git.fjs.icu/go_test_1”: parse https://git.fjs.icu/go_test_1?go-get=1: no go-import meta tags ()
注意 git.fjs.icu/go_test_1 包名 go.mod 应该 module git.fjs.icu/server/go_test_1
t3 imports
git.fjs.icu/server/go_test_1: cannot find module providing package git.fjs.icu/server/go_test_1: unrecognized import path “git.fjs.icu/server/go_test_1”: parse https://git.fjs.icu/server/go_test_1?go-get=1: no go-import meta tags (meta tag 192.168.0.60:5081/server/go_test_1 did not match import path git.fjs.icu/server/go_test_1)
go get: unrecognized import path “git.fjs.icu/server/go_test_1”: parse https://git.fjs.icu/server/go_test_1?go-get=1: no go-import meta tags (meta tag 192.168.0.60:5081/server/go_test_1 did not match import path git.fjs.icu/server/go_test_1)
问题2 :
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
host: git.fjs.icu
port: 80
https: false
gitlab-ctl restart
D:\code\src\t3>go get -v git.fjs.icu/server/go_test_1
get “git.fjs.icu/server/go_test_1”: found meta tag vcs.metaImport{Prefix:“git.fjs.icu/server/go_test_1”, VCS:“git”, RepoRoot:“http://git.fjs.icu/server/go_test_1.git”} at //git.fjs.icu/server/go_test_1?go-get=1
go: downloading git.fjs.icu/server/go_test_1 v0.0.0-20210830150334-650f8e5fd97e
git.fjs.icu/server/go_test_1
go get: added git.fjs.icu/server/go_test_1 v0.0.0-20210830150334-650f8e5fd97e
goproxy gitlab 搭建go 私有仓库相关推荐
- 使用 Gitlab 搭建 Docker 私有仓库
我们知道,gitlab 可以用来管理 git 提交的源代码,此外,gitlab 还集成了 docker registry 的功能,可以用来作为一个 docker 镜像私有仓库使用. 启用 gitlab ...
- 使用 satis 结合 gitlab 搭建 composer 私有包仓库
使用 satis 结合 gitlab 搭建 composer 私有包仓库 环境 centos 7.3 composer gitlab nginx 使用 安装 satis composer create ...
- 使用verdaccio 搭建npm私有仓库
使用verdaccio 搭建npm私有仓库 1. 为什么要搭建私有的npm仓库? 随着公司的业务越来越复杂,项目迭代速度也越来越快,那么项目间的常用的业务代码共享变得非常之有必要.但是对于公司 ...
- 搭建Maven私有仓库
内部的项目并且需要多团队协作模块化开发的时候,自然会想到搭建自己的maven私有仓库,本文主要介绍如何搭建maven私服和如何在项目中添加依赖. Maven 的远程仓库分为中央仓库和私服仓库.中央仓库 ...
- Docker容器之搭建本地私有仓库
Docker容器之搭建本地私有仓库 前言 一.首先下载registry镜像 二.在daemon.json文件中添加私有镜像仓库的地址并重启 三.创建registry容器并开放端口 四.给镜像打标签后上 ...
- 1+X 云计算运维与开发(中级)案例实战——搭建harbor私有仓库并实现主从同步
1+X 云计算运维与开发(中级)案例实战--搭建harbor私有仓库并实现主从同步 前言 思路 实操 1.(个人习惯)修改主机名,添加主机映射 2. 配置镜像加速器 3. 生成CA证书,并分发证书 4 ...
- verdaccio内网离线搭建npm私有仓库
使用场景: 前端项目的编译运行开发中报下载经常出错: 项目场景:通常我们前端项目开发搭建过程中通过npm管理前端js库,新建项目或内网开发过程中经常出现环境搭建的问题,例如常见错误Failed at ...
- 【云原生Docker系列第十篇】搭建本地私有仓库(我问青山何时老,青山问我几时闲)
文章目录 系列文章目录 前言 一.搭建本地私有仓库过程 首先下载registry镜像 在daemon.json文件中添加私有镜像仓库地址 运行registry 为镜像打标签 上传到私有仓库 列出私有仓 ...
- Docker搭建Registry私有仓库
Docker搭建Registry私有仓库 简介 私有仓库安装成功后就可以使用 docker 命令行工具对 registry 做各种操作了.然而不太方便的地方是不能直观的查看 registry 中的资源 ...
最新文章
- SQL Server数据库重命名、数据导出等若干问题
- 通知:Spring Cloud Alibaba 仓库迁移
- PHP CURL 中文说明
- forget password of WEBLOGIC user
- Aspx 页面生命周期
- C#中写入Excel
- http://www.cnblogs.com/langjt/p/4281477.html
- 在应用程序中加一个控制台
- PocketSphinx语音识别系统语言模型的训练和声学模型的改进
- asp.net常用正则表达式
- WCF项目中出现常见错误的解决方法:基础连接已经关闭: 连接被意外关闭
- 记录一些js面试题以及解法
- python线程,进程,队列和缓存
- 用java写一个用户登陆界面的代码分享
- 7 vsphere 分配许可_vCenter server 5.5中添加ESXi5.5主机并分配许可密钥
- 用python实现弹跳球游戏_使用Pygame模块制作一个跳跃的小球游戏
- VMware 安装失败解决方案,亲测有效
- java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String,toArray向下转型失败
- html5+自动播放轮播插件,15个超强的jQuery/HTML5图片轮播插件
- 11 万字的字节码编程系列合集放送(ASM、Javassist、Byte-buddy、Javaagent)