mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
Moved guides from readme to docs. Refactored docs
This commit is contained in:
@@ -1,175 +1,95 @@
|
||||
## Setting Up NadekoBot on OSX (macOS)
|
||||
### Linux From Source
|
||||
|
||||
| Table of Contents |
|
||||
| :------------------------------------------------------ |
|
||||
| [Prerequisites] |
|
||||
| [Installing Homebrew] |
|
||||
| [Downloading and Running Nadeko] |
|
||||
| [Running Nadeko with the Terminal closed] |
|
||||
| [Using Nadeko with pm2 (easiest method)] |
|
||||
| [Using Nadeko with tmux (if you don't want to use pm2)] |
|
||||
| [Doing a clean reinstall] |
|
||||
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 ~`)
|
||||
|
||||
#### Prerequisites
|
||||
##### Installation Instructions
|
||||
|
||||
- OSX 10.12 (Sierra) or higher (needed for .NET Core 2.x).
|
||||
- [Homebrew](http://brew.sh/).
|
||||
- [Create a Discord Bot application](../../create-invite/#creating-discord-bot-application) and [invite the bot to your server](../../create-invite/#inviting-your-bot-to-your-server).
|
||||
|
||||
#### Installing Homebrew
|
||||
1. Download and run the **new** installer script `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
|
||||
2. Install prerequisites (type `1` and press enter)
|
||||
3. Download the bot (type `2` and press enter)
|
||||
4. Exit the installer in order to set up your `creds.yml`
|
||||
5. Copy the creds.yml template `cp nadekobot/output/creds_example.yml nadekobot/output/creds.yml`
|
||||
6. Open `nadekobot/output/creds.yml` with your favorite text editor. We will use nano here
|
||||
- `nano nadekobot/output/creds.yml`
|
||||
7. [Enter your bot's token](#creds-guide)
|
||||
- After you're done, you can close nano (and save the file) by inputting, in order
|
||||
- `CTRL`+`X`
|
||||
- `Y`
|
||||
- `Enter`
|
||||
8. Run the bot (type `3` and press enter)
|
||||
|
||||
- Open Terminal (if you don't know how to, click on the magnifying glass on the top right corner of your screen and type **Terminal** on the window that pops up).
|
||||
- Copy and paste this command, then press Enter:
|
||||
`/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
||||
##### Update Instructions
|
||||
|
||||
1. ⚠ Stop the bot
|
||||
2. Update and run the **new** installer script `cd ~ && wget -N https://gitlab.com/Kwoth/nadeko-bash-installer/-/raw/master/linuxAIO.sh && bash linuxAIO.sh`
|
||||
3. Update the bot (type `2` and press enter)
|
||||
4. Run the bot (type `3` and press enter)
|
||||
5. 🎉
|
||||
|
||||
#### Installing the prerequisites
|
||||
### Linux Release
|
||||
|
||||
Run this command in Terminal (copy-paste the entire block):
|
||||
##### Installation Instructions
|
||||
|
||||
``` bash
|
||||
brew install wget git ffmpeg openssl opus opus-tools opusfile libffi libsodium tmux python youtube-dl redis npm
|
||||
1. 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
|
||||
2. 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`
|
||||
3. Rename the `nadekobot-linux-x64` to `nadekobot`
|
||||
- `mv nadekobot-linux-x64 nadekobot`
|
||||
4. Move into nadekobot directory and make NadekoBot executable
|
||||
- `cd nadekobot && chmod +x NadekoBot`
|
||||
5. Copy the creds.yml template
|
||||
- `cp creds_example.yml creds.yml`
|
||||
6. Open `creds.yml` with your favorite text editor. We will use nano here
|
||||
- `nano nadekobot/output/creds.yml`
|
||||
8. [Enter your bot's token](#creds-guide)
|
||||
- After you're done, you can close nano (and save the file) by inputting, in order
|
||||
- `CTRL`+`X`
|
||||
- `Y`
|
||||
- `Enter`
|
||||
9. Run the bot
|
||||
- `./NadekoBot`
|
||||
|
||||
brew services start redis
|
||||
##### Update Instructions
|
||||
|
||||
npm install pm2@3.1.3 -g
|
||||
```
|
||||
1. Stop the bot
|
||||
2. 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
|
||||
3. Untar it
|
||||
⚠ Make sure that you change X.XX.X to the same series of numbers as in step 2!
|
||||
- `tar xf 2.99.8-linux-x64-build.tar`
|
||||
4. 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`
|
||||
5. Rename the new nadekobot directory to nadekobot
|
||||
- `mv nadekobot-linux-x64 nadekobot`
|
||||
6. 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`
|
||||
7. Copy old data
|
||||
- `cp -RT nadekobot-old/data/ nadekobot/data/`
|
||||
8. Copy creds.yml
|
||||
- `cp nadekobot-old/creds.yml nadekobot/`
|
||||
9. Move into nadekobot directory and make the NadekoBot executable
|
||||
- `cd nadekobot && chmod +x NadekoBot`
|
||||
10. Run the bot
|
||||
- `./NadekoBot`
|
||||
|
||||
**Installing .net SDK**
|
||||
🎉 Enjoy
|
||||
|
||||
- Download [.net5 SDK](https://dotnet.microsoft.com/download/dotnet/5.0)
|
||||
- Open the `.pkg` file you've downloaded and install it.
|
||||
- Run this command in Terminal. There might be output. If there is, disregard it. (copy-paste the entire block)
|
||||
```bash
|
||||
sudo mkdir /usr/local/bin
|
||||
##### Steps 3 - 9 as a single command
|
||||
|
||||
sudo mkdir /usr/local/lib
|
||||
```
|
||||
- Run this command in Terminal. There won't be any output. (copy-paste the entire block):
|
||||
```bash
|
||||
sudo ln -s /usr/local/share/dotnet/dotnet /usr/local/bin
|
||||
|
||||
sudo ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
|
||||
|
||||
sudo ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
|
||||
```
|
||||
|
||||
|
||||
#### Downloading and Running Nadeko
|
||||
|
||||
- Use the following command to download and run the installer. (PS: **Do not** rename the **`linuxAIO.sh`** file)
|
||||
`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
|
||||
- Choose Option `1` to download Nadeko. Once installation is completed you should see the options again.
|
||||
- Choose Option `5` to set up your credentials according to this [guide](../../jsons-explained/#setting-up-credentialsjson-file), or find and edit the `credentials.json` file manually.
|
||||
- Choose Option `2` to **Run Nadeko (Normally)**.
|
||||
- Check in your Discord server if your new bot is working properly. Once you're done testing, type `.die` on Discord to shut it down. The Terminal should automatically return to the main menu.
|
||||
|
||||
|
||||
#### Running NadekoBot with the terminal closed
|
||||
|
||||
If you run Nadeko through option 2 or 3 and close the terminal, Nadeko will also close. To avoid this, you'll need to use a process manager that will keep it open and running in the background. This section of the guide instructs on how to achieve this with pm2 and tmux. Whether you pick one or the other, please **do not** simultaneously, or you're going to get double responses to every command.
|
||||
|
||||
|
||||
#### Using Nadeko with pm2 (easiest method)
|
||||
|
||||
- pm2 will not only allow Nadeko to run in the background, but will also automatically launch Nadeko upon system reboots.
|
||||
- Open the installer, if you haven't already:
|
||||
`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
|
||||
- Run Option `7` (ignore Option `6`, that's for Linux only).
|
||||
- Pick whether you want to run it with or without auto-restart and auto-update.
|
||||
- Once it's done, run Option `8` to exit.
|
||||
- That's it. Your bot should be running in the background. Feel free to close the Terminal window.
|
||||
|
||||
**Managing Nadeko with pm2**
|
||||
|
||||
- Use the following commands on Terminal to check your Nadeko setup:
|
||||
- `pm2 status` to see all pm2 processes
|
||||
- `pm2 info Nadeko` to see information about Nadeko
|
||||
- `pm2 logs Nadeko` to view real-time logs of Nadeko, or
|
||||
- `pm2 logs Nadeko --lines number` (**number** = how many lines you want to output) to see a specific amount of lines of the log. The logfile is also stored and presented at the top of these commands
|
||||
|
||||
**Updating Nadeko with pm2**
|
||||
|
||||
- If you have set up Nadeko with auto-update, simply run `.die` on your Discord server. That's it.
|
||||
- If you have set up Nadeko with no auto-update:
|
||||
- Shut your bot down with `pm2 stop Nadeko`
|
||||
- Open the installer with `bash linuxAIO.sh` and choose Option `1`
|
||||
- Once it's done, exit the installer with Option `8` and run `pm2 restart Nadeko`
|
||||
- You can watch your bot going online with `pm2 logs Nadeko`
|
||||
|
||||
|
||||
#### Using Nadeko with tmux (if you don't want to use pm2)
|
||||
|
||||
- On the Terminal, create a new session:
|
||||
- `tmux new -s nadeko`
|
||||
|
||||
The above command will create a new session named **nadeko** *(you can replace “nadeko” with anything you prefer, it's your session name)*.
|
||||
|
||||
- Run the installer: `bash linuxAIO.sh`
|
||||
- Choose `2` to **Run NadekoBot normally**.
|
||||
- **NOTE**: With this option, if you use `.die` on Discord, the bot will shut down and stay offline until you manually run it again.
|
||||
- Choose `3` to **Run NadekoBot with Auto Restart**.
|
||||
- **NOTE**: With this option, the bot will auto run if you use `.die`, making it function as a restart.
|
||||
|
||||
If you pick Option `3`, you will be shown the following options:
|
||||
|
||||
```
|
||||
1. Run Auto Restart normally without Updating.
|
||||
2. Run Auto Restart and update NadekoBot.
|
||||
3. Exit
|
||||
```
|
||||
|
||||
- With Option `1`, the bot will restart on `.die` command and will not download the latest build available.
|
||||
- With Option `2`, the bot will restart and download the latest build available everytime the `.die` command is used.
|
||||
|
||||
Now check your Discord server, the bot should be online.
|
||||
|
||||
- To move the bot to the background, press **Control+B**, release the keys then hit **D**. That will detach the session, allowing you to finally close the terminal window and not worry about having your bot shut down in the process.
|
||||
|
||||
**Updating Nadeko with tmux**
|
||||
|
||||
- If you're running Nadeko with auto-update, just type `.die` in your Discord server. That's it!
|
||||
- If you're running Nadeko with **no** auto-update:
|
||||
- Kill your previous session.
|
||||
- Check the session name with `tmux ls`
|
||||
- Kill with `tmux kill-session -t nadeko` (don't forget to replace "nadeko" with whatever you named your bot's session).
|
||||
- Create a new session: `tmux new -s nadeko`
|
||||
- Run this command: `cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
|
||||
- Choose Option `1` to download the most up to date version of Nadeko.
|
||||
- Once it's done, choose Option `2` or `3` and detach the session by pressing **Control+B**, release then **D**.
|
||||
|
||||
**Additional Information**
|
||||
|
||||
- If you want to **see the active sessions**, run `tmux ls`. That will give you the list of the currently running sessions.
|
||||
- If you want to **switch to/see a specific session**, type `tmux a -t nadeko` (*nadeko* is the name of the session we created before so, replace it with the session name you have created).
|
||||
- If you want to go through the log, press **Control+B**, release the keys then hit **Page Up** or **Page Down** to navigate.
|
||||
- Don't forget to always detach from the session by pressing **Control+B** then **D** once you're done.
|
||||
- If you want **create** a new session, run `tmux new -s nadeko`. If you want to **kill it**, run `tmux kill-session -t nadeko`
|
||||
|
||||
|
||||
#### Doing a clean reinstall
|
||||
|
||||
- Make a backup of your credentials (`~/NadekoBot/src/NadekoBot/credentials.json`)
|
||||
- Make a backup of the database (`~/NadekoBot/src/NadekoBot/bin/Release/netcoreapp2.0/data/NadekoBot.db`)
|
||||
- Make a backup of the images (`~/NadekoBot/src/NadekoBot/data/images.json`)
|
||||
- Delete the NadekoBot folder
|
||||
- Install the bot from scratch, replace the files you backed up and run.
|
||||
|
||||
#### Help! My music isn't working!
|
||||
|
||||
Make sure you have the [Google API Key](../../jsons-explained/#setting-up-your-api-keys) in your `credentials.json`
|
||||
If music still isn't working, try reinstalling ffmpeg:
|
||||
|
||||
- `brew update && brew upgrade` (Update formulae and Homebrew itself && Install newer versions of outdated packages)
|
||||
- `brew prune` (Remove dead symlinks from Homebrew’s prefix)
|
||||
- `brew doctor` (Check your Homebrew installation for common issues)
|
||||
- Then try `brew install ffmpeg` again.
|
||||
|
||||
|
||||
[Prerequisites]: #prerequisites
|
||||
[Installing Homebrew]: #installing-homebrew
|
||||
[Downloading and Running Nadeko]: #downloading-and-running-nadeko
|
||||
[Running Nadeko with the Terminal closed]: #running-nadekobot-with-the-terminal-closed
|
||||
[Using Nadeko with pm2 (easiest method)]: #using-nadeko-with-pm2-easiest-method
|
||||
[Using Nadeko with tmux (if you don't want to use pm2)]: #using-nadeko-with-tmux-if-you-dont-want-to-use-pm2
|
||||
[Doing a clean reinstall]: #doing-a-clean-reinstall
|
||||
Don't forget to change X.XX.X to match step 2.
|
||||
```sh
|
||||
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
|
||||
```
|
Reference in New Issue
Block a user