• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Configuration HUGE! TFS on Ubuntu (MySQL) step by step guide

Recadra

New Member
Joined
Jul 12, 2008
Messages
70
Reaction score
3
Everything in Italic font is optional or informational

* Start by downloading Ubuntu 8.04 LTS Server Edition from http://www.ubuntu.com/getubuntu/download
* After you downloaded that, burn the ISO to a CD and shove it into your server.

You'll get a screen like this
Screen1.jpg


* I strongly recommend you choose English for this tutorial, but if you must, choose your own language.
* Select Install Ubuntu Server (it's selected by default) and press Enter.
* Now wait for the installation to start. It will ask you to choose a language again. I strongly recommend you choose English for this tutorial.
* It will now ask you what country you live in, select your country.
* The installation will now ask you if the installer should detect your keyboard layout. If you're a first-time linux user, this is stronly recommended. If you know what you're doing, select it from the list.
* The installer will now start retreiving packages, configure your network etc.
Screen2.jpg


* After it's done with this, you have to enter your Hostname. If you have a domain name, fill it in here, if not, just give the system a name.
* Now, partitioning the disk. If you want to do it the easy way, just set it to "Guided - use entire disk".
If you want a faster performing server, follow these steps (I strongly recommend you doing this):
- Select "Manual" and press Enter
- Select "Guided partitioning" and press Enter
- Select "Guided - use entire disk" and press Enter
- select the first partition and press Enter. It will look like this:
Screen3.jpg

- Select "Use as: Ext3 journaling file system" and press Enter
- Select "ReiserFS journaling file system" from the list and press Enter (ReiserFS performs better than the other file systems listed)
- Select "Bootable flag: off" and press Enter
- Select "Done setting up the partition" and press Enter
- Select "Finish partitioning and write changes to disk" and press Enter


* Select "<Yes>" to continue the installation.

Ubuntu will now start installing. Get yourself a drink, a cookie, whatever you want. This may take up to 20 minutes (unless you're running 15K RPM SAS drives in Raid 5 with a 52x cd reader :p)

In the mean while I'll also explain to you why I advice you to choose ReiserFS over Ext3 or XFS. ReiserFS is extremely fast at handling small files. XFS is the fast one for handling large files. Ext3 is just medium at both. Because an OT server (and database) work with a lot of small files, ReiserFS will outperform XFS and Ext3 here.
Screen4.jpg


When it's done with the installation of the base system, the installation will be asking you for your full name.
* Enter your full name and press Enter.
* Enter your desired username (or use the given one) and press Enter.
* Enter your desired password and press Enter.
* Repeat.

Screen5.jpg

* If you have a HTTP proxy server, enter it here. Most likely you can just press Enter without filling anything in.

* After a little bit of network activity, the installer will ask you what software to install. For a dedicated OT server I strongly recommend you to install "LAMP server" and "OpenSSH server".
You can select the software you want to install by moving the cursor down (with the arrow keys) to the software package and press the space bar.
* After you selected the "LAMP server" and "OpenSSH server" package, press Enter.

* Now you will be asked for new MySQL "root" user. Enter the password you want to use for the MySQL database and press Enter.
* Repeat.

The installation of Ubuntu will finish now. In about 10 minutes from now, the installer wants you to rip out the CD. Do so, and then continue.

If you booted in Ubuntu, Yay! Congratulations. You've survived the first and easiest part! If you didn't boot into Ubuntu, you probably made a mistake somewhere; I suggest you to start again.

Now you'll see something similar to this:
Screen6.jpg


* Log in to Ubuntu with the Username and Password you entered in the installer.
* For the configuration, we need to become root. Root is the superuser of Linux, like the "Administrator" account on Windows.
* So, become root by typing
Code:
sudo su
* Enter your normal password

* First, let's upgrade Ubuntu so we have the latest security updates. Do so by entering
Code:
aptitude safe-upgrade
* Aptitude will ask you if you really want to continue. Press Enter.

* After that is done, install vsftpd. Vsftpd is a small and easy to configure FTP server. With an FTP server it's easy to port files to your server.
* To install vsftpd type
Code:
aptitude install vsftpd
Thank god for Debian-based distros being so simple.
* Press Enter when asked for a confirmation.

* Now we need to configure the FTP server. Type
Code:
nano /etc/vsftpd.conf
to edit the configuration.
* Scroll down (yes, with arrow keys, your mouse won't be working) and replace the following:
Code:
"anonymous_enable=YES" should be changed to "anonymous_enable=NO"
"#local_enable=YES" should be changed to "local_enable=YES" (remove the #)
Also remove the # in front of "write_enable=YES"

* Now, press Ctrl + O to save the file (WriteOut). Press Enter to confirm.
* Then, press Ctrl + X to exit.

Well, I think now would be a great time to set up port forwarding in your router. I'm not going into details about this, but I can tell you how to get the IP address of your fresh linux server.

* Type
Code:
/sbin/ifconfig eth0
You will see a lot of text, including
Code:
inet addr:<PC's IP>

After you set up port forwarding (if needed), continue with the tutorial.

If you need a static IP address instead of a DHCP one, if, for example, your server is located in a data centre follow the following steps:
- Type "nano /etc/network/interfaces"
- Change "iface eth0 inet dhcp" to "iface eth0 inet static"
- Under that, add the following:
address <enter your ip>
netmask <enter netmask ip>
network <enter network ip>
broadcast <enter broadcast ip>
gateway <enter gateway ip>

- Save (Ctrl + O) then exit (Ctrl + X)
- Restart networking by typing "/etc/init.d/networking restart" and press Enter.


Now it's time to set up phpMyAdmin.
* Go to the webroot folder by typing
Code:
cd /var/www
* Now download phpMyAdmin by typing
Code:
wget http://heanet.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.11.8.1-all-languages-utf-8-only.tar.gz
* Extract the archive with
Code:
tar -xf phpMyAdmin-2.11.8.1-all-languages-utf-8-only.tar.gz
* Rename the directory to something that doesn't make sence. This is to prevent people from finding your phpMyAdmin installation and using it to brute-force your database.
* Type
Code:
mv phpMyAdmin-2.11.8.1-all-languages-utf-8-only <new folder name>
* Remove the archive with
Code:
rm -f phpMyAdmin-2.11.8.1-all-languages-utf-8-only.tar.gz
* Move into the phpMyAdmin directory with
Code:
cd <folder name>
* Rename config.sample.inc.php by typing
Code:
mv config.sample.inc.php config.inc.php
* Edit config.inc.php with
Code:
nano config.inc.php
* Scroll down to
Code:
$cfg['Servers'][$i]['auth_type'] = 'cookie';
* Change "cookie" to "http"
* Save with Ctrl + O, Enter to confirm, Ctrl + X to exit
You can now reach your phpMyAdmin through a browser on another computer at the location:
Code:
http://<server ip>/<phpMyAdmin folder>

* Create a new database called "ot".

Okay, now it's time for compiling the OT.

Follow step 1 and 2 of Elf's compiling guide located at http://otland.net/showthread.php?t=2868

* Then type
Code:
rm -f boost_asio_0_3_8.tar.gz boost_1_34_1.tar.gz
to clear up the archives we don't need anymore.

* Type
Code:
svn co http://forgottenserver.svn.sourceforge.net/svnroot/forgottenserver/forgottenserver/tags/0.2
to download all the sources.

* Now do
Code:
mv 0.2 ot
to rename the folder to "ot".
* Go into the ot folder by typing
Code:
cd ot
Now, there is one little problem when you want to compile, liblua5.1-sql-sqlite doesn't exist. Oh yay. That's no problem as we'll be using MySQL.
* Type
Code:
nano Makefile
WATCH IT. You need to use a Capitalized letter with Makefile or it won't work.
* Search for
Code:
-llua5.1-sql-sqlite
and delete it
* Save with "Ctrl + O", press Enter to confirm, exit with "Ctrl + X"
* Type
Code:
make
to make an executable file from the source.
* You should have no compiling errors. If you have any, you fucked something up.

Now, we're gonna copy the OT files needed by the executable.
* Type
Code:
mkdir /ot
* Type
Code:
cp TheForgottenServer /ot
* Type
Code:
cp config.lua /ot
* Type
Code:
cp lastMotd.txt /ot
* Type
Code:
cp playersRecord.txt /ot
* Type
Code:
cp -apv data/ /ot/data

Now we should configure the config.lua file
* Type
Code:
cd /ot
* Type
Code:
nano config.lua
* Configure config.lua to your needs. Make sure you change the sqlType from sqlite to mysql
* Ctrl + O to save, enter to confirm, Ctrl + X to exit

* Type
Code:
cp ~/ot/forgottenserver.sql /var/www
to copy the sql scheme to the webroot
* Go to
Code:
http://<server ip>/forgottenserver.sql
on another computer
* Select everything (Ctrl + A) and copy it to the clipboard
* Go into your phpMyAdmin, select the ot database
* Click on SQL
* Paste the clipboard content in the textfield
* Click on Go

You should get a message "Your SQL query has been executed successfully"

Back to the server.
* Change the directory back to the OT folder by typing
Code:
cd /ot
* Test the server by typing
Code:
./TheForgottenServer

Well, if you did everything correctly, you should get no errors whatsoever. Except for a warning that you are executing the server as root.

Since you did an update (yes, back in the beginning you did one, remember aptitude upgrade?) it's time to restart the computer as there has been a kernel update since the release of this Ubuntu version. Just remember for the future to reboot Linux only with a kernel update. Don't reboot the server if it's not necessary.


* Reboot by typing
Code:
reboot

* When Ubuntu rebooted, login again
* Become root with
Code:
sudo su
We're going to make a startup script for the OT to start when Linux starts
* start with
Code:
cd /etc/init.d
* then enter
Code:
nano ot.sh
* Enter the following there (this is a restarter script for linux):
Code:
#!/bin/bash
while true
do
 cd /ot
 ./TheForgottenServer
done
* Ctrl + O to save, enter to confirm, Ctrl + X to exit
* Change the permissions of ot.sh (so it can be executed) with
Code:
chmod +x ot.sh
* Add the script to the startup with
Code:
update-rc.d ot.sh multiuser 99

Now before we reboot, we're gonna change some things so you can easily manage the OT data directory files through ftp.
* Enter
Code:
usermod -d/ot/data <your username>
* Change the directory to /ot/data with
Code:
cd /ot/data
* Then change the permissions so it's editable by entering
Code:
chmod 777 * && chmod 777 */* && chmod 777 */*/* && chmod 777 */*/*/*
* Enter
Code:
cd .. && chmod 777 data

Okay, the big moment is here. It's testing time! Type
Code:
reboot

If you made no mistakes, the server will now be running.

A few tips to make it a bit easier:

1. If you want to do something on the server, enter "Alt + F2" to change to tty2. That's simply another bash spawn you can login to.
2. You can remote control your server using SSH with a program like putty.
3. Read, read and read. A lot of information about Linux is available on the internet.
4. Don't stress out when something goes wrong, just be patient and read tip 3.
5. Next time, warn me when I have the sicko idea of writing such a large tutorial
6. If you want to update the source code, simply turn yourself into root (sudo su), go to the OT source directory (cd ~/ot) and do an update (svn update *). Then copy the files to /ot again (as described above)

If you have any questions please ask them ^^
If I made any typos here, (hey, I'm human too) please tell me so I can fix it.

Credits:
Me
Elf (compiling part)

Special thanks to:
The Ubuntu team
The Forgotten Server team (you guys are awesomesauce)
A Windows Server 2003 installation for driving me nuts and forcing me to go to Linux

Enjoy my friggin 4 hours of work :)
 
Last edited:
Great tutorial, but I prefer Debian for server.
 
Yup, awesome tut. From deep begining to the end. As concerns Debian - there are some developoers problems with this distro, many packets are out of date and mighty Debian will become more unstable then ever so my vote goes to CentOS.
 
I updated it a bit. Corrected a little mistake in here and added a part about the compiling.

As for Debian: it works fine, using it myself, but personally I think Ubuntu runs a bit more stable for those who don't know much about Linux.

As for CentOS: I've yet to try to get it to work on that, but I don't think it will be hard.

@Pvls: Debian Testing doesn't seem to be unstable to me at all though, and the packages aren't that old :p
 
Awesome tutorial, I'll try it now. I was about to kill Mr. Gates, because of many errors on my Windows OT server. I'll try Linux now. =)
 
Back
Top