Phantombot Setup Tutorial for Twitch

Phantombot Setup Tutorial for Twitch

Are you a Twitch broadcaster that wants to automate and streamline your workflow? This Phantombot setup tutorial for twitch makes your streaming life simple. It, therefore, allows for heavy automation via an easy to use dashboard panel. We have also outlined the Phantombot requirements to properly follow this setup tutorial.

About the authorVashishtha Kapoor is a Digital Marketing enthusiast and has over 5 years of experience in SEO, PPC, Website Management and WordPress development. Vashishtha writes about WordPress customizations, website designing, technology trends, and ad-tech topics.

Phantombot comes packed with endless features. Here are a few examples below:

  • Song requests
  • Custom commands
  • Auto responders in chat
  • Chatbot based on keywords
  • Timed Messages
  • Quotes system
  • And a lot more
Install Java for Phantombot setup tutorial, Twitch.

Phantombot Requirements

There are a few requirements to properly run Phantombot. First, make sure you have the proper amount of resources on your server. We can host a copy of Phantombot on a VPS that has 2GB RAM + 1v CPU. We deployed this server at Skysilk for 5$/month.

Second, we will walk you through properly installing Java and downloading Phantombot from the Git repository.

Update and Upgrade Packages

Let’s get our server ready to install packages for Phantombot. The following command will update and upgrade the packages on the virtual machine. It may take a few minutes to complete the Phantombot setup tutorial for Twitch.

sudo apt update
sudo apt upgrade

Install Java to Run Phantombot

Another Phantombot requirement is Java. To properly follow our Phantombot Tutorial for twitch, Java has to be installed on your VPS. Install a supported version of Java with the following command.

sudo apt install openjdk-8-jdk-headless

Before heading further, please double check and ensure that Java was installed properly:

java -version

The response should look like this

openjdk version “1.8.0_252”
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Read more: Get Your Project Featured with SkySilk and Earn $500 in SkySilk Account Credit

Add A New user Group for Phantombot

Now that you’ve properly installed Java for Phantombot, it’s time to create a new user group. We will title the new user group — phantomuser, However, the name of this group is entirely up to you.

sudo addgroup phantomuser

Add a user to the phantomuser group. You can choose any unique name that you would like.

sudo adduser pbotuser --ingroup phantomuser

When we add a user, the console will ask us some questions such as: Full name, address, UNIX password etc. You are welcome to enter any information that you wish, as well as leaving the personal details section blank if you’d prefer.

Grant the newly created user sudo access privileges.

sudo usermod -aG sudo pbotuser

Once the new user is created, we should be able to navigate to the newly created user’s home directory which is /home/username.

cd /home/pbotuser

Use wget command to download the latest version of Phantombot from its git repository. 

wget https://github.com/PhantomBot/PhantomBot/releases/download/v3.1.2/PhantomBot-3.1.2.zip

After downloading the latest version from the git repository, unzip your file. To unzip the file, you need to have the unzip package installed on your VPS. Run this command to install it:

sudo apt install unzip

Unzip the package:

unzip PhantomBot-3.1.2.zip

The unzip command will extract PhantomBot-3.1.2.zip into the folder “PhantomBot-3.1.2”. You need to rename it to phantombot with the following command.

mv PhantomBot-3.1.2 phantombot

The Phantombot may not work if the right privileges for launch-service.sh and launch.sh are not set, we’ll do that with the following commands:

cd /home/phantomuser/phantombot
sudo chmod u+x launch-service.sh launch.sh
sudo chmod u+x ./java-runtime-linux/bin/java

Change the directory owner and assign it to pbotuser.

sudo chown -R pbotuser:pbotuser *

Now is the time to run launch.sh 

./launch.sh

Read more: How To Host A Discord Bot Using A VPS

Configure Phantombot for Twitch

When we run the above command in our SSH client, the wizard will ask us multiple questions to configure the bot properly:

  • Twitch username:type your twitch username here
  • Twitch Oauth Token: (You can get your token here: https://twitchapps.com/tmi/)
  • PhantomBot Oauth Token again: (Get the phantombot token here: https://phantombot.dev/oauth/)
  • Name of the Twitch channel: Your twitch channel name
  • Custom username for the web panel: type a desired username
  • Custom password for the web panel: you can choose a new password here. 

Phantombot for Twitch should now be installed on our server and is ready to be utilized on port 25000. However, we need to set up and configure a system unit so that we can start, stop and restart the bot via SSH.

We need to create a file named phantombot.service now:

sudo nano /etc/systemd/system/phantombot.service

In editor, paste the following content and use CTRL + X, Y and ENTER to save and exit.

[Unit]
Description=PhantomBot
After=network.target remote-fs.target nss-lookup.target
[Service]
User=botuser
Group=botuser
Restart=on-failure
RestartSec=30
ExecStart=/home/botuser/phantombot/launch-service.sh
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target

After this, we need to enable the systemd unit we have created so that it can run at boot as a service.

sudo systemctl daemon-reload
sudo systemctl enable phantombot

At this stage, we can easily start, stop and restart the phantombot service. However, only if we are the root user. We created a sudo user called pbotuser and want the user to be able to start and stop the service, right?

To do so, we need to give permission to the new user “pbotuser”.

sudo visudo

In the file, add the line below at the end.

pbotuser ALL=NOPASSWD: /bin/systemctl start phantombot, /bin/systemctl stop phantombot, /bin/systemctl restart phantombot

Save and exit from the editor using CTRL + X followed by Y and then ENTER

Switch to pbotuser and test if we’re able to successfully start, stop and restart phantombot:

sudo su - pbotuser
sudo /bin/systemctl start phantombot
sudo /bin/systemctl stop phantombot
sudo /bin/systemctl restart phantombot

You’re now more than halfway through the Phantombot Setup Tutorial for Twitch!

Enable Firewall

Phantombot usually runs over port 25000. Below, we need to enable the firewall and open the port so that we can use phantombot in our browser.

Allow port 22 for SSH connections

sudo ufw allow 22

Open panel ports 25000 to 25004 

sudo ufw allow 25000:25004/tcp

Enable user firewall with the below command

sudo ufw enable

Read more: How To Send Emails In Django

Open Phantombot for Twitch in Browser

We should now be able to open the phantombot panel in our browser like this:

http://YOURSERVERIP:25000/panel

Just replace YOURSERVERIP with your server’s IPv4 address and use the username and password that you typed while configuring phantombot to enter the panel.

Install Java for Phantombot setup tutorial, twitch. Download from Git Repository
Download Git Repository Phantombot setup tutorial for twitch

Phantombot Setup Tutorial, Complete!

We’re all set to use Phantombot and make our Twitch streaming life a piece of cake. Now that you’ve finished the Phantombot setup tutorial, what’s the first thing you’re going to use it for? Let us know on discord!

Join our discord, a community of open-source fans

Share this post with your friends