Jump to content

Linux (Debian) Tutorial: setting up a Tekkit server


Recommended Posts

Hello,

I had some problems with setting up a server on Debian. But now my server is up and running. So to prevent problems I made this tutorial. I have Debian on my server but if you have an other Linux distribution it should not be a problem. I use a server based OS so no gui only the command prompt.

Requirements:

Server with Linux/Debian

And patients to read!

Putting the files on your server

Filezilla:

FileZilla Client is a fast and reliable cross-platform FTP, FTPS and SFTP client with lots of useful features and an intuitive graphical user interface.

Step 1: Download and install Filezilla: Download

Step 2: Connect to your server via Filezilla use port 22

Step 3: Download Tekkit_Server_3.1.1.zip: Download

Step 4: Unzip Tekkit_Server_3.1.1.zip

Step 5: Rename the Tekkit_Server_3.1.1 folder tekkit

Step 6: Drag and drop the tekkit folder on the server via Filezilla

DONT use winscp, it will mess with your server files!

Tutorial for remote access to your server via Windows

PuTTY:

PuTTY is a free implementation of Telnet and SSH for Windows and Unix platforms, along with an xterm terminal emulator

Step 1: Download PuTTY Download

Step 2: Connect to your server via PuTTY

2nsnf9e.png

Step 3: Use SSH and the ip or the address from your server.

Step 4: Click on Open

Tutorial setting up the server

Installing java 7

Step 1: Use these commands. I used them also and it worked :D

use the commands one after the other.

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" > /etc/apt/sources.list.d/webupd8team-java.list

echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list.d/webupd8team-java.list

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886

apt-get update

apt-get install oracle-java7-installer

exit


Step 2: Check if you have java 7 with this command:


java -version


Step 3: This should be displayed:


java version "1.7.0_05"

Java SE Runtime Environment (build 1.7.0_05-b05)

Java HotSpot Client VM (build 23.1-b03, mixed mode)


 

Installing screen

 

Step 1: Use this command:


apt-get install screen


 

Installing server (finally)

Step 1: Make a new screen:


screen -S minecraft


Step 2: Cd the tekkit folder:


cd tekkit


Step 3: use chmod to give launch.sh permissions to be executable:


chmod 777 launch.sh


Step 4: Start the server:


./launch.sh


 

Detaching from screen

Step 1: Use CTRL+A+D to detach

Step 2: To attach:


screen -r minecraft

I hope it's all clear and you have a running server now. This is my first tutorial and im also not an expert in Linux. I'm Dutch so sorry if the English is bad and the grammar mixed up. If you have an error or a question feel free to ask. I don't guarantee I can answer them.

Link to comment
Share on other sites

  • 3 weeks later...

Nice tutorial! It helped me a lot :)

I have a VPS running Debian and I was wondering if there is a way to make Debian execute "launch.sh" automatically on startup/reboot?

It would be a pain in the ass if I had to manually log in via ssh and start the servers every time the server reboots.

Any ideas?

Link to comment
Share on other sites

Nice tutorial! It helped me a lot :)

I have a VPS running Debian and I was wondering if there is a way to make Debian execute "launch.sh" automatically on startup/reboot?

It would be a pain in the ass if I had to manually log in via ssh and start the servers every time the server reboots.

Any ideas?

I was wondering the same. This is a great guide btw.

Link to comment
Share on other sites

I was wondering the same. This is a great guide btw.

Hello,

Sorry for responding late, but im just back from holidays. Sorry but im not good at making scrips so i cant help you. But if somebody else can make a script it would help you and many other people (like me) A LOT!

Link to comment
Share on other sites

  • 1 month later...

Heya all, I've just joined the forums and saw this guide with the question about starting on server reboot..

Try this, but change the launch.sh path if required:

echo '#!/bin/sh -e' > /etc/rc0.d/StartTekkit

echo '/srv/tekkit/launch.sh' >> /etc/rc0.d/StartTekkit

echo '#!/bin/sh -e' > /etc/rc1.d/StartTekkit

echo '/srv/tekkit/launch.sh' >> /etc/rc1.d/StartTekkit

echo '#!/bin/sh -e' > /etc/rc2.d/StartTekkit

echo '/srv/tekkit/launch.sh' >> /etc/rc2.d/StartTekkit

echo '#!/bin/sh -e' > /etc/rc3.d/StartTekkit

echo '/srv/tekkit/launch.sh' >> /etc/rc3.d/StartTekkit

echo '#!/bin/sh -e' > /etc/rc4.d/StartTekkit

echo '/srv/tekkit/launch.sh' >> /etc/rc4.d/StartTekkit

echo '#!/bin/sh -e' > /etc/rc5.d/StartTekkit

echo '/srv/tekkit/launch.sh' >> /etc/rc5.d/StartTekkit

Link to comment
Share on other sites

  • 1 month later...

A word of advice, never give any script 777 permission because that gives everyone write permission to it. And if someone edits the script without your knowledge and you run it, it could do something nasty in your username. If you want anyone to be able to run it, 755 is typical, or possibly 775 if you want someone else in your group to be able to edit it. Otherwise just used chmod u+x for execute permission for just you, or a+x to give all (everyone) execute permission, without changing write permission.

In 64-bit Ubuntu 12.04 (which is debian based) using openjdk-6, all I really needed to do to run tekkit 3.1.2 server was give launch.sh execute permission and run it. However, it gagged on mod_NetherOres.jar. Once I changed the file extension on that mod to .jar-bu so it would be ignored, the server ran fine. Not sure if mod_NetherOres is corrupt (error said it could not read it, but also something about major/minor version issue), or maybe NetherOres is the only thing in tekkit 3.1.2 that requires Java 7 (apparently for quite a few tekkit versions). Vanilla minecraft client and server or tekkit client completely work (including nether ores) with openjdk-6, and tekkit server does too if mod_NetherOres.jar is removed.

Link to comment
Share on other sites

A word of advice, never give any script 777 permission because that gives everyone write permission to it. And if someone edits the script without your knowledge and you run it, it could do something nasty in your username. If you want anyone to be able to run it, 755 is typical, or possibly 775 if you want someone else in your group to be able to edit it. Otherwise just used chmod u+x for execute permission for just you, or a+x to give all (everyone) execute permission, without changing write permission.

In 64-bit Ubuntu 12.04 (which is debian based) using openjdk-6, all I really needed to do to run tekkit 3.1.2 server was give launch.sh execute permission and run it. However, it gagged on mod_NetherOres.jar. Once I changed the file extension on that mod to .jar-bu so it would be ignored, the server ran fine. Not sure if mod_NetherOres is corrupt (error said it could not read it, but also something about major/minor version issue), or maybe NetherOres is the only thing in tekkit 3.1.2 that requires Java 7 (apparently for quite a few tekkit versions). Vanilla minecraft client and server or tekkit client completely work (including nether ores) with openjdk-6, and tekkit server does too if mod_NetherOres.jar is removed.

Ewewewew openjdk

Use oracle java 7

Although in general this is a very nice thread :)

Link to comment
Share on other sites

  • 2 weeks later...

Hi all,

Sorry to necro an old thread, but i can seem to find the answer and it is related to this thread.

So i got my tekkit server running and auto starting based on info here. I'm using ubuntu server (media machine, just figured id get ore use out of it).

My question is , how do i gracefully shutdown the tekkit server if the system is rebooting with out logging into the screen manually? i've tried to figure out the command, but "sudo screen -X 1011.Tekkit stop" doesnt do anything.

thanks in advance

Link to comment
Share on other sites

  • 1 month later...

Here's a short manual for if you don't want to use FileZilla but do have access via SSH:

We'll start by making ourself root using sudo, if you login using the root username (which is generally a bad habbit) you can skip this step.

sudo su


You'll probably be asked for your password

 

Now lets continue by going into a shared location and creating a new tekkit folder


cd /usr/share/

mkdir tekkit

cd tekkit

wget http://mirror.technicpack.net/files/Tekkit_Server_3.1.1.zip



Now we'll install unzip, if you already have unzip (and can run an unzip command you can skip this step)


sudo apt-get install unzip


Now we unzip the server, so all files are moved to ~/tekkit/


unzip Tekkit_Server_3.1.1.zip


And now we remove the downloaded zip file, we already extracted it's contents


rm Tekkit_Server_3.1.1.zip


 

From here on, you can follow Ronneke's guide, I posted it below with some modifications to clear certain things up.


echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" > /etc/apt/sources.list.d/webupd8team-java.list

 

echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list.d/webupd8team-java.list


 

Update apt and get java via apt-get.


apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886

apt-get update

apt-get install oracle-java7-installer


 

You will have to accept to a license from Oracle, Click OK and Yes when prompted

 

Test if you have java by running


java -version


It should display something like


java version "1.7.0_10"

Java SE Runtime Environment (build 1.7.0_10-b18)

Java HotSpot 64-Bit Server VM (build 23.6-b04, mixed mode)


Should you get errors, make sure you've installed java correctly

 

Now, get the screen package


apt-get install screen


And make a new screen for Minecraft (well... Tekkit in this case)


screen -S minecraft


 

I had some errors when launching lauch.sh so I simply entered this in my terminal and hit enter


java -Xmx768M -Xms512M -jar /usr/share/tekkit/Tekkit.jar nogui


 

 

Making the server auto-boot on system start

Make sure the server isn't running before you start doing this, else you might end up with two servers running at the same time which will not go very well (you will screw up your server and the world)

To make the system start the Tekkit server automatically on system boot we need to do the following;

 

Go to the daemon directory


cd /etc/init.d/


 

Create a new file, I use nano but you can use any editor you like.


nano -w tekkit


 

Now paste the following (in PuTTY, it's done by regularly copying the following code and then right-clicking on the Terminal screen)


#!/bin/bash

# /etc/init.d/tekkit

# version 0.3.9 2012-08-13 (YYYY-MM-DD)

 

### BEGIN INIT INFO

# Provides:  tekkit

# Required-Start: $local_fs $remote_fs

# Required-Stop:  $local_fs $remote_fs

# Should-Start:  $network

# Should-Stop:    $network

# Default-Start:  2 3 4 5

# Default-Stop:  0 1 6

# Short-Description:    Tekkit server

# Description:    Starts the tekkit server

### END INIT INFO

 

#Settings

SERVICE='Tekkit.jar'

OPTIONS='nogui'

USERNAME='root'

WORLD='world'

MCPATH='/usr/share/tekkit'

BACKUPPATH='/usr/share/tekkit/backup/tekkit.backup'

MAXHEAP=2048

MINHEAP=1024

HISTORY=1024

CPU_COUNT=1

INVOCATION="java -Xmx${MAXHEAP}M -Xms${MINHEAP}M -XX:+UseConcMarkSweepGC \

-XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts \

-jar $SERVICE $OPTIONS"

 

ME=`whoami`

as_user() {

  if [ $ME == $USERNAME ] ; then

    bash -c "$1"

  else

    su - $USERNAME -c "$1"

  fi

}

 

mc_start() {

  if  pgrep -u $USERNAME -f $SERVICE > /dev/null

  then

    echo "$SERVICE is already running!"

  else

    echo "Starting $SERVICE..."

    cd $MCPATH

    as_user "cd $MCPATH && screen -h $HISTORY -dmS minecraft $INVOCATION"

    sleep 7

    if pgrep -u $USERNAME -f $SERVICE > /dev/null

    then

      echo "$SERVICE is now running."

    else

      echo "Error! Could not start $SERVICE!"

    fi

  fi

}

 

mc_saveoff() {

  if pgrep -u $USERNAME -f $SERVICE > /dev/null

  then

    echo "$SERVICE is running... suspending saves"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP STARTING. Server going readonly...\"\015'"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-off\"\015'"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"

    sync

    sleep 10

  else

    echo "$SERVICE is not running. Not suspending saves."

  fi

}

 

mc_saveon() {

  if pgrep -u $USERNAME -f $SERVICE > /dev/null

  then

    echo "$SERVICE is running... re-enabling saves"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-on\"\015'"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER BACKUP ENDED. Server going read-write...\"\015'"

  else

    echo "$SERVICE is not running. Not resuming saves."

  fi

}

 

mc_stop() {

  if pgrep -u $USERNAME -f $SERVICE > /dev/null

  then

    echo "Stopping $SERVICE"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"say SERVER SHUTTING DOWN IN 10 SECONDS. Saving map...\"\015'"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"save-all\"\015'"

    sleep 10

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"stop\"\015'"

    sleep 7

  else

    echo "$SERVICE was not running."

  fi

  if pgrep -u $USERNAME -f $SERVICE > /dev/null

  then

    echo "Error! $SERVICE could not be stopped."

  else

    echo "$SERVICE is stopped."

  fi

}

 

mc_backup() {

  mc_saveoff

 

  NOW=`date "+%Y-%m-%d_%Hh%M"`

  BACKUP_FILE="$BACKUPPATH/${WORLD}_${NOW}.tar"

  echo "Backing up minecraft world..."

  #as_user "cd $MCPATH && cp -r $WORLD $BACKUPPATH/${WORLD}_`date "+%Y.%m.%d_%H.%M"`"

  as_user "tar -C \"$MCPATH\" -cf \"$BACKUP_FILE\" $WORLD"

 

  echo "Backing up $SERVICE"

  as_user "tar -C \"$MCPATH\" -rf \"$BACKUP_FILE\" $SERVICE"

  #as_user "cp \"$MCPATH/$SERVICE\" \"$BACKUPPATH/minecraft_server_${NOW}.jar\""

 

  mc_saveon

 

  echo "Compressing backup..."

  as_user "gzip -f \"$BACKUP_FILE\""

  echo "Done."

}

 

mc_command() {

  command="$1";

  if pgrep -u $USERNAME -f $SERVICE > /dev/null

  then

    pre_log_len=`wc -l "$MCPATH/server.log" | awk '{print $1}'`

    echo "$SERVICE is running... executing command"

    as_user "screen -p 0 -S minecraft -X eval 'stuff \"$command\"\015'"

    sleep .1 # assumes that the command will run and print to the log file in less than .1 seconds

    # print output

    tail -n $[`wc -l "$MCPATH/server.log" | awk '{print $1}'`-$pre_log_len] "$MCPATH/server.log"

  fi

}

 

#Start-Stop here

case "$1" in

  start)

    mc_start

    ;;

  stop)

    mc_stop

    ;;

  restart)

    mc_stop

    mc_start

    ;;

  backup)

    mc_backup

    ;;

  status)

    if pgrep -u $USERNAME -f $SERVICE > /dev/null

    then

      echo "$SERVICE is running."

    else

      echo "$SERVICE is not running."

    fi

    ;;

  command)

    if [ $# -gt 1 ]; then

      shift

      mc_command "$*"

    else

      echo "Must specify server command (try 'help'?)"

    fi

    ;;

 

  *)

  echo "Usage: $0 {start|stop|backup|status|restart|command \"server command\"}"

  exit 1

  ;;

esac

 

exit 0


 

Great, now we have the file. Before it works however, we need to run two more commands.


chmod a+x /etc/init.d/tekkit

update-rc.d tekkit defaults


This will fix the rights on the file and then add the file to the boot sequence of the system.

The system might warn you about the script not meeting certain requirements, you can ignore this, the script will work.

 

Now we installed the server daemon, we can start the server.

This is done by running the following


/etc/init.d/tekkit start


(This is executed automatically when the system starts)

 

For more info on available commands do


/etc/init.d/tekkit


You'll get a list of all the available commands.

 

Getting the server to back-up every 30 minutes

This will only work if you installed the script mentioned above.

 

Enter crontab to create a cronjob


crontab -e


 

Add a new line at the end of the file


0,30 * * * * /etc/init.d/tekkit backup
.

This will make the server make a backup at :00 and :30 of every hour (unless the server is offline). If you want to make this an hour, set the first bit that says "0,30" to "0". You can lookup crontab's manual for more details.

 

If you executed the "sudo su" bit at the beginning of this tutorial be sure to type the following and hitting enter:


exit

.

Good luck!

I can't guarantee that this will work on every system, just try some things out.

Link to comment
Share on other sites

Upgrading to java 7 is an advantage. Otherwise if openjdk 7 is avaliable, what is the problem with openjdk?

Well Minecraft is constructed on Oracle Java, and I've just had better performance on it.

yanno, I've never had a problem with winscp messing with server files. it's my preferred method for transferring files.

I have to agree I found WinSCP way better than FileZilla

Link to comment
Share on other sites

Well Minecraft is constructed on Oracle Java, and I've just had better performance on it.

I think it is at the point where Oracle gets openjdk, adds a bit of their proprietary stuff and rebadges it. So does minecraft use the bit of code that is oracle only?

(See: "The corresponding OpenJDK releases will continue to serve as the basis for the Oracle Java Development Kit (JDK) 7 and JDK 8" and "Oracle's commercial JDK releases will be built from the open-source code, for the most part. Since there's some encumbered code in the JDK, Oracle will continue to use that code in commercial releases until it is replaced by fully-functional open-source alternatives")

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

hey dudes,

nice tutorial but i have a problem whit my tekkit server.

if i start the server it comes:

2013-03-10 20:33:33 [FINER] Initializing mod_IC2

2013-03-10 20:33:33 [iNFO] [iC2] Config loaded from /home/tekkit/./config/IC2.cfg

2013-03-10 20:33:33 [sEVERE] java.lang.IllegalArgumentException: Slot 241 is already occupied by codechicken.enderstorage.BlockEnderChest@69afc0da when adding ic2.common.BlockRubSapling@119e5e6b

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.Block.<init>(Block.java:181)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.BlockFlower.<init>(SourceFile:11)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.BlockFlower.<init>(SourceFile:19)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.BlockSapling.<init>(BlockSapling.java:18)

2013-03-10 20:33:33 [sEVERE] at ic2.common.BlockRubSapling.<init>(BlockRubSapling.java:14)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.mod_IC2.load(mod_IC2.java:295)

2013-03-10 20:33:33 [sEVERE] at cpw.mods.fml.common.modloader.ModLoaderModContainer.init(ModLoaderModContainer.java:351)

2013-03-10 20:33:33 [sEVERE] at cpw.mods.fml.common.Loader.modInit(Loader.java:263)

2013-03-10 20:33:33 [sEVERE] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:618)

2013-03-10 20:33:33 [sEVERE] at cpw.mods.fml.server.FMLBukkitHandler.onLoadComplete(FMLBukkitHandler.java:142)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:176)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)

2013-03-10 20:33:33 [sEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)

2013-03-10 20:33:33 [sEVERE] Unexpected exception

java.lang.IllegalArgumentException: Slot 241 is already occupied by codechicken.enderstorage.BlockEnderChest@69afc0da when adding ic2.common.BlockRubSapling@119e5e6b

at net.minecraft.server.Block.<init>(Block.java:181)

at net.minecraft.server.BlockFlower.<init>(SourceFile:11)

at net.minecraft.server.BlockFlower.<init>(SourceFile:19)

at net.minecraft.server.BlockSapling.<init>(BlockSapling.java:18)

at ic2.common.BlockRubSapling.<init>(BlockRubSapling.java:14)

at net.minecraft.server.mod_IC2.load(mod_IC2.java:295)

at cpw.mods.fml.common.modloader.ModLoaderModContainer.init(ModLoaderModContainer.java:351)

at cpw.mods.fml.common.Loader.modInit(Loader.java:263)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:618)

at cpw.mods.fml.server.FMLBukkitHandler.onLoadComplete(FMLBukkitHandler.java:142)

at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:176)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)

at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)

what can i do to fix the problem? i have update ic2 manuell but no changes. on windows 7 the server run whit the same settings.

ivory

Link to comment
Share on other sites

hey dudes,

nice tutorial but i have a problem whit my tekkit server.

if i start the server it comes:

what can i do to fix the problem? i have update ic2 manuell but no changes. on windows 7 the server run whit the same settings.

ivory

1) don't threadjack

2) learn to fucking read. it's a block id conflict.

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...