安装流程
- 安装Golang
- 安装Leanote
- 安装Mongodb
- 配置Leanote
- 初始化Mongodb数据
- 运行Leanote
安装Golang
# 下载go1.14.4.linux-amd64.tar.gz,官网地址:http://golang.org (百度云有)
下载go1.14.4.linux-amd64.tar.gz
# 解压
sudo tar -xzvf go1.6.linux-amd64.tar.gz -C /usr/local/go
# 创建gopackage
sudo mkdir -p /usr/local/gopackage
# 添加环境变量
sudo vim /etc/profile
# 添加以下内容
export GOROOT=/usr/local/go
export GOPATH=/usr/local/gopackage
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
# 更新环境变量
source /etc/profile
# 检查安装
go version
安装Leanote
# 获取源码包(百度云有)
wget https://github.com/leanote/leanote-all/archive/master.zip
# 解压并把src移动到gopackage目录
unzip master.zip
cp -r ./leanote-all-master/src /usr/local/gopackage
# 安装revel(用于运行Leanote)
go install github.com/revel/cmd/revel
安装Mongodb
1. 导入MongoDB公共GPG密钥
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
2. 安装gnupg
$ aptitude search gnupg;
$ sudo aptitude install gnupg
3. 重新导入密钥
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
4. 创建list文件夹
$ sudo mkdir -p /etc/apt/sources.list.d/;
5. 创建list文件
$ echo "deb https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
6. 更新资源列表
$ sudo aptitude update
7. 安装MongoDB
$ sudo aptitude install -y mongodb-org
8. 启动MongoDB
$ sudo systemctl daemon-reload;
$ sudo systemctl start mongod;
$ sudo systemctl enable mongod;
$ sudo systemctl status mongod
9. 链接MongoDB
$ mongo
10. 卸载教程
sudo systemctl stop mongod
sudo aptitude remove mongodb-org
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
配置Leanote
vi /usr/local/gopackage/src/github.com/leanote/leanote/conf/app.conf
# 修改以下内容:
app.secret=testops.top # 任意内容
http.port=9000 # 根据需要设置,注意防火墙
site.url=http://Host IP:Port # 必须设置,否则图片无法在不同设备同步
初始化MongoDB数据
mongorestore -h localhost -d leanote --dir /home/$USER/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data/
运行Leanote
revel run github.com/leanote/leanote