找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 192|回复: 1

问gpt生成debian12一键安装脚本Jellyfin,Portainer

[复制链接]
几句话帮我生成脚本,几分钟效率真高  我的是j4125pve直通后虚拟机安装
debian12

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
intel_gpu_top 执行看gpu使用情况

lspci | grep VGA 查看pci

dmesg | grep i915 查看

nano x.sh 粘贴进去
bash x.sh
  1. #!/bin/bash

  2. # 确保以 root 用户执行
  3. if [[ "$(id -u)" -ne 0 ]]; then
  4.    echo "此脚本必须以 root 权限运行" >&2
  5.    exit 1
  6. fi

  7. echo "开始系统初始化配置..."

  8. # 询问用户是否跳过网络配置
  9. read -p "是否跳过网络配置?(y/N): " skip_network_setup
  10. if [[ ! "$skip_network_setup" =~ ^([yY][eE][sS]|[yY])$ ]]; then
  11.     # 配置静态 IP 地址
  12.     echo "配置静态 IP 地址..."
  13.     read -p "请输入网络接口名称(例如 eth0): " interface
  14.     read -p "请输入静态 IP 地址(例如 192.168.1.100/24): " address
  15.     read -p "请输入网关地址(例如 192.168.1.1): " gateway
  16.     read -p "请输入DNS服务器地址(例如 8.8.8.8): " dns

  17.     # 创建网络配置文件
  18.     cat <<EOF > /etc/systemd/network/10-static-${interface}.network
  19. [Match]
  20. Name=${interface}

  21. [Network]
  22. Address=${address}
  23. Gateway=${gateway}
  24. DNS=${dns}
  25. EOF

  26.     # 重启 systemd-networkd 服务应用配置
  27.     systemctl restart systemd-networkd

  28.     echo "网络配置完成。"
  29. else
  30.     echo "跳过网络配置..."
  31. fi

  32. # 更新系统并安装必要工具
  33. echo "更新系统并安装要工具..."
  34. apt update && apt upgrade -y
  35. apt install -y git curl apt-transport-https ca-certificates software-properties-common firmware-linux-nonfree intel-gpu-tools vainfo vdpauinfo

  36. # 克隆并更新固件
  37. echo "更新 Linux 固件..."
  38. cd /tmp || exit
  39. git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  40. cp -r linux-firmware/i915 /usr/lib/firmware/
  41. rm -rf linux-firmware

  42. # 配置 i915 模块
  43. echo "配置 i915 模块..."
  44. echo 'options i915 enable_guc=2' > /etc/modprobe.d/i915.conf

  45. # 更新initramfs和grub
  46. echo "更新 initramfs 和 grub..."
  47. update-initramfs -u && update-grub

  48. # 允许 root 用户通过 SSH 登录
  49. echo "配置 SSH 允许 root 用户登录..."
  50. sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
  51. systemctl restart ssh

  52. # 安装 Docker
  53. echo "安装 Docker..."
  54. curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
  55. echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
  56. apt update && apt install -y docker-ce

  57. # 安装 Docker-Compose
  58. echo "安装 Docker-Compose..."
  59. curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  60. chmod +x /usr/local/bin/docker-compose

  61. # 安装并配置 Portainer
  62. echo "安装并配置 Portainer..."
  63. docker volume create portainer_data
  64. docker run -d -p 8000:8000 -p 9000:9000 --restart=always --name=portainer -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

  65. # 安装并配置 Jellyfin,特别注意加入 Intel GPU 设备
  66. echo "安装并配置 Jellyfin,并加入Intel GPU设备进行硬件加速..."
  67. docker run -d \
  68.   --name=jellyfin \
  69.   --restart=always \
  70.   --network=host \
  71.   --device /dev/dri:/dev/dri \
  72.   --device /dev/dri/renderD128:/dev/dri/renderD128 \
  73.   -v /path/to/jellyfin/config:/config \
  74.   -v /path/to/jellyfin/cache:/cache \
  75.   -v /path/to/media:/media \
  76.   jellyfin/jellyfin

  77. echo "所有设置已完成。请根据需要调整 Jellyfin 的卷路径。"
  78. echo "建议重启系统以应用所有更改。"

  79. # 重启系统的提示
  80. read -rp "是否立即重启系统以应用更改?(y/N): " response
  81. if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
  82. then
  83.     reboot
  84. else
  85.     echo "更改将在下次重启后生效。"
  86. fi
复制代码




我的恩山、我的无线 The best wifi forum is right here.
来自手机 | 显示全部楼层
这样确实省了很多事
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-5-4 02:22

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表