Thursday, October 8, 2015

Comprehensive LMeve install.


** UPDATE**
July 2016 - If you are trying to upgrade an existing LMeve installation, see my article here: http://myevecorner.blogspot.ca/2016/07/eveonline-upgrading-lmeve.html
I may need to review again this article, due to some modifications in LMeve-0.1.57.

January 2016 : Just noticed that Lukas posted a link to this article. Thanks for that great tool :-)
correction of a few typos
YAML import bug, I found why it wasn't working for me, that was due to the default PHP config.

**

_ Introduction.

For the sake of writing this guide, I'm using a brand new Virtual Machine running CentOS 7, but you could choose whatever Unix you are the most used to use. Everything is pretty standard to be able to use LMeve. You need an Apache, PHP, PHPMyadmin, mysqld and a few libraries.

I decided to use CentOS since it's one of the most used Linux distribution, and I had to do some @work related research on it.
Bear in mind that I will disable some security features on it, since that installation will be completely unreachable from Internet, and thus, invulnerable from attacks from the outside world. If you want to have your LMeve instance accessible for your corporation/alliance, you will have to slightly change the network setup, and reactivate the firewall/SElinux, or equivalent on your unix machine, with the appropriate rules and settings.

On this guide, I do focus only on the installation part of LMeve. If you need help on installing Linux, or configuring it, you won't find it here. I assume that if you use unix, you are, at least, familiar with the basic concepts at managing it.
All commands are run as root, since I'm an old school guy, I don't use sudo at all.

_ Pre-requisites.

Nothing much, safe a linux VM and a few downloads from CCP, from Lukas' site and some files
from Steve Ronuken's site: 
 Aegis_1.2_114300_db.zip (https://developers.eveonline.com/resource/static-data-export)
 lmeve-0.1.53-beta.tar.gz (https://github.com/roxlukas/lmeve/releases)
 yaml_eve_aeg100_dbo.sql.zip (https://pozniak.pl/lmevedbdump/)
 sde from https://www.fuzzwork.co.uk/dump/  (*)
 Aegis_1.2_Icons.zip      (https://developers.eveonline.com/resource/image-export-collection)
 Aegis_1.2_Types.zip

  (*) For Aegis, mysql-latest.tar.bz + invCategories.sql.bz2 are needed, due to a bug at the Aegis release.

Those files are for the Aegis release in July 2015.You will have to adapt those filenames.
LMeve has evolved since I wrote that guide too, download the latest release from GitHUB.


_ First thing first.
Since my VM will be unreachable from Internet, I don't need the firewall nor the SElinux, so, I stop and disable them for good. You will need to revisit this if your instance is to be available for your corp/alliance.

# systemctl status firewalld
# systemctl disable firewalld
# systemctl stop firewalld
# systemctl status firewalld

Now, disable SELinux (or use permissive)
# sestatus
# vi /etc/selinux/config
                change SELINUX to "disabled".
# reboot


_ Installing LMeve dependencies.

Let's get a few tools and repositories (these are for CentOS/Redhat Linux 7):

# yum install wget
# wget http://fedora-epel.mirror.iweb.com//epel-release-latest-7.noarch.rpm
# rpm -ivh epel-release-latest-7.noarch.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
# wget http://dev.mysql.com/downloads/file.php?id=450705 (ou lynx)
# rpm -Uvh mysql-community-release-el7-5.noarch.rpm

CentOS doesn’t provide a ftpd. Since I needed one to upload LMeve files, I had to install one, you may skip this step if you could get LMeve and CCP files directly onto the linux.
# yum install vsftpd.x86_64
# cd /etc/vsftpd/
# cp vsftpd.conf vsftpd.conf.orig
# vi vsftpd.conf               
                edit anonymous_enable to No, local_enable=YES, write_enable=YES.
                Check the listen= versus listen_IPV6=, choose to suits your setup.
# systemctl restart vsftpd
# systemctl enable vsftpd

Since my linux setup is a basic one, I have to add a few more tools, you may or may not need them. Your linux distro may have them already installed.

# yum install mysql-community-server.x86_64
# mysql_secure_installation

# yum install httpd
# yum install php-devel
# yum install libyaml-devel
# yum install php-pear
# yum install php-mysql.x86_64

# yum install phpmyadmin
# cd /etc/httpd/conf.d/
# cp phpMyAdmin.conf phpMyAdmin.conf.orig
# vi phpMyAdmin.conf               
                add Require ip and Allow ip for your own IP address
# pecl install yaml

** update January 2016 **  YAML import fix.
# vi /etc/php.ini 
     add "extension=yaml.so" in that file.
     Search for "memory_limit" and make sure the value is at least 1024M.
     ( On CentOS/Redhat, that default value is 128M.)
        

# vi /etc/httpd/config/httpd.conf
    Add somewhere in that file:

                Alias /lmeve /opt/lmeve/wwwroot
                <Directory /opt/lmeve/wwwroot>
                    Order allow,deny
                    Allow from all
                    #uncomment the line below in Apache 2.4; for Apache 2.2 leave it as it is
                    #Require all granted
                    Options FollowSymLinks
                </Directory>

Let's start apache, and connect to http://xx.xx.xx.xx/ to see if Apache has started as it's supposed to. If you don't see the test page from Apache, review your httpd.conf, you may have a typo or a misconfiguration.


_ Install and configure LMeve.

Due to my network configuration, I had to upload LMeve/CCP files via ftp to a local account
on that VM (named "user"). Replace that "~user" by your own path.

#  cd /opt
# tar xzvf ~user/lmeve-0.1.53-beta.tar.gz
# ln -s lmeve-0.1.53-beta lmeve
# cd /opt/lmeve/config
# cp config-dist.php config.php
# vi config.php
                edit:   $LM_EVEDB='eve_tia100_dbo';  .. replace by the current eve db name (eve_aeg100_dbo in this installation)
                               $LM_SALT='abcde12345';            .. create a random chain (hint: select a part of an encrypted password in /etc/shadow)

Let's create our 2 databases. One will be for LMeve internal stuff, the other is the
CCP's one. You could use whatever you want for CCP's, but I decided to stick with CCP's
naming system. We will have to create a mysql user named "lmeve" with password "password".

** update january 2016 ** sticking with CCP's DB name may not be the wisest choice. If I had to restart everything, I would choose a more generic one. eve_ccp_dbo. I don't think that we need to keep older release of CCP's schemas

# mysql -u root -p           (use the root password you created while setting up the mysql.)
                mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

                mysql> create database lmeve;
                mysql> create database eve_aeg100_dbo;
                mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| eve_aeg100_dbo     |
| lmeve              |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)

                mysql> create user 'lmeve'@'localhost' identified by 'password';
                mysql> grant all privileges on * . * to 'lmeve'@'localhost';
                mysql> flush privileges;
                mysql> quit

Now, inject LMeve schemas in the LMeve database.
# cd /opt/lmeve/data
# mysql -u root -p lmeve < schema.sql

And create the admin/admin login/passwd within LMeve.
# cd /opt/lmeve/data
# php ../bin/passwd.php

# Let's add Icons and Types ID from CCP.
# mkdir -p /opt/STATIC_FROM_CCP
# cd /opt/STATIC_FROM_CCP
# unzip ~user/Aegis_1.2_Icons.zip
# unzip ~user/Aegis_1.2_Types.zip
# cd /opt/lmeve/wwwroot
# rm -fr  ccp_icons ccp_img
# ln -s /opt/STATIC_FROM_CCP/Icons/items/ ccp_icons
# ln -s /opt/STATIC_FROM_CCP/Types ccp_img

We're almost done. We need to get the Static Dump from CCP DB. For that, we use Steve Ronuken's work at reformatting that static dump to various DB format. For Aegis, CCP introduced some DB reworks, that's why we have 2 files to import:

# cd ~user
# mkdir fuzzywork_kdump
# cd fuzzywork_kdump/
# bunzip2 -c ../mysql-latest.tar.bz2 | tar xvf -
# cp ../invCategories.sql.bz2 .
# bunzip2 invCategories.sql.bz
# cd aegis-1.1.1-114255/
# mysql -u root -p eve_aeg100_dbo < mysql56-aegis-1.1.1-114255.sql
# cd ..
# mysql -u root -p eve_aeg100_dbo < invCategories.sql
# cd /opt/lmeve/data/
# mkdir eve_aeg100_dbo
# cd eve_aeg100_dbo
# ln -s ~user/fuzzywork_kdump/aegis-1.1.1-114255/*.yaml .

(I did a link to the extracted files, but you could move or copy them instead, and then clean up the ~user home directory.)



On the next command, it failed for me with LMeve 0.1.53. It may be working for you, or the process may change for future release, since it was a brand new process in the 0.1.53.

*** Failed to import YAML.. I'm not a PHP expert, I didn't investigate why.
# php /opt/lmeve/bin/update_yaml.php --all                       
LMeve YAML static data updater
(c) 2014 by Lukasz "Lukas Rox" Pozniak

Using static data from ./data/eve_aeg100_dbo/

Calling updateYamlTypeIDs(), please wait...
loading YAML...PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 520 bytes) in /opt/lmeve-0.1.53-beta/include/yaml_common.php on line 5
#
** Update january 2016 **
As I found the issue while updating my LMeve install in december, I updated this procedure. Make sure that you have changed the "memory_limit" parameter in /etc/PHP.ini to, at least, 1024M. The default value was 128M for me, that's why the import was failing.

# php /opt/lmeve/bin/update_yaml.php --all                       
LMeve YAML static data updater
(c) 2014 by Lukasz "Lukas Rox" Pozniak

Using static data from ./data/eve_aeg100_dbo/

Calling updateYamlTypeIDs(), please wait...
... etc..

If the script fail to import the YAML files, here's the manual import:

Hopefully, Lukas has provided us with a dump of those files, you could download it here: https://pozniak.pl/lmevedbdump/yaml_eve_aeg100_dbo.sql.zip (or a newer version of this file)

*** using pre-installed YAML from lmeve.

# cd ~user
# mkdir YAML_extract
# cd YAML_extract
# unzip ../yaml_eve_aeg100_dbo.sql.zip
# mysql -u root -p eve_aeg100_dbo < eve_aeg100_dbo.sql

_ The final steps

Use the CCP web site to create a corporate API Key, and inject it in the LMeve DB:
# mysql -u root -p lmeve
                mysql> insert into cfgapikeys values (1,'api_key_id','api_verification_code');
                mysql> quit

Edit the following file to change to your timezone:
                poller.php:date_default_timezone_set('Europe/Warsaw');

Change "Europe/Warsaw" to whatever your timezone is. If you don't know its value, check is there:
# ls -la /etc/localtime
lrwxrwxrwx. 1 root root 38 Jul  7 15:58 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
 For me, it’s America/New_York

Finaly, the last touch:
# echo "*/15 * * * * /usr/bin/php /opt/lmeve/bin/poller.php" | crontab
# crontab -l
*/15 * * * * /usr/bin/php /opt/lmeve/bin/poller.php

That last one tell the server to execute the poller at 0, 15, 30 et 45 every hour. The poller has a timeout which prevent it from exceeding 15 minutes of runing time, and thus, you should never see two poller.php running at the same time.

On your workstation (or on the VM if you have installed a graphical interface and a web browser), use your favorite web browser, and go to http://xx.xx.xx.xx/lmeve, login as "admin" with the password "admin" (without "), and in the next 15 minutes, LMeve will come to life.

Congratulation, you just installed LMeve successfully.


Tuesday, October 6, 2015

A new blog about Eve Online.

Hello there.

This blog is a first for me, since I never wrote one before, nor posted stuff in a regular basis before.
Please, be aware that I'm not an english native speaker, nor writer for that matter. My writings may/will contains a lot of errors, misspelled words or strange syntaxes. I will do my best to improve it.

This blog will be about Eve Online, and my experience playing it. I've been playing games since the last 30 years, and I must say that I know only 2 other games with the same level of complexity.

The first one, or ones, is the Sid Meier's Civlization series. I still play Civilization IV games
on a regular basis. I spent thousands of hours on Sid's games since Civilization I. If you ever played
any of them, you will know that feeling:
     just.. one.. more.. turn.. ah crap ! 4 AM already, ok, just one more.

The second one is Funcom Anarchy Online. I've played it for about 10 years. What'a about it ? Learn to twink a level 50 weapon on a level 10 character and obliterate everything in PvP and PvE with it. For such a toon, you could spend weeks in planing, searching for the correct cluster, the clean implant, buffs, swaping buff items, etc.
There is so much skills to choose from, to plan way ahead for weeks (when leveling was way slower than it is now.), spending hours shopping, then building implants, just to gain a few more points in such or such skills.

Of course, I've played a lots of other games, simulators, FPS, RTS, RPGs, a bunch of MMOs. But all of them have always the same issue: they were too simple, there was no complexity per se in them.
For MMOs, as time pass, the game was alwways made easier, faster to level, faster to reach the max level to do instances with high-end contents. An example ? World of warcraft. I remember leveling my first gnome mage at level 60, it took me around 6 or 7 months of playing, at 4-5 hours per day. My last toon was a warrior, a few expansions later, it took me one week (at the same rate) to level from level 1 to 70, alone.
I left WoW, for good, some times after that. There was nothing left in that game safe grinding factions
and running instances, with a tight schedule, to get better stuff.

I've never been that kind of player, I'm enjoying leveling my characters, building my in-game personna around them, taking my time to wander around, doing stupid stuff just to see it's possible, planing my next moves, etc.

In Eve Online, I found everything I ever wanted. The game is immersive, it could appeal to almost
everyone, for the impatients, solo missioning, exploring, pvp-ing, for the social ones, hanging around
in fleets for PvE or PvP, for the patient ones, mining, manufacturing, hunting, hauling, trading, etc.
There is so much things to do in Eve Online that it's overwhelming IMHO.

I started playing somwhere in summer 2014, on a free account, and got hooked almost instantly.
I tried a lot of things at that time: mining, exploring, missioning and of course, the most important: dying.
I was setting myself some easy goals: to have 10m ISK, 50m, 100m. My mid term goal was to have 200m ISK in my wallet, and to be able to fly a cruiser class ship (just fly, not being effective heh :-) )

To achieve this, I've started with the most easy activity: mining !

I've mined for days in a venture, making slowly my way to my goal, which I eventually reached and bought my first cruiser. While mining, I had plenty of time to read. The more I was reading, the more I was confused. And as confusion grows, my determination to understand Eve was growing too. I spent weeks reading, on my way to work, on my way back, at lunch break, and of course, while mining. Watching Youtube videos was a boon, there's a lot of informations there too. (Just a warning, there's a lots of outdated informations too, Eve Online is an old game, which has evolved a lot since its begining.)

That was it, I was completely fascinated by Eve.
There was so much stuff to do, so much stuff to understand, so much activities you could do to earn
ISk, fame or simply to have fun, it was incredible.

One year later, I'm still as passionate as I was, I spend around 2-3 hours per day playing Eve, sometimes more on the weekend. I've been experiencing a lot of different aspects of the game since then. I've been mining for months to fund some projects, and I still do some mining from time to time when I don't feel like doing something more involving. I have around 5B ISK in various assets, which is absolutely nothing compare to most players. I spend almost as much time actually playing the game than planing my next moves while out of the game.

I'm building a spreadsheet to help me plan my industrial activities: what to produce, where, and how much of them, what'll be my GPM (Gross Profit Margin) target ? What's the trend for the market for that item etc.

I have a master plan for months ahead, and lots of short-to-mid-terms plans which evolve as time passes, and as the political situation around New Eden evolves.

For now, I'm mostly involved in manufacturing T1 items (ammunitions, ships, rigs, modules), inventing T2 will be next. I'm still not sure about building T2 items, since I will have to buy moon materials from trade hubs, I will have to make sure it's profitable before investing in it.
When I have time to spare, I jump in a ship, and do some missions or do some ratting in anomalies.

For the next posts, I will focus mostly on tools I'm using. I won't explain most of them in details since
there's already a lot of informations about them around. I will have a specific post on a tool named LMeve, written by Lukas Rox (http://pozniak.pl/wp/). The tool is great, but safe if you have a good knowledge in databases, you won't be able to install it easly. Hopefully, Lukas is now providing a pre-built virtual machine (which could be run in VirtualBox and VMware) with LMeve almost up and running. (see https://github.com/roxlukas/lmeve for details)
Since I already run many unix VM machines, I was wanting to integrate LMeve in one of them, and it took me quite some time to do it correctly, since I haven't played with a database since more than 20 years.
I wrote a complete step by step guide to install LMeve on a brand new Linux, and I will post it here in a few days.

In the meantime, fly safe.