-
-
Notifications
You must be signed in to change notification settings - Fork 10
Setting up the API Linux(Debian)
It is recomended to use a VPS(Virtual Private Server) as close as you can get to your servers, but if you have servers in multiple regions you can pick a place somewhere in the middle
If your provider doesn't offer VPSs or they are too expensive you can use my recommendation Vultr Referal Link For Vultr if use this link to get 100$ in credits for your first month, it also gives me 25$ in credits at the same time 👍
If you are using Vultr See the steps below on how to buy a VPS from Vultr If you are using another provider follow the steps below to install on Debian 10
- Buying a server from Vultr
- Setting up a Linux server
- Securing the Linux Server
- Installing the Database (MongoDB)
- Installing the API Service
- If you already have access to the server via SSH skip to Setting up continued
- If you already know how to set up a Linux server just skip down to Installing MongoDB
- Add a user this way its harder for people to hack inrun
adduser dayz
a
and enter a secure password
- run
adduser dayz sudo
Disable root from logging in
3. nano /etc/ssh/sshd_config
edit PermitRootLogin
to be no
PermitRootLogin no
- run
service sshd restart
Connect to the server via putty Putty Download
Run all updates
sudo apt update && sudo apt upgrade -y
-
sudo apt install ufw
-
sudo ufw allow ssh
DON'T MISS THIS STEP -
sudo ufw enable
enter y for yes
(this is optional but recommended for larger communities that might see people trying to hack into their API)
If someone is trying to hack into it should block there IP for about 10 minutes, you can edit this in the config
sudo apt install fail2ban
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo service fail2ban restart
(Scroll up if you need instruction on how to set up a Linux server)
If you are using a lower core or cheaper VPS I recommend skipping the installation of MongoDB and using the free Tier of Atlas
These are the steps for installing on Debian 10 if using a different operating system reference Mongo DB official Documentaion
- Install
sudo apt-get install -y gnupg
sudo wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl start mongod
sudo systemctl daemon-reload
sudo systemctl enable mongod
sudo systemctl status mongod
sudo mkdir /var/opt/DayZWebApi
cd /var/opt/DayZWebApi
sudo wget https://github.com/daemonforge/DayZ-UniveralApi/releases/download/Latest-Linux/dayzwebservice-linux
sudo chmod +x dayzwebservice-linux
-
sudo nano /etc/systemd/system/DayZWebService.service
copy and paste the below into the terminal thenctr - x
[Unit]
Description=DayZ Webservice
[Service]
ExecStart=/var/opt/DayZWebApi/dayzwebservice-linux
Restart=always
User=root
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nogroup
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/var/opt/DayZWebApi
[Install]
WantedBy=multi-user.target
sudo systemctl start DayZWebService
sudo systemctl enable DayZWebService
sudo journalctl -xe -u DayZWebService
- make sure you see
API Webservice listening on port "443"! Go to https://localhost:443/
For your first run you should also see the default config that was generated, you can also load this by editing it by calling sudo cat /var/opt/DayZWebApi/config.json
sudo ufw allow 443
-
reqbin.com - Change to POST and use your server
https://[SERVERIP]/Status
- if you see this then it is working!
{
"Status": "ok",
"Error": "noauth"
}