VPS安装Bluesky PDS

Bluesky是一个去中心化的分散式社交系统,与 Mastodon (长毛象) 相似,不过Bluesky 自行开发的AT Protocol协议无法与 Mastodon 的 ActivityPub 互通。

同样是可自行架设的社交平台,比较特别的是 Bluesky 并不像 Mastodon 一样包含了前端网页(web),它只有提供API功能,需要专门的前端来进行登录管理。

自行部署的Bluesky服务器被称为个人数据服务器 (Personal Data Server, PDS),使用者可以在 bsky.app 网页版或 iOS、Android客户端中登录自行部署的pds服务。

pds推荐主机配置

  • 操作系统 Ubuntu 22.04
  • 内存 (RAM) 1 GB
  • CPU核心 1
  • CPU构架 amd64, arm64
  • 硬盘 20 GB SSD
  • 可服务账号数 20

VPS部署PDS实例

域名设置

pds.p9.pub为例,服务器IP为195.192.118.6

pds.p9.pub*.pds.p9.pub的A记录修改为195.192.118.6

安装pds

通过以下命令下载安装脚本

wget https://raw.githubusercontent.com/bluesky-social/pds/main/installer.sh

然后运行bash ./installer.sh来开始安装

bash ./installer.sh
* Detected supported distribution Debian 12
---------------------------------------
     Add DNS Record for Public IP
---------------------------------------

  From your DNS provider's control panel, create the required
  DNS record with the value of your server's public IP address.

  + Any DNS name that can be resolved on the public internet will work.
  + Replace example.com below with any valid domain name you control.
  + A TTL of 600 seconds (10 minutes) is recommended.

  Example DNS record:

    NAME                TYPE   VALUE
    ----                ----   -----
    example.com         A      195.192.118.6
    *.example.com       A      195.192.118.6

  **IMPORTANT**
  It's recommended to wait 3-5 minutes after creating a new DNS record
  before attempting to use it. This will allow time for the DNS record
  to be fully updated.

## 输入域名和管理员邮箱
Enter your public DNS address (e.g. example.com): pds.p9.pub
Enter an admin email address (e.g. [email protected]): [email protected]
Hit:1 http://security.debian.org/debian-security bookworm-security InRelease
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Hit:4 https://download.docker.com/linux/debian bookworm InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ca-certificates is already the newest version (20230311).
curl is already the newest version (7.88.1-10+deb12u7).
lsb-release is already the newest version (12.0-1).
lsb-release set to manually installed.
openssl is already the newest version (3.0.14-1~deb12u2).
openssl set to manually installed.
The following additional packages will be installed:
  dirmngr gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libassuan0 libjq1 libksba8 libnpth0 libonig5 pinentry-curses
Suggested packages:
  pinentry-gnome3 tor parcimonie xloadimage scdaemon pinentry-doc sqlite3-doc
The following NEW packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm jq libassuan0 libjq1 libksba8 libnpth0 libonig5 pinentry-curses sqlite3 xxd
0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 8,706 kB of archives.
After this operation, 17.8 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 libassuan0 amd64 2.5.5-5 [48.5 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 gpgconf amd64 2.2.40-1.1 [564 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 libksba8 amd64 1.6.3-2 [128 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 libnpth0 amd64 1.6-3 [19.0 kB]
Get:5 http://deb.debian.org/debian bookworm/main amd64 dirmngr amd64 2.2.40-1.1 [792 kB]
Get:6 http://deb.debian.org/debian bookworm/main amd64 gnupg-l10n all 2.2.40-1.1 [1,093 kB]
Get:7 http://deb.debian.org/debian bookworm/main amd64 gnupg-utils amd64 2.2.40-1.1 [927 kB]
Get:8 http://deb.debian.org/debian bookworm/main amd64 gpg amd64 2.2.40-1.1 [949 kB]
Get:9 http://deb.debian.org/debian bookworm/main amd64 pinentry-curses amd64 1.2.1-1 [77.4 kB]
Get:10 http://deb.debian.org/debian bookworm/main amd64 gpg-agent amd64 2.2.40-1.1 [695 kB]
Get:11 http://deb.debian.org/debian bookworm/main amd64 gpg-wks-client amd64 2.2.40-1.1 [541 kB]
Get:12 http://deb.debian.org/debian bookworm/main amd64 gpg-wks-server amd64 2.2.40-1.1 [531 kB]
Get:13 http://deb.debian.org/debian bookworm/main amd64 gpgsm amd64 2.2.40-1.1 [671 kB]
Get:14 http://deb.debian.org/debian bookworm/main amd64 gnupg all 2.2.40-1.1 [846 kB]
Get:15 http://deb.debian.org/debian bookworm/main amd64 libonig5 amd64 6.9.8-1 [188 kB]
Get:16 http://deb.debian.org/debian bookworm/main amd64 libjq1 amd64 1.6-2.1 [135 kB]
Get:17 http://deb.debian.org/debian bookworm/main amd64 jq amd64 1.6-2.1 [64.9 kB]
Get:18 http://deb.debian.org/debian bookworm/main amd64 sqlite3 amd64 3.40.1-2 [353 kB]
Get:19 http://deb.debian.org/debian bookworm/main amd64 xxd amd64 2:9.0.1378-2 [83.7 kB]
Fetched 8,706 kB in 0s (36.3 MB/s)
Selecting previously unselected package libassuan0:amd64.
(Reading database ... 36657 files and directories currently installed.)
Preparing to unpack .../00-libassuan0_2.5.5-5_amd64.deb ...
Unpacking libassuan0:amd64 (2.5.5-5) ...
Selecting previously unselected package gpgconf.
Preparing to unpack .../01-gpgconf_2.2.40-1.1_amd64.deb ...
Unpacking gpgconf (2.2.40-1.1) ...
Selecting previously unselected package libksba8:amd64.
Preparing to unpack .../02-libksba8_1.6.3-2_amd64.deb ...
Unpacking libksba8:amd64 (1.6.3-2) ...
Selecting previously unselected package libnpth0:amd64.
Preparing to unpack .../03-libnpth0_1.6-3_amd64.deb ...
Unpacking libnpth0:amd64 (1.6-3) ...
Selecting previously unselected package dirmngr.
Preparing to unpack .../04-dirmngr_2.2.40-1.1_amd64.deb ...
Unpacking dirmngr (2.2.40-1.1) ...
Selecting previously unselected package gnupg-l10n.
Preparing to unpack .../05-gnupg-l10n_2.2.40-1.1_all.deb ...
Unpacking gnupg-l10n (2.2.40-1.1) ...
Selecting previously unselected package gnupg-utils.
Preparing to unpack .../06-gnupg-utils_2.2.40-1.1_amd64.deb ...
Unpacking gnupg-utils (2.2.40-1.1) ...
Selecting previously unselected package gpg.
Preparing to unpack .../07-gpg_2.2.40-1.1_amd64.deb ...
Unpacking gpg (2.2.40-1.1) ...
Selecting previously unselected package pinentry-curses.
Preparing to unpack .../08-pinentry-curses_1.2.1-1_amd64.deb ...
Unpacking pinentry-curses (1.2.1-1) ...
Selecting previously unselected package gpg-agent.
Preparing to unpack .../09-gpg-agent_2.2.40-1.1_amd64.deb ...
Unpacking gpg-agent (2.2.40-1.1) ...
Selecting previously unselected package gpg-wks-client.
Preparing to unpack .../10-gpg-wks-client_2.2.40-1.1_amd64.deb ...
Unpacking gpg-wks-client (2.2.40-1.1) ...
Selecting previously unselected package gpg-wks-server.
Preparing to unpack .../11-gpg-wks-server_2.2.40-1.1_amd64.deb ...
Unpacking gpg-wks-server (2.2.40-1.1) ...
Selecting previously unselected package gpgsm.
Preparing to unpack .../12-gpgsm_2.2.40-1.1_amd64.deb ...
Unpacking gpgsm (2.2.40-1.1) ...
Selecting previously unselected package gnupg.
Preparing to unpack .../13-gnupg_2.2.40-1.1_all.deb ...
Unpacking gnupg (2.2.40-1.1) ...
Selecting previously unselected package libonig5:amd64.
Preparing to unpack .../14-libonig5_6.9.8-1_amd64.deb ...
Unpacking libonig5:amd64 (6.9.8-1) ...
Selecting previously unselected package libjq1:amd64.
Preparing to unpack .../15-libjq1_1.6-2.1_amd64.deb ...
Unpacking libjq1:amd64 (1.6-2.1) ...
Selecting previously unselected package jq.
Preparing to unpack .../16-jq_1.6-2.1_amd64.deb ...
Unpacking jq (1.6-2.1) ...
Selecting previously unselected package sqlite3.
Preparing to unpack .../17-sqlite3_3.40.1-2_amd64.deb ...
Unpacking sqlite3 (3.40.1-2) ...
Selecting previously unselected package xxd.
Preparing to unpack .../18-xxd_2%3a9.0.1378-2_amd64.deb ...
Unpacking xxd (2:9.0.1378-2) ...
Setting up libksba8:amd64 (1.6.3-2) ...
Setting up libnpth0:amd64 (1.6-3) ...
Setting up libassuan0:amd64 (2.5.5-5) ...
Setting up xxd (2:9.0.1378-2) ...
Setting up gnupg-l10n (2.2.40-1.1) ...
Setting up gpgconf (2.2.40-1.1) ...
Setting up libonig5:amd64 (6.9.8-1) ...
Setting up sqlite3 (3.40.1-2) ...
Setting up gpg (2.2.40-1.1) ...
Setting up gnupg-utils (2.2.40-1.1) ...
Setting up pinentry-curses (1.2.1-1) ...
Setting up gpg-agent (2.2.40-1.1) ...
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent-browser.socket → /usr/lib/systemd/user/gpg-agent-browser.socket.
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent-extra.socket → /usr/lib/systemd/user/gpg-agent-extra.socket.
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent-ssh.socket → /usr/lib/systemd/user/gpg-agent-ssh.socket.
Created symlink /etc/systemd/user/sockets.target.wants/gpg-agent.socket → /usr/lib/systemd/user/gpg-agent.socket.
Setting up libjq1:amd64 (1.6-2.1) ...
Setting up gpgsm (2.2.40-1.1) ...
Setting up dirmngr (2.2.40-1.1) ...
Created symlink /etc/systemd/user/sockets.target.wants/dirmngr.socket → /usr/lib/systemd/user/dirmngr.socket.
Setting up gpg-wks-server (2.2.40-1.1) ...
Setting up jq (1.6-2.1) ...
Setting up gpg-wks-client (2.2.40-1.1) ...
Setting up gnupg (2.2.40-1.1) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+deb12u8) ...
* Configuring Docker daemon
* Creating data directory /pds
* Creating Caddy data directory
* Creating Caddy config directory
* Creating Caddy config file
* Downloading PDS compose file
* Starting the pds systemd service
Created symlink /etc/systemd/system/default.target.wants/pds.service → /etc/systemd/system/pds.service.
* Downloading pdsadmin
========================================================================
PDS installation successful!
------------------------------------------------------------------------

Check service status      : sudo systemctl status pds
Watch service logs        : sudo docker logs -f pds
Backup service data       : /pds
PDS Admin command         : pdsadmin

Required Firewall Ports
------------------------------------------------------------------------
Service                Direction  Port   Protocol  Source
-------                ---------  ----   --------  ----------------------
HTTP TLS verification  Inbound    80     TCP       Any
HTTP Control Panel     Inbound    443    TCP       Any

Required DNS entries
------------------------------------------------------------------------
Name                         Type       Value
-------                      ---------  ---------------
pds.p9.pub              A          195.192.118.6
*.pds.p9.pub            A          195.192.118.6

Detected public IP of this server: 195.192.118.6

To see pdsadmin commands, run "pdsadmin help"

========================================================================
### 是否添加账号,这里选择y开始设置账号,选择n的话后期可以通过pdsadmin account create来添加账号
Create a PDS user account? (y/N): y   
## 设置邮箱
Enter an email address (e.g. [email protected]): [email protected]
## 设置账号名,注意格式jqx.pds.p9.pub
Enter a handle (e.g. alice.pds.p9.pub): jqx.pds.p9.pub

## 账号添加完成
Account created successfully!
-----------------------------
Handle   : jqx.pds.p9.pub
DID      : did:plc:dgsdfgas34dfpqilzhutwbtvkg
Password : qNiugTBUQ*******x7Bdwt
-----------------------------
Save this password, it will not be displayed again.

验证PDS

浏览pds地址pds.p9.pub会有以下提示

This is an AT Protocol Personal Data Server (PDS): https://github.com/bluesky-social/atproto

Most API routes are under /xrpc/

浏览https://pds.p9.pub/xrpc/_health会返回JSON格式的版本信息

{
    "version": "0.4.67"
}

新建账户

sudo pdsadmin account create

通过验证码新建用户

sudo pdsadmin create-invite-code

更新PDS

sudo pdsadmin update

登录自己部署的pds

以官方web端https://bsky.app/为例,点击登录,在服务器托管商中选择自定义,输入https://pds.p9.pub

账户填写jqx.pds.p9.pub,填入密码后登录即可使用。

设置用户识别符为自定义域名

登录web客户端后,打开设置选项,向下滚动找到更改用户识别符,在下面点击我拥有自己的域名,输入自己的域名,如p9.pub

按照提示,添加TXT记录,名为_atproto.p9.pub,内容为自己的DID值did=did:plc:dgsdfgas34dfpqilzhutwbtvkg,这个在新建用户时会提示。

设置完后点击验证DNS记录保存即可。

注意 修改完用户标识符后,登录账号就从jqx.pds.p9.pub变成p9.pub了,登录时记得用新的标识符。

参考

https://atproto.com/guides/self-hosting

https://github.com/bluesky-social/pds

发布于
标签