Monday, April 2, 2012

COUNTER SUSHI harvester, pt 3: Setting up your environment

Last time, I explained why I am building a SUSHI client in Python and how I did it. I'll be sharing my code shortly! But it won't do you any good unless you have a working Python environment running. Here are the prerequisite software components:
  • Python 2.7.x (version 3.x will not work!)
  • Python SUDS package
  • Python MySQLdb package (if you plan on using MySQL)
  • a MySQL database
  • GUI software for managing the MySQL database
In my case, I wanted to install it first to a development server on my local (Windows) computers, and then I wanted to be able to run it on a production server (Ubuntu Linux). Here are the Windows instructions:

  1. Install Python
    • Download the free version of ActivePython
    • Run the Python Package Manager
    • In PyPM type "pypm install suds"
    • In PyPM type "pypm install mysql-python"
  2. Install MySQL
    • Download XAMPP for Windows. This comes with a MySQL server. Set it up during installation. Note the username and password you choose.
  3. Connect with MySQL GUI client
    • Install MySQL Workbench on your office computer
    • Set up a new connection to your MySQL database at "localhost" and connect with the credentials you supplied when you installed MySQL.
    • Create a database. Create the following tables (the names are flexible):
    • (insert table create statements/scripts)
    • Using the Server Administration module, add a new user with SELECT and INSERT privileges on your database that will be used to allow the script to connect.

For Linux, you will have to do some tinkering of your own. Hopefully, if you even care about how to do this on Linux, you have a good amount of experience using it in the first place and probably know better than I do. Here are the main steps I discovered as a Linux n00b. I am running Ubuntu 11.10:
  1. Install Python
    • sudo apt-get install python-dev
    • sudo apt-get install python-suds
    • sudo apt-get install python-mysqldb
  2. Install MySQL
    • sudo apt-get install mysql
    • create a strong password for the root user
    • modify my.conf to allow connections from ALL hosts
    • create a user with all privileges and a strong password
  3. Connect with MySQL GUI client
    • sudo ufw allow 3306 (3306 is default)
    • install MySQL Workbench on your office computer
    • set up a new connection to your MySQL database
    • create a database with tables as described above

No comments:

Post a Comment