Skip to main content

bt-panel

:::注意 チュートリアル環境はUbuntu 20.04
:::

LinuxBTパネルにCasnodeをインストールします

作業の準備

BTパネルをインストールした後、ブラウザはBTパネルを訪問し、ソフトウェアストアを選択し、MySQLを検索し、インストールします。 ノードを検索するとPM2マネージャーがいて PM2マネージャーがインストールされていることがわかります

インストールが完了すると、サーバから切断するか、サーバを再起動すると、環境変数にノードが自動的に書き込まれます。

Enter git --version to make sure git is , if the prompts Command git not found, use apt-get install git to install git.

Casnodeにアクセスするには、 70018000 ポートを開く必要があります。 :::

Install Golang

rootユーザーは、 /usr/local ディレクトリへバイナリファイルをダウンロードして解凍するために以下のコマンドを実行します。

wget -c https://dl.google.com/go/go1.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.

export GOROOT=/usr/local/go
export 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/casdoor.git
git clone https://github.com/casbin/casnode.git

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


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 run build
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.