How to Setup a TeamSpeak Server on Raspberry Pi
TeamSpeak is a popular voice communication application used by gamers, businesses, and communities for real-time voice chat. Hosting a TeamSpeak server on your Raspberry Pi is a cost-effective solution that provides full control over your communication environment. This guide will walk you through the steps to set up a TeamSpeak server on your Raspberry Pi.
Prerequisites
Before starting, ensure you have the following:
- Raspberry Pi 3 or later (preferably Raspberry Pi 4 for better performance)
- MicroSD card with Raspberry Pi OS installed
- Stable internet connection
- Access to the command line (via monitor and keyboard or SSH)
Step 1: Update and Upgrade Your Raspberry Pi
First, make sure your Raspberry Pi is up to date.
- Open a terminal on your Raspberry Pi or SSH into it.
- Run the following commands to update and upgrade your system:
sudo apt update
sudo apt upgrade -y
Step 2: Install Necessary Dependencies
TeamSpeak requires some additional libraries to run properly. Install these dependencies by running the following command:
sudo apt install -y xz-utils libmariadb3 libmariadb-dev`
Step 3: Download and Extract TeamSpeak Server
- Navigate to the /opt Directory:
cd /opt
- Download TeamSpeak Server:
Replace <latest_version>
with the latest version of TeamSpeak server available on the TeamSpeak download page.
wget https://files.teamspeak-services.com/releases/server/<latest_version>/teamspeak3-server_linux_arm64-<latest_version>.tar.bz2
- Extract the Downloaded Archive:
sudo tar xvf teamspeak3-server_linux_arm64-<latest_version>.tar.bz2
- Rename the Extracted Directory:
sudo mv teamspeak3-server_linux_arm64 /opt/teamspeak
Step 4: Create a TeamSpeak User
- Create a New User for TeamSpeak:
sudo adduser --disabled-login teamspeak
- Change Ownership of the TeamSpeak Directory:
sudo chown -R teamspeak:teamspeak /opt/teamspeak
Step 5: Setup TeamSpeak as a Systemd Service
- Create a New Systemd Service File:
sudo nano /etc/systemd/system/teamspeak.service
- Add the Following Configuration:
[Unit]
Description=TeamSpeak Server
After=network.target
[Service]
WorkingDirectory=/opt/teamspeak
User=teamspeak
Group=teamspeak
Type=forking
ExecStart=/opt/teamspeak/ts3server_startscript.sh start
ExecStop=/opt/teamspeak/ts3server_startscript.sh stop
ExecReload=/opt/teamspeak/ts3server_startscript.sh restart
PIDFile=/opt/teamspeak/ts3server.pid
RestartSec=15
Restart=always
[Install]
WantedBy=multi-user.target
- Enable and Start the TeamSpeak Service:
sudo systemctl daemon-reload
sudo systemctl enable teamspeak
sudo systemctl start teamspeak
Step 6: Retrieve Server Query and Admin Token
When you start the TeamSpeak server for the first time, it generates a server query username, password, and an admin token. These credentials are necessary for managing your TeamSpeak server.
- Check the Logs for Credentials:
sudo journalctl -u teamspeak
- Note Down the Server Query Credentials and Admin Token.
Step 7: Connect to Your TeamSpeak Server
- Find Your Raspberry Pi’s IP Address:
hostname -I
- Open TeamSpeak Client:
Download and install the TeamSpeak client on your computer from the TeamSpeak website.
- Connect to Your Server:
- Open the TeamSpeak client and enter the IP address of your Raspberry Pi.
- Use the admin token obtained from the logs to gain admin access.
Step 8: Secure Your TeamSpeak Server (Optional)
For added security, consider setting up a firewall and enabling HTTPS for web administration.
- Set Up a Firewall:
sudo apt install ufw
sudo ufw allow ssh
sudo ufw allow 9987/udp
sudo ufw allow 10011/tcp
sudo ufw allow 30033/tcp
sudo ufw enable
- Enable HTTPS (Optional):
Refer to the TeamSpeak documentation for setting up HTTPS for the server query interface if needed.
Conclusion
By setting up a TeamSpeak server on your Raspberry Pi, you can enjoy seamless voice communication for gaming, collaboration, or other purposes. With this guide, you should have a fully functional TeamSpeak server running on your Raspberry Pi, providing you with a robust and customizable voice communication solution. Enjoy managing your own TeamSpeak server and stay connected with your community!