Archive for August, 2010
Installing Python2.6, mod_wsgi, and Python-MySQL on a CentOS box.
UPDATED: January 31st, 2011: Python 2.6 now is in the normal EPEL repositories. There are some changes in the explanations below
I’ve always hated Centos, probably because I’ve never been in a situation where I had to deal with the network security (other than the obvious stuff to ward off cross-site-scripting attacks and the such). Of course, that being the case, I did wind up dealing with CentOS at work and I had to get Django, Python 2.6 and the such functional.
Centos throws a few curveballs your way.. YUM is built on Python 2.4, and upgrading to a newer version supposedly breaks the program. Going back to Python 2.4 was not an option, mainly because all my python experience is on Python 2.5 / 2.6, and I don’t want to go back and learn an older non-maintained version of the language for a server. On the other hand, I didn’t want to lobby to just install Ubuntu.
This assumes you already have a normal LAMP setup. Furthermore, I’m assuming you do not have mod_python installed. This threw me for a loop for the longest time, so take this for what its worth.
The VERY FIRST STEP (if you are running a clean install of CentOS) is to get the dev tools installed.
# sudo yum groupinstall 'Development Tools'
After that, install Python 2.6 (or anything else newer in the 2.x series). As of January 31st, these are in the EPEL repositories; if you don’t have the EPEL repositories enabled, do the following:
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
# yum repolist
Once that’s done, run yum update to get everything setup, and then install Python & the MySQL dependencies (if they aren’t already installed)
# yum install python26* mysql-devel mysql-server
This installs pretty much everything Python- & MySQL-related that you need. You will need to run the following to get an extra piece of information:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.prefix
'/usr'
The prefix (/usr) is important for later. Set it aside and finish up.
# cd ~
# wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download
# sudo tar xzvf MySQL-python-1.2.3.tar.gz
# cd MySQL-python-1.2.3*
# python26 setup.py install
(Don’t forget to create a user for use by Django in the database)
# cd ~
# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
# sudo tar xzvf mod_wsgi-3.3.tar.gz
# cd mod_wsgi-3.3*
# ./configure --with-python=/usr/bin/python2.6
# make
# make install
Now you need to fix up your Apache configuration. I won’t pretend to be an expert with WSGI (although I’ve managed to get it running on 3 different OSes running Apache), but make sure you include the following, somewhere near the Module block in the httpd.conf file.
WSGIPythonHome /usr/
As long as you have this setup, and a proper WSGI script, you should be able to get up and running.
The Django installation is quite easy. Go into the Django source directory and type in
# python2.6 setup.py install
That will take care of making sure Python2.6 also has access to django.
If you don’t want to install using the source code, you can also do this through pip. Follow the instructions here to install pip (while updating the version of pip to 0.8.2) and then type in
# pip install django
That’s pretty much it. I’m sure there is something unclear, but I’ve got to get back to work -_-
Japan as a Hostage Society
I have had the opportunity, over the past few weeks, to read a few of the interesting links posted on Hacker News about Japan; positive and negative. The one thing that comes out over and over again (to the point of being a cliche) is that Japan does not raise people to be creative, and this is hindering development. I do not believe this to be true; I run into far more displays of spontaneous creativity in Japan than I did in Montreal (street musicians with original songs, people with odd but interesting/original fashions, etc..) I certainly think that the various art fairs in Japan held at Tokyo Big Site are significantly more energetic and outright interesting than any of the staid nonsense that I used to force myself to visit back home.
However, these all have something in common. Producing street music in the evening, making artwork on the side and doing a little stitching is, at most, a hobby. It’s a Google 15% project, done after the grueling 11 hour work day is done. These are not and cannot contribute as industry or as a business because no one is capable of doing them full time, even if they want to. This is because Japan is a hostage society where the inevitable sacrifices that one makes would leave painful financial ratifications for people around you.
After the Sengoku Jidai era of Japan, the Shogun would have his various regional leaders (Daimyo) submit themselves or high-ranking family members as hostages in a rotational system that would ensure good behavior on the part of the leader himself. Furthermore, this process was extremely expensive; 25%-30% of the income of any domain would be spent to satisfy this need. (1) Whether through imitation or coincidence, this practice continues unabated until today in several ways.
- Housing is the most obvious example. Finding housing, in Japan, without a guarantor (保証人) (cough..) who will be held personally responsible for any issues after you leave is ridiculous. There is the concept of a guarantor company (保証会社) that takes the risk, but in many cases these companies require that you be gainfully employed by a company, even if you have cash in the bank to pay for an entire year’s worth of rent. I have offered a full year’s worth of rent in advance and have been rejected simply because I “don’t understand the Japanese way”.
Whether that complaint is true or not, shelter is a basic need, second only to food. An inability to secure housing without placing someone in harm’s way feels morally bankrupt; no one knows if they are going to lose their job, yet in such a situation there is going to be consequences for the people around you. In a society where conflict is considered anathema, is it a surprise that no one is going to want to go down a route that most likely will lead to this?
People protest that there are some ways around this. Get a place built in the 1950s (No one wants to rent those so they are usually relatively easy). Live in a share house. Stay with your family. Yet these are not practical solutions. The process of beginning a business requires concentration and hard work, while your feet are held to the fire by the requirements of everyday life. Dealing with the huge black swans that are a part of the first two (such as plumbing / heating / personality problems) and the inertia of the third are often too much to overcome. Spare me the whining of the propertied class, isn’t the bubble on their hands in the first place?
The message given here is, “Don’t bother being creative full time; we won’t let you live”.
- Work. There are so many patsies and fall-guys involved in employment in Japan that it is hard to even start. First, every company uses recruiters. Every single one. All because they need someone to take responsibility (cough..) if the employee doesn’t “work out” after his interviews (I’ve had to deal with 7, to ‘ensure a proper match’), the recruiting company is held responsible. Of course, once the employee enters the company, they sometimes have to have another “guarantor” (…) who is supposedly personally responsible if you screw something up.
It’s nice for us to laugh at people stuck in their day job, but the truth is you need to make your money somewhere. If you’ve survived the gauntlet and are making your nice $30k/year job as a seishain at Proto Corporation, I doubt you’re going to have the strength of will necessary to deal with the stress of leaving and creating your own job. The long forced overtimes perversely sap you of the willpower to leave (much like how spending 25% of your income on maintaining a presence at the court sapped your ability to raise an army)
And forget trying to find good help for your new venture without a recruiter; that might be risky for the applicant!
There are other examples I could bring up (bank account, credit, etc..), but frankly, not being able to make money and not being able to rent even a mediocre shelter is proof enough.
Yes, in Western societies we have our own hostages; we call them insurance companies and when we let them down and ge them in trouble, it isn’t personal. However, unless you want to leave a trail of injured people for the 9 times out of 10 that your product fails, you aren’t going to want to be an innovator in Japan. The outcome is probably going to be too painful.
(Perversely, I enjoy every second living in this country, go figure)
Just got the best spam comment ever.
I’m currently being held prisoner by the Russian mafia penis enlargement and being forced to post spam comments on blogs and forum! If you don’t approve this they will kill me. penis enlargement They’re coming back now. vimax Please send help
Admittedly I almost approved that.