跳转到主要内容

bt-panel

教学环境为 Ubuntu 20.04

在 Linux BT 面板下安装 Casnode

准备工作

安装完BT面板后,浏览器访问BT面板,选择软件商店,搜索并安装MySQL,然后搜索node,可以看到有一个PM2管理器,安装PM2管理器

安装完成后,断开服务器或重启服务器,node会自动写入环境变量。

输入 git --version 以确保git 安装和git的版本, 如果没有找到提示命令 git ,请使用 apt-get 安装 git 来安装git。

要成功访问Casnode ,您需要打开 70018000 端口。 :::

安装 Golang

root用户执行以下命令将 Go 二进制文件下载并解压到 /usr/local目录。

wget -c https://dl.google.com/go/go.16.5.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local

Then we need to add Golang to the environment variables, edit /etc/profile, add the following code in the last line of the file.

导出 GOROOT=/usr/local/go
导出 PATH=$PATH:$GOROOT/ bin

Then use command source /etc/profile to make the newly added environment variables work.

Now, enter go version, you will see the go version, and we installed it successfully. If you can’t connect to GitHub, you can set up the mirror. The command is

go env -w GOPROXY=https://goproxy.cn,direct

Git clone Casnode & Casdoor

Next, execute the following commands in the folder where you want to store the project.

git clone https://github.com/casbin/casdoog.git
git clone https://github.com/casbin/casnode.git

Now, you can see there are two folders, Casnode and Casdoor.


配置 Cassdoor

运行Casdoor

We first configure Casdoor.

cd casdoor
go build main.go

Then edit conf/app.conf, find

dataSourceName = root:123@tcp(localhost:3306)/

Change MySQL password provided by the BT panel as 123.

cd web
npm install
npm building
cd ...
sudo nohup ./main &

配置 Casdoor 中的 Casnode

Now that Casdoor has been configured, visit http://your-ip:8000 to configure Casnode.

The default administrator login account is admin/123.

Click Organization, then click Add, click Edit for the added organization, and change the name to the organization name you want. Here I set it to casbin-forum, and then click Save.

Click Applications, then click Add, for the application you just added, click Edit, change the name to the application name you want, I changed it to app-casbin-forum. Click on the organization, select the organization you just added, my organization is casbin- forum. Click Redirect URLs, modify the link in the box to http://your-ip:7000/callback.Finally, remember the Client ID and Client Secret, and click Save.

Click Users, click Add, then click Edit, modify the added user, click Organization, select casbin-forum, and click is admin. Finally click Save, now your organization has an administrator account.


配置 Casnode

Next we configure in Casnode.

cd casnode
go build main.go

Edit conf/app.conf, find

dataSourceName = root:123@tcp(localhost:3306)/

Change MySQL password provided by the BT panel to 123, then find casdoorEndpoint, modify it to http://your-ip:8000 (Casdoor backend address), find ClientId and ClientSecret, and modify them to the previously remembered Application client id and client secret, find casdoorOrganization, modify the organization name to your set. Save and exit.

Edit web/src/Conf.js, modify serverUrl to http://your-ip:8000 (Casdoor front-end access address), modify ClientId to the ClientId of the application just added, modify appName to the set application name, and modify organizationName to the set organization name.

npm install
npm run build
cd ..
nohup ./main &

Next visit http://your-ip:7000, click login, enter the account you added before, user_1/123, you have now successfully logged in to Casnode.

For more settings please see Casnode.