前几天安装了Gogs,感受就是没有ARM64的二进制包,导致自己要下载源码进行编译,操作有那么点复杂而且很浪费时间,虽然安装成功了,但在安装的过程中还是出了很多差错导致服务器重启后Gogs跑不起来,折腾好久还是没有弄好(能力有限)。后来又找到了Gitea
,看到下载页面里面居然有ARM64的二进制包,于是决定把Gogs换成Gitea。
以下记录安装过程中官方没有提到的操作步骤。
创建git账户
感觉这步挺重要的,之前安装Gogs就是因为没有创建好这个账户导致一系列的问题。(以下命令是网上找来的)
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
Go:安装与配置
- 安装:参考官方Go安装方法
- Go代理设置:参考地址
我使用的是设置临时环境变量:
export GOPROXY=https://goproxy.io
和export GO111MODULE=on
PostgreSQL:安装与配置
- 安装:参考官方安装方法(ubuntu)
- 创建用户:
- 进入数据库 :
sudo -u postgres psql
- 创建用户:
create user gogs with password 'gogs';
- 创建数据库:
CREATE DATABASE testdb OWNER gogs;
- 将gogs数据库的权限全部赋予gogs用户:
GRANT ALL PRIVILEGES ON DATABASE gogs TO gogs;
- 退出:
\q
- 进入数据库 :
先随便找一个不能正常显示的头像的地址在浏览器中单独打开
地址大概是这样的
https://avatars3.githubusercontent.com/u/5283258?s=60&u=17125d482bd87235abb59...
将地址中的
avatars3
依次改成avatars0
,avatars1
,avatars2
,avatars4
,avatars5
,直到有一个头像能正常显示为止(注意:如果都不能显示此方法就不适用,需找另外的方法)
按照官方的方式执行 curl -sL https://deb.nodesource.com/setup_12.x | bash -
后出现错误提示:
## Confirming "n/a" is supported...
- curl -sLf -o /dev/null 'https://deb.nodesource.com/node_12.x/dists/n/a/Release'
as n/a, is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support" heading="2" class="md-head head-2">Your distribution, identified as "n/a", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support
查出数组长度等于3的记录
db.user.find({ books: { $size: 3} })
Charles Proxy License
Charles 4.2目前是最新版,可用。
Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4
https://zhile.io/2017/07/07/charles-proxy-usage-and-license.html
Ubuntu 18.04+
sudo systemctl enable mongod.service
https://askubuntu.com/questions/61503/how-to-start-mongodb-server-on-system-start
以前网站使用的https是在腾讯云上免费申请的(1年),最近一直没关心过博客,今日一看才发现https到期了,导致网站不能正常访问。
在腾讯云上继续申请免费证书,发现一直处于待验证状态,不知道是什么原因。于是换了在freessl.org网站上申请。
在freessl.org上申请也是遇到好多问题。打开freessl.org首页,输入一级域名,点击“创建免费的SSL证书”。在点击之前freessl.org提供了两种证书:TrustAsia
和Let's Encrypt
。
freessl.org推荐的TrustAsia
,使用这个证书我一直没有通过,最后选择了Let's Encrypt
才弄成功。