8.8 KiB
Migration from 2.x
⚠ If you're already hosting NadekoBot, You MUST update to latest version of 2.x and run your bot at least once before switching over to v3.
Linux migration instructions
Linux From Source
Open Terminal (if you're on an installation with a window manager) and navigate to the location where you want to install the bot (for example cd ~
)
Installation Instructions
- Download and run the new installer script
cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh
- Install prerequisites (type
1
and press enter) - Download the bot (type
2
and press enter) - Exit the installer in order to set up your
creds.yml
- Copy the creds.yml template
cp nadekobot/output/creds_example.yml nadekobot/output/creds.yml
- Open
nadekobot/output/creds.yml
with your favorite text editor. We will use nano herenano nadekobot/output/creds.yml
- Enter your bot's token
- After you're done, you can close nano (and save the file) by inputting, in order
CTRL
+X
Y
Enter
- After you're done, you can close nano (and save the file) by inputting, in order
- Run the bot (type
3
and press enter)
Update Instructions
- ⚠ Stop the bot
- Update and run the new installer script
cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh
- Update the bot (type
2
and press enter) - Run the bot (type
3
and press enter) - 🎉
Linux Release
Installation Instructions
- Download the latest release from https://gitlab.com/Kwoth/nadekobot/-/releases
- Look for the file called "X.XX.X-linux-x64-build.tar" (where X.XX.X is a series of numbers) and download it
- Untar it
- ⚠ Make sure that you change X.XX.X to the same series of numbers as in step 1!
tar xf X.XX.X-linux-x64-build.tar
- Rename the
nadekobot-linux-x64
tonadekobot
mv nadekobot-linux-x64 nadekobot
- Move into nadekobot directory and make NadekoBot executable
cd nadekobot && chmod +x NadekoBot
- Copy the creds.yml template
cp creds_example.yml creds.yml
- Open
creds.yml
with your favorite text editor. We will use nano herenano nadekobot/output/creds.yml
- Enter your bot's token
- After you're done, you can close nano (and save the file) by inputting, in order
CTRL
+X
Y
Enter
- After you're done, you can close nano (and save the file) by inputting, in order
- Run the bot
./NadekoBot
Update Instructions
- Stop the bot
- Download the latest release from https://gitlab.com/Kwoth/nadekobot/-/releases
- Look for the file called "x.x.x-linux-x64-build.tar" (where
X.X.X
is a version, for example 3.0.4) and download it
- Look for the file called "x.x.x-linux-x64-build.tar" (where
- Untar it
- ⚠ Make sure that you change
X.X.X
to the same series of numbers as in step 2! tar xf x.x.x-linux-x64-build.tar
- ⚠ Make sure that you change
- Rename the old nadekobot directory to nadekobot-old (remove your old backup first if you have one, or back it up under a different name)
rm -rf nadekobot-old 2>/dev/null
mv nadekobot nadekobot-old
- Rename the new nadekobot directory to nadekobot
mv nadekobot-linux-x64 nadekobot
- Remove old strings and aliases to avoid overwriting the updated versions of those files
- ⚠ If you've modified said files, back them up instead
rm nadekobot-old/data/aliases.yml
rm -r nadekobot-old/data/strings
- Copy old data
cp -RT nadekobot-old/data/ nadekobot/data
- Copy creds.yml
cp nadekobot-old/creds.yml nadekobot/
- Move into nadekobot directory and make the NadekoBot executable
cd nadekobot && chmod +x NadekoBot
- Run the bot
./NadekoBot
🎉 Enjoy
Steps 3 - 9 as a single command
Don't forget to change X.XX.X to match step 2.
tar xf X.XX.X-linux-x64-build.tar && \
rm -rf nadekobot-old 2>/dev/null && \
mv nadekobot nadekobot-old && \
mv nadekobot-linux-x64 nadekobot && \
rm nadekobot-old/data/aliases.yml && \
rm -r nadekobot-old/data/strings && \
cp -RT nadekobot-old/data/ nadekobot/data && \
cp nadekobot-old/creds.yml nadekobot/ && \
cd nadekobot && chmod +x NadekoBot
Running Nadeko
While there are two run modes built into the installer, these options only run Nadeko within the current session. Below are 3 methods of running Nadeko as a background process.
Tmux (Preferred Method)
Using tmux
is the simplest method, and is therefore recommended for most users.
- Start a tmux session:
tmux
- Navigate to the project's root directory
- Project root directory location example:
/home/user/nadekobot/
- Project root directory location example:
- Enter the
output
directory:cd output
- Run the bot using:
dotnet NadekoBot.dll
- Detatch the tmux session:
- Press
Ctrl
+B
- Then press
D
- Press
Nadeko should now be running in the background of your system. To re-open the tmux session to either update, restart, or whatever, execute tmux a
.
Systemd
Compared to using tmux, this method requires a little bit more work to set up, but has the benefit of allowing Nadeko to automatically start back up after a system reboot or the execution of the .die
command.
-
Navigate to the project's root directory
- Project root directory location example:
/home/user/nadekobot/
- Project root directory location example:
-
Use the following command to create a service that will be used to start Nadeko:
echo "[Unit] Description=NadekoBot service After=network.target StartLimitIntervalSec=60 StartLimitBurst=2 [Service] Type=simple User=$USER WorkingDirectory=$PWD/output # If you want Nadeko to be compiled prior to every startup, uncomment the lines # below. Note that it's not neccessary unless you are personally modifying the # source code. #ExecStartPre=/usr/bin/dotnet build ../src/NadekoBot/NadekoBot.csproj -c Release -o output/ ExecStart=/usr/bin/dotnet NadekoBot.dll Restart=on-failure RestartSec=5 StandardOutput=syslog StandardError=syslog SyslogIdentifier=NadekoBot [Install] WantedBy=multi-user.target" | sudo tee /etc/systemd/system/nadeko.service
-
Make the new service available:
sudo systemctl daemon-reload
-
Start Nadeko:
sudo systemctl start nadeko.service && sudo systemctl enable nadeko.service
Systemd + Script
This method is similar to the one above, but requires one extra step, with the added benefit of better error logging and control over what happens before and after the startup of Nadeko.
-
Locate the project and move to its parent directory
- Project location example:
/home/user/nadekobot/
- Parent directory example:
/home/user/
- Project location example:
-
Use the following command to create a service that will be used to execute
NadekoRun.sh
:echo "[Unit] Description=NadekoBot service After=network.target StartLimitIntervalSec=60 StartLimitBurst=2 [Service] Type=simple User=$USER WorkingDirectory=$_WORKING_DIR ExecStart=/bin/bash NadekoRun.sh Restart=on-failure RestartSec=5 StandardOutput=syslog StandardError=syslog SyslogIdentifier=NadekoBot [Install] WantedBy=multi-user.target" | sudo tee /etc/systemd/system/nadeko.service
-
Make the new service available:
sudo systemctl daemon-reload
-
Use the following command to create a script that will be used to start Nadeko:
{ echo '#!/bin/bash' echo "" echo "echo \"Running NadekoBot in the background with auto restart\" youtube-dl -U # If you want Nadeko to be compiled prior to every startup, uncomment the lines # below. Note that it's not necessary unless you are personally modifying the # source code. #echo \"Compiling NadekoBot...\" #cd \"$PWD\"/nadekobot #dotnet build src/NadekoBot/NadekoBot.csproj -c Release -o output/ echo \"Starting NadekoBot...\" while true; do if [[ -d $PWD/nadekobot/output ]]; then cd $PWD/nadekobot/output || { echo \"Failed to change working directory to $PWD/nadekobot/output\" >&2 echo \"Ensure that the working directory inside of '/etc/systemd/system/nadeko.service' is correct\" echo \"Exiting...\" exit 1 } else echo \"$PWD/nadekobot/output doesn't exist\" exit 1 fi dotnet NadekoBot.dll || { echo \"An error occurred when trying to start NadekBot\" echo \"Exiting...\" exit 1 } echo \"Waiting for 5 seconds...\" sleep 5 youtube-dl -U echo \"Restarting NadekoBot...\" done echo \"Stopping NadekoBot...\"" } > NadekoRun.sh
-
Start Nadeko:
sudo systemctl start nadeko.service && sudo systemctl enable nadeko.service