Compare commits

..

2 Commits

Author SHA1 Message Date
33b9bbc76f moving fast before testing 2024-07-18 19:08:14 +02:00
6d9c423ab7 fixing depandencies 2024-07-18 18:52:56 +02:00
3 changed files with 30 additions and 37 deletions

View File

@ -8,15 +8,7 @@ WantedBy=multi-user.target
[Service] [Service]
ExecReload=/usr/bin/screen -S minecraft -X stuff \"reload^M\" ExecReload=/usr/bin/screen -S minecraft -X stuff \"reload^M\"
ExecStart=/usr/bin/screen -DmS minecraft ./run.sh ExecStart=/usr/bin/screen -DmS minecraft ./start.sh
#ExecStartPre=/bin/sh -c '/usr/bin/screen -dmS mc-perfect'
#ExecStart=/bin/sh -c '/opt/minecraft/run.sh'
#ExecStop=/usr/bin/screen -S minecraft -X stuff \"save-all^M\"
#ExecStop=/bin/sleep 5
#ExecStop=/usr/bin/screen -S minecraft -X stuff \"stop^M\"
#ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN. Saving map..."\\015'
ExecStop=/bin/sh -c '/bin/sleep 5' ExecStop=/bin/sh -c '/bin/sleep 5'
@ -24,8 +16,8 @@ ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "save-all"\\015'
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015' ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\\015'
ExecStop=/bin/sh -c '/bin/sleep 10' ExecStop=/bin/sh -c '/bin/sleep 10'
#Restart=on-failure Restart=on-failure
#RestartSec=60s RestartSec=60s
ProtectControlGroups=true ProtectControlGroups=true
ProtectHome=true ProtectHome=true

View File

@ -1,9 +0,0 @@
# Xmx and Xms set the maximum and minimum RAM usage, respectively.
# They can take any number, followed by an M or a G.
# M means Megabyte, G means Gigabyte.
# For example, to set the maximum to 3GB: -Xmx3G
# To set the minimum to 2.5GB: -Xms2500M
# A good default for a modded server is 4GB.
# Uncomment the next line to set it.
# -Xmx4G

View File

@ -13,7 +13,7 @@ if [[ "$ansFirewallSetup" =~ ("N"|"n") ]]; then
printf "+ Thanks, working on next bit\n" printf "+ Thanks, working on next bit\n"
else elif [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z $ansFirewallSetup ]]; then
printf "Do you want to block non-LAN ssh connections? [Y/n/castom]: " printf "Do you want to block non-LAN ssh connections? [Y/n/castom]: "
read sshBlockRange read sshBlockRange
@ -58,10 +58,17 @@ sudo apt upgrade -y
# Installing depandencies # Installing depandencies
printf "\n+ Installing depandencies \n\n" printf "\n+ Installing depandencies \n\n"
sudo apt install openjdk-17-jre-headless screen p7zip-full iptables -y sudo apt install openjdk-21-jre-headless screen -y
if [[ "$ansFirewallSetup" =~ ("y"|"Y") || -z $ansFirewallSetup ]]; then
sudo apt install iptables -y
fi
# User and groupe managment # User and groupe managment
printf "\n+ Creating user minecraft and basic file structure" printf "\n+ Creating user minecraft and basic file structure"
groupadd minecraft groupadd minecraft
useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft minecraft useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft minecraft
@ -69,28 +76,30 @@ useradd --system --shell /usr/sbin/nologin --home /opt/minecraft -g minecraft mi
# File strukture and basic install # File strukture and basic install
mkdir /opt/minecraft mkdir /opt/minecraft
mv data/Forge-1.20.1.jar /opt/minecraft/ mv data/paper-1.20.6-148.jar /opt/minecraft/
cd /opt/minecraft/ cd /opt/minecraft/
# Installing server # Installing server
printf "+ Installing Forge 1.20.1 \n \n" printf "+ Installing Paper 1.20.6 \n \n"
java -Xms512M -Xmx2048M -jar Forge-1.20.1.jar --installServer java -Xms512M -Xmx2048M -jar paper-1.20.6-148.jar --nogui
cd - cd -
cd data/ cd data/
mv eula.txt server-icon.png server.properties run.sh user_jvm_args.txt /opt/minecraft/ mv eula.txt server-icon.png server.properties user_jvm_args.txt /opt/minecraft/
cd .. cd ..
mkdir /opt/minecraft/mods ### Addons support???
printf "\n+ Unpacking mods \n \n" # mkdir /opt/minecraft/mods
cd data # printf "\n+ Unpacking mods \n \n"
7z x Mods.zip -o/opt/minecraft/mods/
cd .. # cd data
# 7z x Mods.zip -o/opt/minecraft/mods/
# cd ..
# Permision handeling # Permision handeling
printf "\n+ Permision handeling\n" printf "\n+ Permision handeling\n"
@ -98,11 +107,11 @@ chown -R minecraft:minecraft /opt/minecraft
# SystemD service # SystemD service
printf "+ Preparign systemD service\n" printf "+ Preparign systemD service\n"
mv data/mc-forge.service /etc/systemd/system/ mv data/mc-paper.service /etc/systemd/system/
systemctl daemon-reload systemctl daemon-reload
systemctl start mc-forge.service systemctl start mc-paper
systemctl enable mc-forge systemctl enable mc-paper
# integration of Maxopoly's instructions on firewall # integration of Maxopoly's instructions on firewall
@ -134,15 +143,16 @@ if [[ "$ansFirewallSetup" =~ ("Y"|"y") || -z "$ansFirewallSetup" ]]; then
iptables -P OUTPUT ACCEPT #Allow all outgouing iptables -P OUTPUT ACCEPT #Allow all outgouing
sudo apt install iptables-persistent -y
else else
printf "\nOK it is time for manual configuration" printf "\nOK it is time for manual configuration"
printf "\nAfter you are done ramamber to run 'apt install iptables-persistent' to save your config. System will automaticly remove your work after restart" printf "\nAfter you are done ramamber to run 'apt install iptables-persistent' to save your config. System will automaticly remove your work after restart \n \n"
fi fi
apt install iptables-persistent -y
fi fi
printf "\n+ Done, thanks for your time. It is goode idea to chack if everythink is alright by running:" printf "\n+ Done, thanks for your time. It is goode idea to chack if everythink is alright by running:"