Notes for initializing a minimal Debian 10 (Buster) server
su -
apt-get install sudo -y
useradd user # if user was not created on build
usermod -aG sudo user
sudo iptables -A INPUT -p udp --dport xxxx -j ACCEPT
sudo iptables -A INPUT -p udp --sport xxxx -j ACCEPT
or if inserting somewheres
sudo iptables -I INPUT -p tcp -m tcp --dport xxxx [--sport xxxx, if needed] -j ACCEPT
persistent iptables, follow prompt
apt-get install iptables-persistent -y
persistence for custom services
if systemd is your flavor, use your unit file at /etc/systemd/system/service.service
[Unit]
Description =Enter Description Here
Wants =network-online.target
After =syslog.target network.target
[Service]
WorkingDirectory =/opt/service-server
User =service-user
Type =forking
ExecStart =/opt/service-server/service-server.sh start initfile =ts3server.ini
ExecStop =/opt/service-server/service-server.sh stop
ExecReload =/opt/service-server/service-server.sh reload
PIDFile =/opt/service-server/service.pid
[Install]
WantedBy =multi-user.target
systemctl enable --now service.service
if init.d is your flavor, use your service file at /etc/init.d/service
#! /bin/sh
# ## BEGIN INIT INFO - EXAMPLE
# Provides: service
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: service Server
# ## END INIT INFO
# #####################################
# Customize values for your needs: "User"; "DIR"
USER=" user"
DIR=" /opt/service"
# # service server start/stop script ##
case " $1 " in
start)
su $USER -c " ${DIR} /service_script.sh start"
;;
stop)
su $USER -c " ${DIR} /service_script.sh stop"
;;
restart)
su $USER -c " ${DIR} /service_script.sh restart"
;;
status)
su $USER -c " ${DIR} /service_script.sh status"
;;
* )
echo " Usage: {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0
copy to service start file
cd /etc/rc3.d
ln -s ../init.d/{SERVICENAME} S95{SERVICENAME}