
官方文档
https://docs.pixelfed.org/running-pixelfed/installation.html
先决条件
apache nginx
php8.1
mysql5.7
redis7
宝塔面板里这些都可以提前安装好
添加网站申请好SSL
禁中php函数
putenv
symlink()
proc_open
pcntl_signal
ssh连后cd网站目录 以下命令拉仓库
git clone -b dev https://github.com/pixelfed/pixelfed.git pixelfed
拉取上一个版本(可选)最新的版本有很多BUG v0.11.12是版本号可以在作者github查看
git clone -b v0.11.12 https://github.com/pixelfed/pixelfed.git pixelfed
给用户和目录权限
cd pixelfedsudo chown -R www:www .sudo find . -type d -exec chmod 755 {} \;sudo find . -type f -exec chmod 644 {} \;
提前安装好composer
curl -sS https://getcomposer.org/installer | phpmv composer.phar /usr/bin/composer
以下命令会自动安装需要的依赖
composer install --no-ansi --no-interaction --optimize-autoloader
官司文档里,让复制.env.example改名.env
cp .env.example .env
但是最新版没有这个档案
从这里复制.env.example全部内容替换.env里的全部内容
https://github.com/pixelfed/pixelfed/blob/v0.11.12/.env.example
将数据库 域名 redis的密码都配置好后 执行以下命令
生成APP_KEY
php artisan key:generate
链接到应用程序目录
php artisan storage:link
导入数据库
php artisan migrate --force
启用对位置数据的支持
php artisan import:cities
如果在.env里启用了ActivityPub
php artisan instance:actor
如果在.env启用了 OAuth
php artisan passport:keys
缓存路由
php artisan route:cachephp artisan view:cache
每次改.env需要执行一次
php artisan config:cache
编辑网站配置文件将目录后面加上/public
这个时候应该是可以通过域名访问网站了 注册一个帐户先
用以下命令提升帐号为管理员
php artisan user:admin 帐号
php artisan horizon:installphp artisan horizon:publish
以下二选一
1.去这个目录
/etc/systemd/system/
添加新建档案pixelfed.service
复制以下内容粘上
[Unit]Description=Pixelfed task queueing via Laravel HorizonAfter=network.targetRequires=mysqld.serviceRequires=php-fpm-81.serviceRequires=redis.serviceRequires=httpd.service
[Service]Type=simpleExecStart=/usr/bin/php /www/wwwroot/你的域名/pixelfed/artisan horizonUser=wwwRestart=on-failure
[Install]WantedBy=multi-user.target
sudo -u www /usr/bin/php /www/wwwroot/你的域名/pixelfed/artisan horizon
sudo systemctl daemon-reloadsudo systemctl start pixelfedsudo systemctl status pixelfed
sudo systemctl enable --now pixelfed
2.安装Supervisor
Name填pixefled
Run User选www
Start command填
php artisan horizon
Process directory选网站目录/www/wwwroot/域名pixelfed
Processes填 1
保存
运行
php artisan package:discoveror
composer install
然后运行
php artisan horizon:install
php artisan route:cache
最差最后一步 二选一
1
crontab -e
最后一行添加
* * * * * /usr/bin/php /www/wwwroot/你的域名/pixelfed/artisan schedule:run >> /dev/null 2>&1
保存后选择以下命令来确认
crontab -l
2宝塔面板添加计划任务
/usr/bin/php /www/wwwroot/域名/pixelfed/artisan schedule:run
设定每1分钟运行一次
到此结束
关于更新
cd /pixelfed 安装目录git reset --hard HEADgit pull origin devcomposer installphp artisan config:cachephp artisan route:cachephp artisan migrate --force
清除配置缓存
php artisan config:clear
清除应用缓存
php artisan cache:clear
重启 Redis 服务(确保 Redis 配置正确)
systemctl restart redis