diff --git a/docs/guides/Linux Guide.md b/docs/guides/Linux Guide.md index 5fee13a3..b14351bc 100644 --- a/docs/guides/Linux Guide.md +++ b/docs/guides/Linux Guide.md @@ -8,11 +8,11 @@ Assuming you have followed the link above to setup an account and Droplet with 6 **Go through this whole guide before setting up Nadeko** -#### Prerequisites +####Prerequisites - Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) -- Download [CyberDuck](https://cyberduck.io) or [WinSCP](https://winscp.net/eng/download.php) +- Download [WinSCP](https://winscp.net/eng/download.php) *(optional)* -#### Follow these steps +####Starting up - **Open PuTTY.exe** that you downloaded before, and paste or enter your `IP address` and then click **Open**. If you entered your Droplets IP address correctly, it should show **login as:** in a newly opened window. @@ -24,7 +24,162 @@ If you entered your Droplets IP address correctly, it should show **login as:** **NOTE:** Copy the commands, and just paste them using **mouse single right-click.** -####Installing Git +####Creating and Inviting bot + +- Read here how to [create a DiscordBot application](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#creating-discordbot-application) +- [Visual Invite Guide](http://discord.kongslien.net/guide.html) **(Note: Client ID is your Bot ID)** +- Copy your `Client ID` from your [applications page](https://discordapp.com/developers/applications/me). +- Replace the **12345678** in this link: +`https://discordapp.com/oauth2/authorize?client_id=`12345678`&scope=bot&permissions=66186303` + with your `Client ID` +- The link should now look like this: +`https://discordapp.com/oauth2/authorize?client_id=`**YOUR_CLENT_ID_HERE**`&scope=bot&permissions=66186303` +- Go to the newly created link and pick the server we created, and click `Authorize` +- The bot should have been added to your server. + +####Getting NadekoBot +#####Part I +Use the following command to get and run `linuxAIO.sh` +(Remember **Do Not** rename the file **linuxAIO.sh**) + +`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/master/linuxAIO.sh && bash linuxAIO.sh` + +You should see these following options after using the above command: + +``` +1. Download Dev Build (Latest) +2. Download Stable Build +3. Run Nadeko (Normally) +4. Run Nadeko with Auto Restart (Run Nadeko normally before using this.) +5. Auto-Install Prerequisites (for Ubuntu and Debian) +6. Set up credentials.json (if you have downloaded the bot already) +7. To exit +``` +#####Part II +**If** you are running NadekoBot for the first time on your system and never had any *prerequisites* installed, Press `5` and press `enter` key, then `y` when you see the following: +``` +Welcome to NadekoBot Auto Prerequisites Installer. +Would you like to continue? +``` +That will install all the prerequisites your system need to run NadekoBot. + +If you prefer to install them [manually](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#installing-manually-optional), click on the link. *(Optional)* + +Once *prerequisites* finish installing. +#####Part III +Choose either +`1` to get the **most updated build of NadekoBot** +or +`2` to get the **previously stable build of NadekoBot** +and then press `enter` key. + +Once Installation is completed you should see the options again. + +Next, check out: +#####Part IV +If you prefer to do this step [manually](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#setting-up-sftp), and skip other parts click on the link. *(Optional)* + +- [1. Setting up credentials.json](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#setting-up-credentialsjson) +- [2. To Get the Google API](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-nadekobot-for-music) +- [3. JSON Explanations for other APIs](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/) + +You will need the following for the next step: +![botimg](https://cdn.discordapp.com/attachments/251504306010849280/276455844223123457/Capture.PNG) + +- **Bot's Client ID** and **Bot's ID** (both are same) [(*required)](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-credentialsjson-file) +- **Bot's Token** (not client secret) [(*required)](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-credentialsjson-file) +- Your **Discord userID** [(*required)](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-credentialsjson-file) +- **Google Api Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-nadekobot-for-music) +- **LoL Api Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/) +- **Mashape Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/) +- **Osu Api Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/) +- **Sound Cloud Client Id** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/) + +Once you have acquired them, press `6` to **Set up credentials.json** + +You will be asked to enter the required informations, just follow the on-screen instructions and enter whats asked. +*i.e* If you are asked **Bot's Token**, then just copy and paste the `token` and press `enter` key. + +If you want to skip any optional informations, just press `enter` key without typing/pasting anything. +Once done, +#####Part V +You should see the options again within the **tmux session** named *nadako*. +Next, press `3` to **Run Nadeko (Normally)** +Check in your discord server if your new bot is working properly. +#####Part VI +If the bot is working properly in your server, type `.die` to shut down the bot. +You should be back to the options again, +from the options choose `4` to **Run Nadeko with Auto Restart.** + +It will show you more options: +``` +1. Run Auto Restart normally without Updating. +2. Auto Restart and Update with Dev Build (latest) +3. Auto Restart and Update with Stable Build +4. Exit +``` +Choose anything you like and once the bot's back online again in your server, close the **PuTTY**. +Done, You now have your own **NadekoBot**. + + +[To **Restart** your **NadekoBot** anytime later.](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#restarting-nadeko) + +####Running NadekoBot + +**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 and remember its your session name)* so you can run the bot in background without having to keep the PuTTY running. + +**Next, we need to run `linuxAIO.sh` in order to get the latest running scripts with patches:** + +- `cd ~ && bash linuxAIO.sh` + +From the options, + +Choose `3` To Run the bot normally. +**NOTE:** With option `3` (Running Normally), if you use `.die` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#administration) in discord. The bot will shut down and will stay offline until you manually run it again. (best if you want to check the bot.) + +Choose `4` To Run the bot with Auto Restart. +**NOTE:** With option `4` (Running with Auto Restart), bot will auto run if you use `.die` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#administration) making the command `.die` to function as restart. + +See how that happens: + +![img9](https://cdn.discordapp.com/attachments/251504306010849280/251506312893038592/die_explaination.gif) + +**Remember** that, while running with Auto Restart, you will need to [close the tmux session](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#restarting-nadeko) to stop the bot completely. + +**Now check your Discord, the bot should be online** + +Next to **move the bot to background** and to do that, press **CTRL+B+D** (this will detach the nadeko session using TMUX), and you can finally close PuTTY now. + +####Restarting Nadeko + +**Restarting Nadeko with the Server:** + +Open **PuTTY** and login as you have before, type `reboot` and hit Enter. + +**Restarting Manually:** + +- Kill your previous session, check with `tmux ls` +- `tmux kill-session -t nadeko` (don't forget to replace "nadeko" to what ever you named your bot's session) +- [Run the bot again.](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#running-nadekobot) + +####Updating Nadeko + +- Connect to the terminal through PuTTY. +- `tmux kill-session -t nadeko` (don't forget to replace **nadeko** in the command with the name of your bot's session) +- Make sure the bot is **not** running. +- `tmux new -s nadeko` (**nadeko** is the name of the session) +- `cd ~ && bash linuxAIO.sh` +- Choose either `1` or `2` to update the bot with **latest build** or **stable build** respectively. +- Choose either `3` or `4` to run the bot again with **normally** or **auto restart** respectively. +- Done. You can close PuTTY now. + +####Installing Manually (Optional) + +#####Installing Git ![img1](https://cdn.discordapp.com/attachments/251504306010849280/251504416019054592/git.gif) @@ -38,14 +193,14 @@ CentOS: **NOTE:** If the command is not being initiated, hit **Enter** -####Installing .NET Core SDK +#####Installing .NET Core SDK ![img2](https://cdn.discordapp.com/attachments/251504306010849280/251504746987388938/dotnet.gif) Go to [this link](https://www.microsoft.com/net/core#ubuntu) (for Ubuntu) or to [this link](https://www.microsoft.com/net/core#linuxcentos) (for CentOS) provided by microsoft for instructions on how to get the most up to date version of the dotnet core sdk! Make sure that you're on the correct page for your distribution of linux as the guides are different for the various distributions -We'll go over the steps here for Ubuntu 16.04 anyway (these will **only** work on Ubuntu 16.04), accurate as of 25/11/2016 +We'll go over the steps here for Ubuntu 16.04 anyway (these will **only** work on Ubuntu 16.04), accurate as of 3/2/2017 ``` sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list' @@ -55,7 +210,7 @@ sudo apt-get update && sudo apt-get install dotnet-dev-1.0.0-preview2.1-003177 - **NOTE:** .NET CORE SDK only supports 64-bit Linux Operating Systems (Raspberry Pis are not supported because of this) -####Installing Opus Voice Codec and libsodium +#####Installing Opus Voice Codec and libsodium ![img3](https://cdn.discordapp.com/attachments/251504306010849280/251505294654308353/libopus.gif) @@ -67,7 +222,7 @@ CentOS: `yum -y install opus opus-devel` -####Installing FFMPEG +#####Installing FFMPEG ![img4](https://cdn.discordapp.com/attachments/251504306010849280/251505443111829505/ffmpeg.gif) @@ -101,7 +256,7 @@ echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sou sudo apt-get update && sudo apt-get install ffmpeg -y ``` -####Installing TMUX +#####Installing TMUX ![img5](https://cdn.discordapp.com/attachments/251504306010849280/251505519758409728/tmux.gif) @@ -113,33 +268,7 @@ Centos: `yum -y install tmux` -####Getting NadekoBot - -Use the following command to get and run `linuxAIO.sh`: -(Remember **DO NOT** rename the file `linuxAIO.sh`) - -`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/master/linuxAIO.sh && bash linuxAIO.sh` - -Follow the on screen instructions: - -1. To Get the latest build. (most recent updates) -2. To Get the stable build. - -Choose either `1` or `2` then press `enter` key. -Once Installation is completed you should see the options again. -Next, choose `5` to exit. - -####Creating and Inviting bot - -- Read here how to [create a DiscordBot application](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#creating-discordbot-application) -- [Visual Invite Guide](http://discord.kongslien.net/guide.html) *NOTE: Client ID is your Bot ID* -- Copy your `Client ID` from your [applications page](https://discordapp.com/developers/applications/me). -- Replace the `12345678` in this link `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with your `Client ID`. -- The link should now look like this: `https://discordapp.com/oauth2/authorize?client_id=**YOUR_CLENT_ID_HERE**&scope=bot&permissions=66186303`. -- Go to the newly created link and pick the server we created, and click `Authorize`. -- The bot should have been added to your server. - -####Guide for Advance Users +####Guide for Advance Users (Optional) **Skip this step if you are a Regular User or New to Linux.** @@ -158,23 +287,23 @@ Next, choose `5` to exit. ####Setting up SFTP -- Open **CyberDuck** -- Click on **Open Connection** (top-left corner), a new window should appear. -- You should see **FTP (File Transfer Protocol)** in drop-down. -- Change it to **SFTP (SSH File Transfer Protocol)** -- Now, in **Server:** paste or type in your `Digital Ocean Droplets IP address`, leave `Port: 22` (no need to change it) +- Open **WinSCP** +- Click on **New Site** (top-left corner). +- On the right-hand side, you should see **File Protocol** above a drop-down selection menu. +- Select **SFTP** *(SSH File Transfer Protocol)* if its not already selected. +- Now, in **Host name:** paste or type in your `Digital Ocean Droplets IP address` and leave `Port: 22` (no need to change it). - In **Username:** type `root` - In **Password:** type `the new root password (you changed at the start)` -- Click on **Connect** -- It should show you the NadekoBot folder which was created by git earlier +- Click on **Login**, it should connect. +- It should show you the NadekoBot folder which was created by git earlier on the right-hand side window. - Open that folder, then open the `src` folder, followed by another `NadekoBot` folder and you should see `credentials.json` there. ####Setting up credentials.json - Copy the `credentials.json` to desktop - EDIT it as it is guided here: [Setting up credentials.json](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-credentialsjson-file) -- Paste/put it back in the folder once done. `(Using CyberDuck/WinSCP)` -- **If** you already have Nadeko 1.0 setup and have `credentials.json` and `NadekoBot.db`, you can just copy and paste the `credentials.json` to `NadekoBot/src/NadekoBot` and `NadekoBot.db` to `NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.0/data` using CyberDuck. +- Paste/put it back in the folder once done. `(Using WinSCP)` +- **If** you already have Nadeko 1.0 setup and have `credentials.json` and `NadekoBot.db`, you can just copy and paste the `credentials.json` to `NadekoBot/src/NadekoBot` and `NadekoBot.db` to `NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.0/data` using WinSCP. - **If** you have Nadeko 0.9x follow the [Upgrading Guide](http://nadekobot.readthedocs.io/en/latest/guides/Upgrading%20Guide/) ####Setting up Music @@ -183,80 +312,18 @@ To set up Nadeko for music and Google API Keys, follow [Setting up NadekoBot for Once done, go back to **PuTTY** -####Running NadekoBot +####Some more Info -**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 and remember its your session name)* so you can run the bot in background without having to keep the PuTTY running. - -**Next, we need to run `linuxAIO.sh` in order to get the latest running scripts with patches:** - -- `cd ~ && bash linuxAIO.sh` - -From the options, - -Choose `3` To Run the bot normally. -**NOTE:** With option `3` (Running Normally), if you use `.die` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#administration) in discord. The bot will shut down and will stay offline until you manually run it again. (best if you want to check the bot.) - -Choose `4` To Run the bot with Auto Restart. -**NOTE:** With option `4` (Running with Auto Restart), bot will auto run if you use `.die` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#administration) making the command `.die` to function as restart. - -See how that happens: - -![img9](https://cdn.discordapp.com/attachments/251504306010849280/251506312893038592/die_explaination.gif) - -**Remember** that, while running with Auto Restart, you will need to [close the tmux session](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#restarting-nadeko) to stop the bot completely. - -**Now check your Discord, the bot should be online** - -Next to **move the bot to background** and to do that, press **CTRL+B+D** (this will detach the nadeko session using TMUX), and you can finally close PuTTY now. - -####Some more Info (just in case) - -**Info about tmux:** +#####Info about tmux - If you want to **see the sessions** after logging back again, type `tmux ls`, and that will give you the list of sessions running. - If you want to **switch to/ see that session**, type `tmux a -t nadeko` (**nadeko** is the name of the session we created before so, replace **“nadeko”** with the session name you created.) - If you want to **kill** NadekoBot **session**, type `tmux kill-session -t nadeko` -**If you are running Ubuntu 16.10, and having trouble installing .NET Core:** - -- Go to [Download Page for libicu55_55.1-7_amd64.deb](http://packages.ubuntu.com/en/xenial/amd64/libicu55/download) -- Copy the link with a download option closest to you -- `wget ` *e.g.* `wget http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu55_55.1-7_amd64.deb` (make sure it is downloaded) -- Install with: `dpkg –i libicu55_55.1-7_amd64.deb` -- Now go back and install the .NET Core - -####Restarting Nadeko - -**Restarting Nadeko with the Server:** - -Open **PuTTY** and login as you have before, type `reboot` and hit Enter. - -**Restarting Manually:** - -- Kill your previous session, check with `tmux ls` -- `tmux kill-session -t nadeko` (don't forget to replace "nadeko" to what ever you named your bot's session) -- [Run the bot again.](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#running-nadekobot) - -####Updating Nadeko - -- Connect to the terminal through PuTTY. -- `tmux kill-session -t nadeko` (don't forget to replace **nadeko** in the command with the name of your bot's session) -- Make sure the bot is **not** running. -- `tmux new -s nadeko` (**nadeko** is the name of the session) -- `cd ~ && bash linuxAIO.sh` -- Choose either `1` or `2` to update the bot with **latest build** or **stable build** respectively. -- Choose either `3` or `4` to run the bot again with **normally** or **auto restart** respectively. -- Done. You can close PuTTY now. - -####Alternative way to Install +#####Alternative way to Install If the [Nadeko installer](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#getting-nadekobot) shows any kind error, check if you have the `linuxAIO.sh` file and make sure its not renamed or if you want to manually install the bot. Use the following command(s): - ![img6](https://cdn.discordapp.com/attachments/251504306010849280/251505587089571850/getting_nadeko.gif) `cd ~ && curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh` @@ -264,7 +331,7 @@ If the [Nadeko installer](http://nadekobot.readthedocs.io/en/latest/guides/Linux **OR** ``` -cd ~ && git clone -b 1.0 --recursive --depth 1 https://github.com/Kwoth/NadekoBot.git +cd ~ && git clone -b dev --recursive --depth 1 https://github.com/Kwoth/NadekoBot.git cd ~/NadekoBot/discord.net/src/Discord.Net && dotnet restore && cd ../Discord.Net.Commands && dotnet restore && cd ../../../src/NadekoBot/ && dotnet restore && dotnet build --configuration Release ```