-
Notifications
You must be signed in to change notification settings - Fork 26
1.1 Install (Debian 8 System Guide)
This guide is provided and maintained by Sho Yumimura
adduser youusername sudo sudo apt-get install sudo sudo apt-get install fail2ban
Guide to install the Discord bot to Debian 8 Systems (mostly Commands)
1: We need to install LAMP Stack (Linux, Apache, MySql, PHP) Programms to our System. Commands are as followed (Follow the Instructions on the Screen):
1a: sudo apt-get install apache2 ##This will install Apache2 on your Server sudo systemctl restart apache2 ##This will Restart only your Apache2 Server
1b: sudo apt-get install mysql-server ##This will install mysql-server to your Server sudo mysql_secure_installation ##This will help you configure some of the mysql settings (Write down your password on a paper / note)
1b.a: Connect as root user to your Mysql server with "sudo mysql -u root -p" ## (enter the root mysql password)
1b.b: Type "CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';" ## Edit the entrys newuser and password to your liking : example: CREATE USER 'discordbot'@'localhost' IDENTIFIED BY 'americanr2';
1b.c: Now type "GRANT ALL PRIVILEGES ON . TO 'newuser'@'localhost';" ## again edit the newuser entry to your linking : example: GRANT ALL PRIVILEGES ON . TO 'discordbot'@'localhost';
## Remember that now the user "newuser" has all privileges to edit all Database´s and tables to his liking.
1b.d: Create your database by typing "CREATE database discord;" ## This will create the database "discord" witch our user "newuser" already hass full acces to.
1b.e now the last step for mysql part type "flush privileges;" ## This reads the new permissions and databases we set and is then ready for use.
1c: sudo apt-get install php5 php-pear php5-mysql ## this will install PhP and some PhP Support Modules to your Server.
1c.1: sudo systemctl restart apache2 ## Restart the Apache2 Server to allow the new php modules to be used.
1d: If everything is done right you should now be able to see the default Apache page on your server _## just type in your Server ip in the Browser (example Firefox) and hit enter. _
Step 4 - Register your bot
Head on over to https://discordapp.com/developers/applications/me and register an application. Name it whatever you want the bot to be named. One the app is created click the Create Bot User button. This will give you the token for the config file. Step 5 - Invite your bot
Now that the bot is running you need to invite it to your server. Go back to your discord application page and look for the client/app id. Next head too https://discordapp.com/oauth2/authorize?&client_id=**INSERT_ID_HERE**&scope=bot and authorize it for your desired server.
2: Our LAMP Server is up and running. Time to setup the Discord bot and its necessary components. for the sake of argument we will belive that the user "discord" was created on the Linux Server and he is in his home directory: /home/discord/ . So we start with the command
2a: sudo apt-get install curl php5-cli git php5-mysqlnd libsqlite3-dev php5-sqlite php5-curl ## This will install requierd modules to run the Bot to the Server
2b: sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer ## This will install composer to the Server (witch is needed) ## If you are logged in as root, remove the sudo command !!!
2c: git clone https://github.com/shibdib/Dramiel.git ## This is the best part Shiddb and his Boys "Discord-Bot" is being downloaded (always the latest release)
2d: Now change to the new directory where dramiel is. In our case its "cd /home/discord/Dramiel" ## Changes directory for the next Command
2e: sudo composer install ## This will install all dependencies for the Dramiel-Discord-Bot
2f: Change Directory again by typing "cd /home/discord/Discord/config" , now we edit the config.php.new file with all the information we gatherd while setting up our Server, and save it as config.php in the config folder. You need the token from the Discord site witch you already registered (See Part1.5) you also need you eve API Keys (etc...) and also the mysql username, password, database name and so on. If you need help ask in the Disord Channel.
2g: The easiest way to launch this bot is to use supervisord. Install supervisord with sudo apt-get install supervisor and follow that with a supervisorctl restart.
Next head to /etc/supervisor/conf.d and once here create a file called dramiel.conf
Inside this file include the following (if you know what you're doing edit to your choosing.)
[program:dramiel]
command=php /directory to your bot folder/Dramiel/Dramiel.php
autostart=true
autorestart=true
stopasgroup=true
stderr_logfile=/directory to your bot folder/Dramiel/log/dramielError.log
stdout_logfile=/directory to your bot folder/Dramiel/log/dramielOther.log
stdout_logfile_maxbytes=100KB
stdout_logfile_backups=3
stderr_logfile_maxbytes=100KB
stderr_logfile_backups=3
priority=998
Now save that file and run supervisorctl update which will detect and start your bot. In the future to start/stop/restart the bot use supervisorctl start/stop/restart dramiel
Now your Done :P
- Go to your home folder and create a file called "update.sh" (with nano for example) and make it executeable by "sudo chmod +x update.sh"
- paste the following lines into the file "update.sh"
#!/bin/bash
supervisorctl stop dramiel
cd /home/yourname/Dramiel
git stash
git pull --no-edit origin master
composer update
supervisorctl start dramiel
- After saving the file you can start the file by typing "./update.sh" ## this will stop the bot, update the bot to the newest Release from github, and then start it again (thanks Shiddb)
Have a good time