1. 安装docker
![](https://img.haomeiwen.com/i35360/b66b4a00526641f4.png)
![](https://img.haomeiwen.com/i35360/8aa18a618b9e0287.png)
2.安装docker-compos
curl -L "https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
3.验证
![](https://img.haomeiwen.com/i35360/7c41d2c616093bf0.png)
4.启动docker并设置开机自启动
![](https://img.haomeiwen.com/i35360/93bcc096809b9ac9.png)
5. 安装nginx
![](https://img.haomeiwen.com/i35360/0ad3b75e90c29284.png)
6. 拉取mastodon docker镜像
![](https://img.haomeiwen.com/i35360/41c8f1faa790bb6f.png)
7. 拉取代码(主要是docker-compose.yml)
直接拉取:
git clone https://github.com/tootsuite/mastodon.git --progress --verbose
断点续传方式:(推荐)
git init
git fetch https://github.com/tootsuite/mastodon.git
8. #SECRET_KEY_BASE设定
sed -i "s/SECRET_KEY_BASE=$/&$(docker-compose run --rm web bundle exec rake secret)/" .env.production
9. #OTP_SECRET设定
sed -i "s/OTP_SECRET=$/&$(docker -compose run --rm web bundle exec rake secret)/" .env.production
10. #获取vapid keys
将以下指令获取的密钥复制至.ENV.PRODUCTION的OTP_SECRET选项下方:
docker-compose run --rm web bundle exec rake mastodon:webpush:generate_vapid_key
![](https://img.haomeiwen.com/i35360/58106000f4fbd696.png)
![](https://img.haomeiwen.com/i35360/d88f0f64fbfdbc8e.png)
11. 设置public、elasticsearch文件夹权限:
chown -R 991:991 public
/workspace/mastodon/elasticsearch 目录需要777权限,否则es一直重启
chmod -R 777 elasticsearch
12. 启动数据库:
docker-compose run --rm web bundle exec rake db:migrate
13. 启动MASTODON实例
docker-compose up -d
![](https://img.haomeiwen.com/i35360/ebe6940fd8c93aa1.png)
14. 创建管理员账户
docker-compose run --rm web tootctl accounts create k1ic --email k1ic234@163.com --confirmed --role admin
15. 从浏览器访问
![](https://img.haomeiwen.com/i35360/9191e1ed88c348d4.png)
参考:
常见长毛象站点一览
https://instances.social/list/old
与 Mastodon 相关的内容精选清单
https://asmcn.icopy.site/awesome/awesome-mastodon/
https://kaedemochi.blogspot.com/2020/08/dockermastodon.html
https://pullopen.github.io/%E5%9F%BA%E7%A1%80%E6%90%AD%E5%BB%BA/2020/10/19/Mastodon-on-Docker.html
https://pullopenbluebox.wordpress.com/2020/06/07/mastodon-self-instance/
https://pullopen.github.io/2020/07/19/How-to-build-a-mastodon-instance.html
https://www.dazhuanlan.com/2020/02/29/5e597c54a13ac/
https://blog.kaede.im/2020/08/dockermastodon.html
https://blog.dann.top/archives/14
http://wap.mail.163.com/xm/static/html/163_symbian_2.html
网友评论