How to install MongoDB on OSX Snow Leopard

Shell Script (Bash) posted 4 months ago by christian

Download and install the binaries

   1  cd /tmp
   2  wget http://downloads.mongodb.org/osx/mongodb-osx-x86_64-1.0.1.tgz
   3  tar zxvf mongodb-osx-x86_64-1.0.1.tgz
   4  sudo mv mongodb-osx-x86_64-1.0.1 /usr/local/mongodb
   5  sudo mkdir /usr/local/mongodb_data /var/log/mongodb
   6  sudo mkdir -p /data/db
   7  sudo chown -R root /usr/local/mongodb
   8  sudo chown -R root /data/db

Add MongoDB to path

   1  sudo sh -c 'echo "/usr/local/mongodb/bin" > /etc/paths.d/mongodb'

Open a new terminal window to get the updated path.

Start MongoDB

   1  sudo mongod run

References

This is article was very helpful when compiling these instructions

Tagged mongodb, osx, install

How to install Nginx from source, Ruby Enterprise Edition, and Phusion Passenger

Shell Script (Bash) posted 4 months ago by christian

Ruby Enterprise Edition:

   1  cd /usr/local/src
   2  wget thttp://rubyforge.org/frs/download.php/66162/ruby-enterprise-1.8.7-2009.10.tar.gz
   3  tar zxvf ruby-enterprise-1.8.7-2009.10.tar.gz
   4  ./ruby-enterprise-1.8.7-2009.10/installer
   5  
   6  ln -fs /opt/ruby-enterprise-1.8.7-2009.10 /opt/ruby-enterprise/
   7   

Nginx:

   1  wget -P http://sysoev.ru/nginx/nginx-0.7.63.tar.gz
   2  tar -xzf nginx-0.7.63.tar.gz
   3   

Phusion Passenger:

   1  gem install passenger
   2  /opt/ruby-enterprise/bin/passenger-install-nginx-module --auto --nginx-source-dir=/tmp/nginx-0.7.63 --prefix=/opt/nginx --extra-configure-flags=--with-http_ssl_module
   3   

Tagged nginx, install, passenger, ree

How to install memcached on OSX Snow Leopard

Shell Script (Bash) posted 5 months ago by christian

These instructions are from wincent.com:

   1  cd /usr/local/src
   2  curl -O http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
   3  tar xzvf libevent-1.4.12-stable.tar.gz 
   4  cd libevent-1.4.12-stable
   5  ./configure
   6  make
   7  make verify
   8  sudo make install
   9  
  10  
  11  cd /usr/local/src
  12  curl -O http://memcached.googlecode.com/files/memcached-1.4.1.tar.gz
  13  tar xzvf memcached-1.4.1.tar.gz 
  14   cd memcached-1.4.1
  15  ./configure
  16  make
  17  make test
  18  sudo make install
  19  
  20  memcached -d -P pidfile -l 127.0.0.1

Tagged memcached, install, snowleopard

How to fix "fatal: 'gitosis-admin.git': unable to chdir or not a git archive"

Shell Script (Bash) posted 11 months ago by christian

Are the SSH keys valid?

When, not if, you get this error you most probably have the wrong keys listed in /home/git/.ssh/authorized_keys:

   1  $ git  clone git@xxx.com:gitosis-admin.git 
   2  Initialized empty Git repository in /Users/christian/Documents/Projects/gitosis-admin/.git/
   3  fatal: 'gitosis-admin.git': unable to chdir or not a git archive
   4  fatal: The remote end hung up unexpectedly

Try removing the keys in authorized_keys one by one, and verify that the names of the users match the ones in .gitosis.conf

http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

Try using the full path to the repository

   1  $ git clone git@xxx.com::/home/git/repositories/xxx.git

Check if the repository exists

   1  $ cd /home/git/repositories/xxx.git

   1  $ git clone /home/git/repositories/xxx.git

What does SSH say?

   1  ssh -v git@xxx.com

Use Google

http://stackoverflow.com/questions/1264262/connecting-to-gitosis-server-through-an-ssh-tunnel
http://stackoverflow.com/questions/733057/can-git-work-via-ssh-port-forwarding

Tagged git, fatal, gitosis, install, setup

How to install and use the mysql-python library

Python posted about 1 year ago by christian

First download mysql-python from http://sourceforge.net/projects/mysql-python.

Extract it and run:

   1  python setup.py build
   2  sudo python setup.py install

If you get this error you need to install python-dev package:

   1  In file included from _mysql.c:29:
   2  pymemcompat.h:10:20: error: Python.h: No such file or directory
   3  _mysql.c:30:26: error: structmember.h: No such file or directory
   4  In file included from /usr/include/mysql/mysql.h:44,
   5                   from _mysql.c:40:
   6  .
   7  .
   8  .
   9  _mysql.c:2808: warning: return type defaults to 'int'
  10  _mysql.c: In function 'DL_EXPORT':
  11  _mysql.c:2808: error: expected declaration specifiers before 'init_mysql'
  12  _mysql.c:2886: error: expected '{' at end of input
  13  error: command 'gcc' failed with exit status 1

Installing the python-dev package on Debian is done with apt-get or synaptic:

   1  apt-get install python-dev

Installing the library should now work:

   1  python setup.py build
   2  python setup.py install

Next test the library in the python console:

   1  import MySQLdb
   2  
   3  # Note that this example uses UTF-8 encoding
   4  conn = MySQLdb.connect(host='localhost', user='...', passwd='...', db='...', charset = "utf8", use_unicode = True)
   5  cursor = conn.cursor()
   6  
   7  
   8  cursor.execute ("SELECT * FROM cities")
   9  rows = cursor.fetchall ()
  10  
  11  for row in rows:
  12    print "%s, %s" % (row[0], row[1].encode('utf-8'))
  13  
  14  print "Number of rows returned: %d" % cursor.rowcount
  15  

Don’t forget to close the cursor and connection, and if you’re inserting data commit before closing, because autocommit is disabled by default:

   1  cursor.close ()
   2  conn.commit ()
   3  conn.close ()

For more information about MySQLdb see this article.

Tagged python, mysql, mysql-python, install