Pleroma:支持ActivityPub的社交网络服务器-荒岛

/ 2019-08-21 16:13

Pleroma支持ActivityPub,这意味着可以和Mastodon/Misskey上的用户进行互动。

Pleroma的特点是:高性能/内存使用率低,低配置的机器有福了,跑不了Mastodon可以换用Pleroma。而且喜欢小巧/紧凑风格的人,应该会非常喜欢Pleroma的前端和一系列主题。

以下安装步骤基于Debian10。首先安装全部需要用到的软件/依赖:

apt -y install build-essential git nginx certbot python-certbot-nginx \     postgresql postgresql-contrib elixir erlang-inets erlang-dev erlang-tools \     erlang-parsetools erlang-eldap erlang-ssh erlang-xmerl

新建一个不允许登录shell的用户:

useradd -r -s /bin/false -m -d /var/lib/pleroma -U pleroma

拉取项目文件:

mkdir -p /opt/pleroma     chown -R pleroma:pleroma /opt/pleroma     sudo -u pleroma git clone -b master https://git.pleroma.social/pleroma/pleroma /opt/pleroma     cd /opt/pleroma

安装依赖:

sudo -u pleroma mix deps.get

生成配置文件:

sudo -u pleroma mix pleroma.instance gen

流程(需要自己改动的就下面这几个):

What domain will your instance use? (e.g pleroma.soykaf.com) []  pleroma.koko.cat     What is the name of your instance? (e.g. Pleroma/Soykaf) []  Pleroma/imlala          What is your admin email address? []  1062951199@qq.com     What email address do you want to use for sending email notifications? [1062951199@qq.com]       Do you want search engines to index your site? (y/n) [y] 

后面这些全部回车保持默认即可:

Do you want to store the configuration in the database (allows controlling it from admin-fe)? (y/n) [n]        What is the hostname of your database? [localhost]       What is the name of your database? [pleroma]       What is the user used to connect to your database? [pleroma]       What is the password used to connect to your database? [autogenerated]       Would you like to use RUM indices? [n]       What port will the app listen to (leave it if you are using the default setup with nginx)? [4000]       What ip will the app listen to (leave it if you are using the default setup with nginx)? [127.0.0.1]       What directory should media uploads go in (when using the local uploader)? [uploads]       What directory should custom public files be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)? [instance/static/]

将生成好的配置文件重命名:

mv config/generated_config.exs  config/prod.secret.exs

导入数据库:

sudo -u postgres psql -f config/setup_db.psql

执行数据库迁移:

sudo -u pleroma MIX_ENV=prod mix ecto.migrate

复制systemd服务文件:

cp /opt/pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service

启动pleroma:

systemctl start pleroma.service     systemctl enable pleroma.service

新建Nginx反代配置文件:

nano /etc/nginx/conf.d/pleroma.conf

写入:

server {         listen       80;         server_name  pleroma.koko.cat;         client_max_body_size 100M;              location / {             proxy_http_version 1.1;             proxy_set_header Upgrade $http_upgrade;             proxy_set_header Connection "upgrade";             proxy_set_header Host $http_host;             proxy_pass http://127.0.0.1:4000;         }     }

签发SSL证书:

certbot --nginx --agree-tos --no-eff-email

现在打开你的域名,应该能看到Pleroma的首页:

回到终端创建管理员账号:

sudo -u pleroma MIX_ENV=prod mix pleroma.user new imlala 1062951199@qq.com --admin

说实话,我还真的是更喜欢Pleroma的风格,Mastodon的界面给人感觉太宽阔了,给人一种空洞的感觉,而Pleroma就有点小家碧玉的味道:

最后还是要简单测试一下ActivityPub,在我的Mastodon实例内可以搜索到Pleroma的用户:

Shared via Inoreader