[WINDOWS] How to make an OTserver. TFS 0.3.6pl1

Go down

[WINDOWS] How to make an OTserver. TFS 0.3.6pl1

Post by Sweddy on Thu Dec 22, 2011 10:08 am

From nothing to a fully working, secured OT server. [Uniform Server] + [TFS 0.3.6]

//If you encounter any problems, check our Troubleshooting section http://forum.tibiastrike.com/t24-windows-how-to-make-an-otserver-tfs-036pl1#57 before replying.

Hello, there has been quite a while since I made a tutorial. But I figured this would be a good time.

I was searching the web, looking for alternatives to XAMPP, because using XAMPP for this Open Tibia community is a really bad habit!

XAMPP is for testing purposes mainly for your local machine, if you get into problems using XAMPP, and posting it at their forum, they will stamp you "IDIOT" in your head, and saying "XAMPP has never been made and probably will never be made for serious hosting".

XAMPP is made for testing purpose. And it is insecure, and heavy.

I was browsing the web, hoping to find an easier installation and use alternative to xampp.

And that is Uniform Server.

Why use Uniform Server instead of XAMPP?
1. Security
2. Lightweight (xampp 51MB, XAMPlite 28MB. Uniform Server 8.75MB).
3. Easier to use.
4. XAMPP got lots of unnecessary features, especially for the Open Tibia community. Despite the small size of Uniform Server, it has all we need.

Installing Uniform Server will give you:
MySQL database.
phpMyAdmin to administrate the MySQL database.
Apache hosting.
PHP 5.3.5+
eAccelerator to make website faster.

XAMPP + Modern AAC = Page rendered in: 0.0554 seconds.
Uniform Server + Modern AAC = Page rendered in: 0.0219 seconds.

Do I need to say more? So lets get started!

Getting Started:

First we need to download latest version of Uniform Server, download it at this link:
Version: 7.0.1 Windows 7/2008 32 & 64bit users.
http://sourceforge.net/projects/miniserver/files/Uniform%20Server/7.0.1-Orion/Orion_7_0_1.exe/download

Version: 5.7.5 Windows XP 32bit users.
http://sourceforge.net/projects/miniserver/files/Uniform%20Server/5.7.5-Nano/UniServer5_7_5.exe/download

Originally Posted by Ric@forum.uniformserver.com
UniServer 7.0.1-Orion Released:
Core components:
Apache 2.2.17
MySQL 5.5.11 - Update
PHP 5.3.6
phpMyAdmin 3.3.10 - Update
Go-Pear 1.1.2
msmtp 1.4.23
eAccelerator 1.0-snv427
WinBinder 2010.10.14
OpenSSL 1.0.0d

Regards,
The Uniform Server Development Team

Code:
UniServer 5.7.5-Nano:
Core components:
Apache 2.2.17
MySQL 5.5.10 -- Update
PHP 5.3.5
phpMyAdmin 3.3.9.2
Go-Pear 1.1.2
msmtp 1.4.23
eAccelerator 1.0-snv427
OpenSSL 0.9.8q

When running the program, it will ask to install it to something bothersome like:
C:Usersprogram files
or something similar.

Don't install it there, you can do it, but windows filesystem is crap so we want to save it as close root as possible.

So install it directly to
C:

And click Extract.

Installation complete. That wasn't so hard?

But we still need to learn to configure and use it, lets get to that now:

Click Start.

Whohaw! You started it!

OMG! POPUP MSG; your computer will crash

Just kiddin.

The message simply says there will be an icon at the bot, the icon with "1".

That little icon is the configuration panel of Uniform server. Smile

Right click = Services
Left click = Start without running as services.

Services = It will start automatic, if you restart your computer, it will automatic restart so you won't have to click "start".



start and Stop UniServer = start and stop the website and Mysql database.

If you click on Stop while your OT server is running your in problems. Since you close the MySQL database. So don't do that while OT is online!

What else is useful is phpMyAdmin, click on it and you will connect to phpMyAdmin, so you don't need to remember the address.

What else which is very useful is "Server Status". Lets click it:


Now that's awesome!
This tells you your global IP address, this is the IP you are suppose to paste in config.lua on your OT
server!


Code:
Your Internet IP Address = 85.19.89.238

Can other players see your website? Have you opened the necessary ports and everything is working fine? On my school computer, NO!
Code:
Accessible from Internet = NO

Port 80 is default, if you choose another port, when you enter your website, you need to write :xxxx (depending on port). However, with port 80 this is not neccesary.

Make sure to port forward port 80.
Code:
Apache port            = 80

Install status, if "as program" it is running, but it will not restart and such things automatic. If running as Services, it will boot automatic when computer restarts and such things.
Code:
install status  = Installed as a standard program

This here is also good, it tells you if the ports are available, and if they are in use, what program is using them!
Code:
PORT STATUS:

  Apache port    = 80 In use by this server
  Apache SSL port = 443 SSL Not enabled free to use
  MySQL port      = 3306 In use by this server

For security reasons, do NOT port/open MySQL port. We don't want outsiders to sneak in our database.

Now start uniserver, and click "Admin Panel"


Fix the security steps:


Once you have done the 4 steps click on "security console" on this message:
Code:
Run the Security Console and see if everything is OK.


Code:
Server Certificate and Key (SSL)
Unsecure indicates you do not have a server certificate or key. Create new ones by clicking the UNSECURE link.

UNSECURE

You are not using SSL, but just to be kind, we like to keep things secured, click on "Unsecure" and set a password there as well.

Don't secure php safe mode. Its no point in doing it.

Having this as "Unsecured" should not be a problem tho. Correct me if I am wrong if you know why we should keep it secured.

And thats it, you have secured the basics.

However, we can still do some fine tuning on phpmyadmin. Lets configure it now!




We don't need 2 root accounts, so we shall delete 1 of them. Lets keep 127.0.0.1 since it has bigger compatibility than localhost. (Does not matter much anyway, you can connect to 127.0.0.1 using localhost on windows anyway).

To avoid standard hijacking programs, lets rename the remaining root user into our own custom root username!




Thumb rule1: Never connect to database with a root user. Do not use this user when you connect your OT to your database. I will explain further later.


Ohh shit!



Don't worry! If you got this error, it means it WORKED PERFECTLY AS WE WANTED IT TO! So now is the time to say "Wohoo!".

But well, lets make sure we can access our secured phpmyadmin. D:

Enter
Code:
C:\UniServer\home\admin\www\phpMyAdmin

and look for file named:
config.inc.php

Open it in notepad++. Or regular notepad. (Text document).



Change from:
Code:
$cfg['Servers'][$i]['auth_type']      = 'config';  // Authentication method (config, http or cookie based)? 

TO:
Code:
$cfg['Servers'][$i]['auth_type']      = 'cookie';  // Authentication method (config, http or cookie based)? 

Don't change anything else here, don't change root to your new root name or anything like this. Just leave it root here, for security reasons.

Scroll a little down and you see:
Code:
/* PMA User advanced features */
$cfg['Servers'][$i]['controluser']    = 'pma';
$cfg['Servers'][$i]['controlpass']    = ''; 

change:
Code:
$cfg['Servers'][$i]['controlpass']    = ''; 

To a 8 numbered long password! Remember this password since we need to configure phpMyAdmin later with it!

Now we re-enter phpMyAdmin:


And you get this result, now login with your edited root account:


[/b]Problem shooting:[/b]
I got some problems here, i could not login with my new username.

How I fixed this:
Click "stop UniServer"
and then click
"start UniServer".

If that does not work, try to do a computer restart to clear out the cache. Or click ctrl + F5 to reload phpMyAdmin without cache.

If reloading site without cache does not work, reboot your computer,(to control check that the programs are properly turned off) And then login again. Make sure you login with your correct new username and password and not root!

After a computer reboot it worked for me, and I got in. Smile


Remember we added a password to pma? Now add that password here, that way, even though pma 'might' be harmless, it is secured. Very Happy



Last edited by Sweddy on Thu Dec 22, 2011 11:11 am; edited 1 time in total
avatar
Sweddy
Administrator

Profession :
  • HTML Coder

Posts : 18
Reputation : 4
Join date : 2011-12-21
Age : 25
Location : Sweden

View user profile

Back to top Go down

[WINDOWS] How to make an OTserver. TFS 0.3.6pl1

Post by Sweddy on Thu Dec 22, 2011 10:36 am

Now lets getting started with the OT server!

It does not matter what OT server you want to run, but this tutorial will use the latest official TFS server available.
You can download it at this link:
http://otland.net/f18/8-54-forgotten-server-0-3-6pl1-crying-damson-59924/

Create a folder directly in C:\ named "OTserver".

And extract the server there, so the data dir would be:
Code:
C:\otserver\data

Now enter this link:
http://otland.net/f18/opentibia-dll-files-v1-4b-1042/

And download the DLL files.

Extract the DLL files directly in to
Code:
C:\otserver


Now enter phpmyadmin, and create a user for the OT server on the mySQL database!



This is a bit long image, make sure to click to enlarge it if you don't understand!



In import section, click browse, or choose file, or in case of Norwegian, "Velg Fil"(choose file).


Locate your OT server, click on schemas and click on MySQL.sql
C:\otserver\schemas\

[/img]http://otland.net/members/znote/albums/picture-tutorial-2/2924-uni23.png[/img]

Originally Posted by phpMyAdmin
Import has been successfully finished, 71 queries executed.

Now, open Config (sometimes it may appear as Config.lua).


Open it with a text document, and search for "sqltype"

You should find this:
Code:
 [color=green]sqlType = "mysql"
   sqlHost = "localhost"[/color]
[b]   [color=red]sqlPort = 3306[/color][/b]
[color=orange]   sqlUser = "otland"
   sqlPass = "F9quqSU65DctHJV3"
   sqlDatabase = "otland"[/color]
   [color=red]sqlFile = "forgottenserver.s3db"
   sqlKeepAlive = 0
   mysqlReadTimeout = 10
   mysqlWriteTimeout = 10[/color]
   [color=green]encryptionType = "sha1"[/color]

GREEN = Write exactly as appear on my config.
ORANGE = Write your phpMyAdmin database username and password. In sqlPass write the automatic generated password!
RED = Don't do anything. Razz
Also make sure encryption is sha1! Do not use plain, or md5.

http://www.sha1.cz/
This is a plain --> sha1 password generator. You can write "test" and click generate, and you will get the sha1 encrypted "test" which is "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3". You can then copy the sha1 encrypted password into an account in phpmyadmin, and login with those details. Very useful site.

This is very important, if you use Plain, your server may easily get hacked!

After this, save config, and run server!

Code:
[13/04/2010 18:28:20] The Forgotten Server, version 0.3.6 (Crying Damson)
[13/04/2010 18:28:20] Compiled with GNU C++ version 3.4.5 (mingw special) at Dec 24 2009, 10:39:30.
[13/04/2010 18:28:20] A server developed by Elf, slawkens, Talaturen, KaczooH, Lithium, Kiper, Kornholijo.
[13/04/2010 18:28:20] Visit our forum for updates, support and resources: http://otland.net.

[13/04/2010 18:28:20] >> Loading config (config.lua)
[13/04/2010 18:28:20] > Using MD5 encryption
[13/04/2010 18:28:20] >> Checking software version... up to date!
[13/04/2010 18:28:20] >> Fetching blacklist
[13/04/2010 18:28:20] >> Loading RSA key
[13/04/2010 18:28:20] >> Starting SQL connection
[13/04/2010 18:28:20] >> Running Database Manager
[13/04/2010 18:28:21] > No tables were optimized.
[13/04/2010 18:28:21] >> Loading items
[13/04/2010 18:28:21] >> Loading groups
[13/04/2010 18:28:21] >> Loading vocations
[13/04/2010 18:28:21] >> Loading script systems
[13/04/2010 18:28:21] [Error - LuaScriptInterface::loadFile] data/actions/scripts/quests/annihilator.lua:5: '}' expected (to close '{' at line 1) near 'entry'
[13/04/2010 18:28:21] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/annihilator.lua)
[13/04/2010 18:28:21] data/actions/scripts/quests/annihilator.lua:5: '}' expected (to close '{' at line 1) near 'entry'
[13/04/2010 18:28:21] >> Loading chat channels
[13/04/2010 18:28:21] >> Loading outfits
[13/04/2010 18:28:21] >> Loading experience stages
[13/04/2010 18:28:21] >> Loading monsters
[13/04/2010 18:28:21] >> Loading mods...
[13/04/2010 18:28:21] > Loading buypremium_command.xml... done.
[13/04/2010 18:28:21] > Loading changender_command.xml... done.
[13/04/2010 18:28:21] > Loading custommonsters.xml... done.
[13/04/2010 18:28:21] > Loading customspells.xml... done.
[13/04/2010 18:28:21] > Loading firstitems.xml... done.
[13/04/2010 18:28:21] > Loading highscorebook.xml... done.
[13/04/2010 18:28:21] > 6 mods were loaded.
[13/04/2010 18:28:21] >> Loading map and spawns...
[13/04/2010 18:28:21] > Map size: 1000x1000.
[13/04/2010 18:28:21] > Map descriptions:
[13/04/2010 18:28:21] "Saved with Remere's Map Editor 1.1.8"
[13/04/2010 18:28:21] "The Forgotten Server"
[13/04/2010 18:28:22] > Map loading time: 0.783 seconds.
[13/04/2010 18:28:22] > Data parsing time: 0.07 seconds.
[13/04/2010 18:28:22] > Houses synchronization time: 0.022 seconds.
[13/04/2010 18:28:22] > Content unserialization time: 0.316 seconds.
[13/04/2010 18:28:22] >> Checking world type... PvP
[13/04/2010 18:28:22] >> Initializing game state modules and registering services...
[13/04/2010 18:28:22] > Global address: 127.0.0.1
[13/04/2010 18:28:22] > Local ports: 7171    7172   
[13/04/2010 18:28:22] >> All modules were loaded, server is starting up...
[13/04/2010 18:28:22] >> Forgotten server Online! 

Working! cheers

Now lets try to LOGIN!

Code:
13/04/2010 18:30:22] Account Manager has logged in.
[13/04/2010 18:30:22] > Broadcasted message: "New record: 1 players are logged in.". 

Everything seem to be fine. Following this tutorial, will definetely help you with your security, however, there are still many more security measures you can do, but so long, I haven't had any problems with it. Smile







avatar
Sweddy
Administrator

Profession :
  • HTML Coder

Posts : 18
Reputation : 4
Join date : 2011-12-21
Age : 25
Location : Sweden

View user profile

Back to top Go down

Re: [WINDOWS] How to make an OTserver. TFS 0.3.6pl1

Post by Sweddy on Thu Dec 22, 2011 11:10 am

Troubleshooting:
I cant run UniTray! It wont start at all!
You need to download and install this file, then you can run UniTray (Start Uniform Server):
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2
(Tested and works on Windows Server 2008).

Is any ports being used by another program?(Example port 80).
Make sure to turn off apache from XAMPP and uninstall it.

Port 80 is occupied by another program, and I don't have XAMPP on my computer!
Originally Posted by Icy View Post
Might want to warn people that using Skype prevents Apache from being installed initially, as it uses port 80.

Forgot pass to mysql/phpmyadmin. How to recover it?

Originally Posted by Furylid View Post
If using skype:
https://support.skype.com/en-us/faq/FA528/Conflicts-with-applications-such-as-Apache-or-IIS-working-on-port-80-443
That's just my opinion, easy & quick. Great tutorial!

Still does not work?
Take a look at this guide:
http://techreviews.in/port-80-unavailable-step-by-step-guide-to-release-port-80-and-make-it-available-for-apache-server/

Forgot pass to mysql/phpmyadmin. How to recover it?
Originally Posted by Znote
Enter apanel: ( http://127.0.0.1/apanel )

Connecting to database during installation without success [Case 1]:

Originally Posted by Znote
Quote
Originally Posted by thecycles View Post
When im gonna install my modern aac this shows up:
# Could not connect to database.
# Could not find your database.
1. Never use localhost. Use the IP 127.0.0.1
2. Make a new user in phpmyadmin, make sure to write 127.0.0.1 in host instead of the default localhost (see my tutorial for more detailed information on how to do this)
3. write the correct information for this user you just made when installing website.

Cant connect to mysql database [Case 2]:
Originally Posted by Znote
Enter:
UniServer\usr\local\php

Open the file "php" or "php.ini" in a text document and search for:

;extension=php_pdo_mysql.dll

Then remove the (Wink so the result is:

extension=php_pdo_mysql.dll

Then click "Stop Uniserver".

Wait 5 - 10 sec, and then click "Start Uniserver".

And it should work fine. ^^

// IF it still does not work after doing this, use Carbo 6.X.X and not 5.X.X!

I want to be able to access phpmyadmin from anywere on the Internet. So I and my friends/sub owners can access database:

Originally Posted by Ric & Znote
99% ric 1% Znote. (Just shortening Rics tutorial and adding a .htaccess code in it.

Move folder phpMyAdmin and all its content
UniServer\home\admin\www\phpMyAdmin
To folder admin
UniServer\home\admin

Edit file httpd.conf(Note your paths might be different)
UniServer\usr\local\apache2\conf\httpd.conf
Just above this section
Code:

Alias /apanel "C:/UniServer/home/admin/www/"
<Directory "C:/UniServer/home/admin/www/">
  Options Indexes Includes
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>
Add this section
[code]

Alias /apanel/phpmyadmin "C:/UniServer/home/admin/phpMyAdmin /"
<Directory "C:/UniServer/home/admin/phpMyAdmin /">
Options Indexes Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
[/copy]
Copy .htaccess from C:/UniServer/home/admin/www/
paste it into
C:/UniServer/home/admin/phpmyadmin/

edit the .htaccess file in C:/UniServer/home/admin/phpmyadmin
Delete everything thats already there and write paste this in instead:
[code]

RewriteEngine on

AddHandler cgi-script .pl .cgi
Options +ExecCGI +FollowSymLinks

# Allow only GET and POST verbs
RewriteCond %{REQUEST_METHOD} !^(GET|POST)$ [NC,OR]

# Ban Typical Vulnerability Scanners and others
# Kick out Script Kiddies
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|wkito|pikto|scan|acunetix).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]

# Ban Search Engines, Crawlers to your administrative panel
# No reasons to access from bots
# Ultimately Better than the useless robots.txt
# Did google respect robots.txt?
# Try google: intitle:phpMyAdmin intext:"Welcome to phpMyAdmin *.*.*" intext:"Log in" -wiki -forum -forums -questions intext:"Cookies must be enabled"
RewriteCond %{HTTP_USER_AGENT} ^.*(AdsBot-Google|ia_archiver|Scooter|Ask.Jeeves|Baiduspider|Exabot|FAST.Enterprise.Crawler|FAST-WebCrawler|www\.neomo\.de|Gigabot|Mediapartners-Google|Google.Desktop|Feedfetcher-Google|Googlebot|heise-IT-Markt-Crawler|heritrix|ibm.com\cs/crawler|ICCrawler|ichiro|MJ12bot|MetagerBot|msnbot-NewsBlogs|msnbot|msnbot-media|NG-Search|lucene.apache.org|NutchCVS|OmniExplorer_Bot|online.link.validator|psbot0|Seekbot|Sensis.Web.Crawler|SEO.search.Crawler|Seoma.\[SEO.Crawler\]|SEOsearch|Snappy|www.urltrends.com|www.tkl.iis.u-tokyo.ac.jp/~crawler|SynooBot|crawleradmin.t-info@telekom.de|TurnitinBot|voyager|W3.SiteSearch.Crawler|W3C-checklink|W3C_Validator|www.WISEnutbot.com|yacybot|Yahoo-MMCrawler|Yahoo\!.DE.Slurp|Yahoo\!.Slurp|YahooSeeker).* [NC]
RewriteRule .* - [F]
[/code]
That gives some protection when phpMyAdmin is on line.

Remember to use auth type cookie or httpd, if you use config you can easy get hacked!

After these changes, stop apache, wait 5 sec, start apache.

Now, just like normal, enter /apanel/phpmyadmin to access phpmyadmin. You will gain access to /apanel/phpmyadmin, but you will NOT gain access to just /apanel/

Server status says "Undefined!" What does this mean? How can I fix it?

Originally Posted by Znote View Post
The install status is Undefined!

This means the problem might be:
Your firewall. Try to disable it.
Your antivirus program. Maybe you have norton, which think the server is suspicious and have removed the program permission to run other services.
(turn it off)

Maybe you are not logged in as Administrator, but a regular user? Make sure you have administrators rights.

Maybe you installed it at wrong place? It should be installed in C:/ not C:/users/desktop (which may have lower file priority).

Try to be logged in as administrator, and try to run the program as administrator.

Status: Undefined! Basically means, the program is not having the permission to check the status on mysql and apache.

If you still have problems, try to enter your task manager, click on processes, search after mysqld.exe and apache.exe and see if those programs are running. If they are, select them and click end process. Once you have ended both of them, try to start Uniform Server again and see what happens.

Cannot start session without error messages.

Originally Posted by Znote
Quote Originally Posted by axel95 View Post
I Can't log into phpAdmin, it says this
"Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly."

Edit: It doesn't work with Google Chrome, it works with Internet Explorer. any idea why?

Most likely because you used Google Chrome when following my tutorial. So the cache got fucked up when you changed from config to cookie in phpmyadmin configuration file. Chrome still thinks that you are using config instead of cookie/httpd so it gets fucked up.

Or that you are using localhost instead of 127.0.0.1, chrome got IPv6 support meaning it is not the same any longer.

Anyway, make sure to use 127.0.0.1 instead of "localhost" and do a computer reboot and your problem with google chrome should be fixed.

Quote Originally Posted by LoLaye View Post
Thats what i get after typing

http://localhost/apanel/phpmyadmin/

[code]
phpMyAdmin - Error

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.[/code]
Any idea?
The cache on your web browser got messed up when you changed your phpmyadmin from config to cookie/httpd.
Use another browser, or reboot your computer. Or clear the browsers cache.

Example: If you got this error on google chrome, use firefox or IE. If you got this message on Firefox or IE, use google chrome.


PMA controluser problems.


Originally Posted by Znote
Quote Originally Posted by Drullen
Hello, I was setting up my uniform server. And when I try to go to Privileges I write my Username and password and I get this error

Connection for controluser as defined in your configuration failed.
This is because you changed the password to pma. You have to paste the new pma password in config.inc.php (phpmyadmin configuration file, same place as where you change from config to cookie/httpd just a little bit more down).

If you are confused, do like this:
Enter phpmyadmin, click on priviledges, edit pma, click generate password, COPY the generated password and paste it under the "pma" part in config.inc.php (same place you change from http to cookie based phpmyadmin).
After saving the new password to config.inc php, go to phpmyadmin and save the user "pma" with the new password.

And it should work fine.

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

Originally Posted by Znote
Solution1: Download google chrome if you dont got it yet, in google chrome hold in the key combination in this order: CTRL + SHIFT + N. You now open a google browser without cache. Now enter phpmyadmin and see if you still have problems.

Solution2: If you still have same problem, enter C:\UniServer\home\admin\www\phpMyAdmin open the file config.inc.php with text editor. (like notepad).
Change back to auth_type = config:
[code]$cfg['Servers'][$i]['auth_type'] = 'config'; [/code]
Then enter google chrome, hold in the key combination in this order: CTRL + SHIFT + N. You now open a google browser without cache. Now enter phpmyadmin and see if you still have problems.

All Credits goes to: Znote - Otland




avatar
Sweddy
Administrator

Profession :
  • HTML Coder

Posts : 18
Reputation : 4
Join date : 2011-12-21
Age : 25
Location : Sweden

View user profile

Back to top Go down

Re: [WINDOWS] How to make an OTserver. TFS 0.3.6pl1

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum