【超火】吐血推荐 docker 搭建Koel 详细步骤
Koel是一个自己托管自己的音乐的平台,官网 https://koel.dev/这是我搭建的效果:
https://upload.cc/i1/2022/04/19/6Cp2KZ.jpg
音乐是论坛分享的douban250 无损flac:
https://www.aliyundrive.com/s/xuLCHkV97ML/folder/60dbe0c6f4f846a765ca403e982fa00b2849bd46
安装过程,主要使用docker来简化安装,网上有的帖子说docker安装的性能差,我分析了一下并没有这回事。
只是说因为要处理音乐上传/下载,这个系统的压力主要有:占用的磁盘空间比较大(1个音乐30M),还有占用内存也是比较多,所以1C1G的小鸡搭建不出来。
我用的是RN的,4C4G的年付套餐,当然3H3G也行,
4C4G:http://click.idcpay.me/rn-4c-4g
3C3G:http://click.idcpay.me/rn-3c-3g
# 1 准备步骤,安装dockeryum -y install dockersystemctl enable docker# 2 安装docker-composesudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-compose# 3 新建一个 koel 目录备用mkdir koelcd koel# 4 新建一个目录存放文件mkdir /opt/music/opt/music/covers# 5 准备你的域名 a.com# 6 准备 docker-compose.yml 文件####################################### docker-compose.yml 可以修改你的数据库密码version: '3.5'services:koel: image: hyzual/koel depends_on: - koel-database ports: - "127.0.0.1:2077:80" environment: FORCE_HTTPS: 1 MEMORY_LIMIT: 512 DB_CONNECTION: mysql DB_HOST: koel-database DB_USERNAME: koel DB_PASSWORD: Koko0202#1234 DB_DATABASE: koel volumes: - /opt/music:/music - /opt/music/covers:/var/www/html/public/img/covers restart: unless-stoppedkoel-database: image: mysql/mysql-server:5.7 environment: MYSQL_ROOT_PASSWORD: Koko0202#1234 MYSQL_DATABASE: koel MYSQL_USER: koel MYSQL_PASSWORD: Koko0202#1234 volumes: - koel_db:/var/lib/mysql restart: unless-stoppedvolumes:koel_db: driver: localkoel_music: driver: localkoel_covers: driver: local #docker-compose.yml 文件结束#################### 7 启动dockerdocker-compose up -d看到都成功了,即可# 8 安装nginx 和 python-certbot-nginx python-certbot-nginx 是维护lets' encrypt 证书用的yum -y install nginxyum install python-certbot-nginx#9 初始化koeldocker-compose exec k2_koel_1 php artisan koel:initdocker exec -it k2_koel_1 php artisan koel:admin:change-passwordk2_koel_1 是koel 容器名字,根据你情况来。默认管理员是:admin@koel.dev# 10 处理nginx 和 https问题新建nginx配置文件只带http 80端口版本的,命名为 koel.conf 放在 /etc/nginx/conf.d/#http版本的nginx配置文件server { listen 80; listen [::]:80; server_name a.com; location / { proxy_pass http://127.0.0.1:2077; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; # Not sure if these next two lines are needed. I did not remove them as # I did not want risk breaking my working configuration. Just remember # to replace "koel.domain.tld" with your instance's domain. sub_filter "http://koel.domain.tld" "http://music.idcpay.me"; sub_filter_once off; } }启动nginx 再启动cerbotcertbot certonly --nginx生成key/pem文件后,重新设置https版本配置文件server { listen 80; listen [::]:80; listen 443 ssl; server_name a.com; ssl_certificate /etc/letsencrypt/live/music.idcpay.me/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/music.idcpay.me/privkey.pem; location / { proxy_pass http://127.0.0.1:2077; # 如果是本机直接复制就行,如果是别的机器,记得换成你的ip地址 proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; # Not sure if these next two lines are needed. I did not remove them as # I did not want risk breaking my working configuration. Just remember # to replace "koel.domain.tld" with your instance's domain. sub_filter "http://koel.domain.tld" "https://music.idcpay.me"; sub_filter_once off; }}运行:nginx -s reload如果没有错误,就可以输入 https://a.com 欣赏你的音乐了。其他资源:可以搭建Koel的便宜主机:4C4G购买入口:http://click.idcpay.me/rn-4c-4g3C3G购买入口:http://click.idcpay.me/rn-3c-3g阿里云盘音乐豆瓣250无损flac:https://www.aliyundrive.com/s/xuLCHkV97ML/folder/60dbe0c6f4f846a765ca403e982fa00b2849bd46linux环境下载阿里云盘的客户端:https://github.com/tickstep/aliyunpan不需要下载再上传文件音乐管理:把mp3 flac等音乐文件放到虚拟主机的这里:/opt/music 在Koel 面板上,扫描: /music 目录,可以扫出新增音乐 技术分享很赞! 这是直接挂载阿里云盘找音乐? 膜拜,,有空学习一下 能挂载OD GD吗 我用docker搭了jellyfin,播放的时候,4H16G的RS2000 CPU都能飘红 需要的话,就搞搞。 有没有版权问题 我想搭在甲骨文上https://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif 自己用不会有版权问题,你别共享出去啊 刚开始我也想装 jellyfin,听你那么说幸亏没搞。 暂时不支持加载网盘的,不过你可以在上面装webdav客户端,把文件拉下来吧。
页:
[1]