Skip to content

Commit

Permalink
add read me and auto install script
Browse files Browse the repository at this point in the history
  • Loading branch information
DFanso committed Jun 16, 2024
1 parent ba80af4 commit e780812
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
Binary file modified Lavalink.jar
Binary file not shown.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

This guide will help you install the LavaLink server on an Ubuntu system. LavaLink is a Java application, so you'll need to have Java installed on your system.

### How to Use the Script

1. Save the script to a file, for example `install_lavalink.sh`.
2. Make the script executable:

```bash
chmod +x install_lavalink.sh

```

3. Run the script with `sudo`:

```bash
sudo ./install_lavalink.sh
```


This script will update your system, install Java, download the LavaLink JAR file, create the necessary configuration files, set up the systemd service, and start the LavaLink server. Make sure to replace `"dfanso"` in the configuration file with a secure password of your choice.

### Step-by-Step Guide

#### Step 1: Update Your System
Expand Down
86 changes: 86 additions & 0 deletions install_lavalink.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash

# Update and upgrade the system
echo "Updating system..."
sudo apt update && sudo apt upgrade -y

# Install Java
echo "Installing Java..."
sudo apt install openjdk-11-jre-headless -y

# Verify Java installation
java_version=$(java -version 2>&1)
echo "Java version installed: $java_version"

# Download LavaLink.jar
echo "Downloading LavaLink.jar..."
wget https://github.com/DFanso/lavalink-server/blob/main/Lavalink.jar -O /opt/Lavalink.jar

# Create LavaLink configuration file
echo "Creating application.yml..."
cat <<EOL | sudo tee /opt/application.yml
server:
port: 8080
address: 0.0.0.0
lavalink:
server:
password: "dfanso"
sources:
youtube: true
bandcamp: true
soundcloud: true
twitch: true
vimeo: true
http: true
bufferDurationMs: 4000
youtubePlaylistLoadLimit: 6
playerUpdateInterval: 5
youtubeSearchEnabled: true
soundcloudSearchEnabled: true
metrics:
prometheus:
enabled: false
endpoint: /metrics
influx:
enabled: false
dbName: lavalink
hostname: localhost
port: 8086
username: admin
password: password
EOL

# Create a systemd service file for LavaLink
echo "Creating lavalink.service..."
cat <<EOL | sudo tee /etc/systemd/system/lavalink.service
[Unit]
Description=LavaLink
After=network.target
[Service]
User=root
WorkingDirectory=/opt
ExecStart=/usr/bin/java -jar /opt/Lavalink.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOL

# Reload systemd daemon
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload

# Enable and start the LavaLink service
echo "Enabling and starting lavalink.service..."
sudo systemctl enable lavalink.service
sudo systemctl start lavalink.service

# Check the status of the service
echo "Checking the status of lavalink.service..."
sudo systemctl status lavalink.service

echo "LavaLink installation and setup complete!"

0 comments on commit e780812

Please sign in to comment.