-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
213 lines (165 loc) · 6.82 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/bin/bash
# Media Stack Installer for Ubuntu 22.04 LTS
# Version: 1.0
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}This script must be run as root. Use sudo.${NC}"
exit 1
fi
prepare_system() {
echo -e "${YELLOW}Preparing system and installing dependencies...${NC}"
apt-get update
apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
software-properties-common \
git \
wget
install_docker
}
install_docker() {
echo -e "${YELLOW}Installing Docker...${NC}"
apt-get remove docker docker-engine docker.io containerd runc -y
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable docker
systemctl start docker
if [ -n "$SUDO_USER" ]; then
usermod -aG docker "$SUDO_USER"
fi
}
create_media_stack() {
echo -e "${YELLOW}Setting up Media Stack...${NC}"
# Create directory
mkdir -p /opt/media-stack
cd /opt/media-stack
# Download docker-compose.yml
wget https://raw.githubusercontent.com/Goshko812/media-stack-script/refs/heads/main/docker-compose.yml || {
echo -e "${RED}Failed to download docker-compose.yml${NC}"
exit 1
}
}
# Configure VPN (optional)(haven't tried yet so yeah this will probably get removed or some shit later)
configure_vpn() {
echo -e "${YELLOW}VPN Configuration${NC}"
read -p "Do you want to use a VPN? (y/n): " use_vpn
if [[ $use_vpn == "y" ]]; then
echo -e "${YELLOW}Available VPN Providers:${NC}"
echo "1. NordVPN"
echo "2. ExpressVPN"
echo "3. SurfShark"
echo "4. ProtonVPN"
echo "5. Custom OpenVPN"
read -p "Choose VPN Provider (1-5): " vpn_choice
read -p "Enter VPN Username: " vpn_username
read -sp "Enter VPN Password: " vpn_password
echo
read -p "Enter Server Country (e.g., Switzerland): " server_country
# Export VPN variables
export VPN_SERVICE_PROVIDER=$(case $vpn_choice in
1) echo "nordvpn" ;;
2) echo "expressvpn" ;;
3) echo "surfshark" ;;
4) echo "protonvpn" ;;
5) read -p "Enter custom VPN provider name: " custom_vpn; echo "$custom_vpn" ;;
*) echo "nordvpn" ;;
esac)
export OPENVPN_USER="$vpn_username"
export OPENVPN_PASSWORD="$vpn_password"
export SERVER_COUNTRIES="$server_country"
fi
}
deploy_media_stack() {
echo -e "${YELLOW}Deploying Media Stack...${NC}"
docker network create --subnet 172.20.0.0/16 mynetwork || true
# Deploy with or without VPN
if [ -n "$VPN_SERVICE_PROVIDER" ]; then
echo -e "${GREEN}Deploying with VPN: $VPN_SERVICE_PROVIDER${NC}"
docker compose --profile vpn up -d
else
echo -e "${GREEN}Deploying without VPN${NC}"
docker compose --profile no-vpn up -d
fi
docker exec qbittorrent mkdir -p /downloads/movies /downloads/tvshows
docker exec qbittorrent chown 1000:1000 /downloads/movies /downloads/tvshows
}
post_install_instructions() {
echo -e "${GREEN}Media Stack Installation Complete!${NC}"
echo -e "${YELLOW}Access your services at the following default ports:${NC}"
echo "- qBittorrent: http://localhost:5080"
echo "- Radarr: http://localhost:7878"
echo "- Sonarr: http://localhost:8989"
echo "- Prowlarr: http://localhost:9696"
echo "- Jellyfin: http://localhost:8096"
echo "- Jellyseerr: http://localhost:5055"
echo -e "\n${YELLOW}Next Steps:${NC}"
echo "1. Configure each service through its web interface"
echo "2. Set up indexers in Prowlarr"
echo "3. Add download clients in Radarr/Sonarr"
echo "4. Create media libraries in Jellyfin"
echo -e "\n${RED}IMPORTANT:${NC}"
echo "- Default credentials for qbittorrent can be found using the ${RED}docker logs qbittorrent${NC} command"
echo "- Change default password immediately"
echo "- If using VPN, ensure your VPN credentials are correct"
read -p "Do you want a detailed configuration guide? (y/n): " show_guide
if [[ $show_guide == "y" ]]; then
display_configuration_guide
fi
}
display_configuration_guide() {
echo -e "\n${GREEN}=== Detailed Configuration Guide ===${NC}"
echo -e "\n${YELLOW}## Configure qBittorrent${NC}"
echo "- Open qBitTorrent at http://localhost:5080. Default username is 'admin'."
echo "- Temporary password can be collected from container log: ${RED}docker logs qbittorrent${NC}"
echo "- Go to Tools --> Options --> WebUI --> Change password"
echo -e "\n${YELLOW}## Configure Radarr${NC}"
echo "- Open Radarr at http://localhost:7878"
echo "- Settings --> Media Management --> Check 'Movies deleted from disk are automatically unmonitored in Radarr'"
echo "- Add Root Folder: /downloads/movies"
echo "- Configure Download Client: Add qBittorrent (host: qbittorrent, port: 5080)"
echo "- ${RED}Note:${NC} If using VPN, use 'vpn' as host instead"
echo -e "\n${YELLOW}## Configure Sonarr${NC}"
echo "- Similar configuration to Radarr, but for TV shows"
echo "- Root Folder: /downloads/tvshows"
echo -e "\n${YELLOW}## Configure Jellyfin${NC}"
echo "- Open Jellyfin at http://localhost:8096"
echo "- Follow the initial setup wizard"
echo "- Add media library folder: /data/movies/"
echo -e "\n${YELLOW}## Configure Jellyseerr${NC}"
echo "- Open Jellyseerr at http://localhost:5055"
echo "- Follow the initial setup wizard"
echo "- Provide Sonarr and Radarr details"
echo "- Detailed setup: https://docs.overseerr.dev/"
echo -e "\n${YELLOW}## Configure Prowlarr${NC}"
echo "- Open Prowlarr at http://localhost:9696"
echo "- Set up Authentication"
echo "- Add Indexers"
echo "- Add Radarr and Sonarr as applications"
echo -e "${RED}Note:${NC} With VPN, use static IPs or modified service names"
echo -e "\n${YELLOW}## Configure Bazarr${NC}"
echo "- Open Prowlarr at http://localhost:6767"
echo "- Set up Authentication"
echo "- Add Providers"
echo "- Add default languages"
echo "- Add Radarr and Sonarr"
}
main() {
clear
echo -e "${GREEN}Media Stack Automated Installer${NC}"
prepare_system
create_media_stack
configure_vpn
deploy_media_stack
post_install_instructions
}
main