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.
-
Save the script to a file, for example
install_lavalink.sh
. -
Make the script executable:
chmod +x install_lavalink.sh
-
Run the script with
sudo
: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.
First, update your system to ensure you have the most recent packages:
sudo apt update
sudo apt upgrade -y
LavaLink requires Java. Install it with:
sudo apt install openjdk-11-jre-headless -y
Verify the installation with:
java -version
Download the latest LavaLink.jar file from the LavaLink GitHub repository:
wget https://github.com/Cog-Creators/Lavalink-Jars/releases/download/3.7.11%2Bred.3/Lavalink.jar
LavaLink requires a configuration file named application.yml
. Create this file in the same directory as your LavaLink.jar file:
nano application.yml
Copy the following configuration into application.yml
:
server:
port: 8080
address: 0.0.0.0
lavalink:
server:
password: "your_password_here"
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
Replace "your_password_here"
with a secure password of your choice.
Run LavaLink with:
java -jar Lavalink.jar
To run it in the background, use screen
:
screen -S LavaLink
java -jar Lavalink.jar
Detach from the screen session with CTRL+A
then D
. Re-attach with screen -r LavaLink
.
To keep LavaLink running continuously, use systemd
.
Create a service file for LavaLink:
sudo nano /etc/systemd/system/lavalink.service
Add the following configuration:
[Unit]
Description=LavaLink
After=network.target
[Service]
User=your_username
WorkingDirectory=/path/to/your/lavalink/directory
ExecStart=/usr/bin/java -jar Lavalink.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Replace your_username
with your actual username and /path/to/your/lavalink/directory
with the path to your LavaLink directory.
Enable and start the service:
sudo systemctl enable lavalink.service
sudo systemctl start lavalink.service
Check the status of the service:
sudo systemctl status lavalink.service
If you encounter issues, ensure the path and permissions are correct. The user specified should have access to the LavaLink directory. If your Lavalink.jar
is in the root directory, adjust the service file accordingly:
[Unit]
Description=LavaLink
After=network.target
[Service]
User=root
WorkingDirectory=/root
ExecStart=/usr/bin/java -jar /root/Lavalink.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Reload the systemd daemon and restart the service after any changes:
sudo systemctl daemon-reload
sudo systemctl restart lavalink.service
-
Check Logs:
journalctl -u lavalink.service
-
Check Service Status:
sudo systemctl status lavalink.service
-
Check Open Ports:
sudo netstat -tuln | grep 8080
If
netstat
is not installed, install it with:sudo apt install net-tools
-
Connect a Bot: Ensure your bot can connect to the LavaLink server and play tracks without issues.
By following these steps, you should have a running LavaLink server on your Ubuntu system.