Archive for May, 2008

Using VMWare when not connected to LAN

Monday, May 26th, 2008 by The BCM Team

As you might have noticed in VMWare the default network mode is “Bridged”, which means that your VMWare guest OS will behave as a separate computer with its own IP address. It’s all good except one thing – it requires your PC (on which VMWare is running) to be connected to a LAN. In other words, the network adapter of your computer must have an IP address assigned, otherwise you wont get VMWare networking to work.

Luckly, if you use MS Windows, there is a thing called Loopback network adapter. In Vista, for example, (as I suspect) it’s installed by default (you just have to enable it via settings of your network adapter). In Windows XP, you might have to install it.

What it does is emulates a LAN on your PC and makes it so you don’t need to be connected to a network in order to develop/test your applications on the network. It’s pretty handy if you have a dev server set up in VMWare. Just enable this loopback network connection everytime you are not on the physical network but want to use VMWare.

Read more about loopback adapter

List of useful CentOS commands

Sunday, May 25th, 2008 by The BCM Team

Below is a list of common commands in CentOS that I tend to forget:

Crontabs

  • "crontab -l" – list all crontabs
  • "crontab -e" – edit crontabs

Mindquarry under CentOS: mod_perl2 and LWP::Agent dependancies

Saturday, May 24th, 2008 by The BCM Team

If you, like me, got to the point where you have Mindquarry installed on your linux distribution together with Java Runtime but still can not run Mindquarry successfully and the error says something like:
“you need to install mod_perl2 and LWP::Agent” then this post is for you.

To install LWP::Agent: Download it and install by placing into the directory accessible via global PATH variable.

To install mod_perl2: execute in your terminal yum install mod_perl and make sure that the version you are installing is >2.x

Setting environment variables in CentOS

Friday, May 23rd, 2008 by The BCM Team

If you are using Bash as your terminal, here’s what you need to do:

Edit ~/.bash_profile by adding the following (if you want to set TESTVAR variable to “This_is_a_value” value)


export TESTVAR=This_is_a_value

Install VMWare Tools (Host – Windows, Guest – Linux)

Thursday, May 22nd, 2008 by The BCM Team

Install software needed by VMware Tools

Note: you need to boot the 1-1 kernel from grub for this to work.

  1. Install packages to build the kernel modules: yum install gcc kernel-devel
  2. Check the running kernel matches the kernel headers:
    
    uname -r             # running kernel
    rpm -q kernel-devel  # installed kernel headers
    
    
  3. If the two versions do not match, run:
    
    yum -y upgrade kernel kernel-devel
    reboot
    
    
  4. Find out where the kernel headers are (you may need this later): ls -d /usr/src/kernels/$(uname -r)*/include

Prepare and install VMware Tools

Note: this guide is for you If you are running the VM inside VMware Workstation 5.5+

  1. From VMware Workstation: go to VM> Install VMware Tools
  2. From the VM: mount the virtual cd drive: mount /dev/cdrom /mnt/
  3. Extract VMware Tools to: /tmp/tar -C /tmp -zxvf /mnt/VMwareTools-5.5.3-34685.tar.gz
  4. Unmount the virtual cd drive: umount /mnt
  5. Now run the installer:
    
    cd /tmp/vmware-tools-distrib
    ./vmware-install.pl
    
    
  6. When asked “Do you want to run vmware-config-tools.pl?”, answer “Yes”.

Checkout from SVN repository running on another host where SSH is running on a custom port

Thursday, May 15th, 2008 by The BCM Team

Let’s say you want to checkout from your svn repository that is running on the remote host and on that host the port used for ssh is not the default (port 22).

You cannot use a custom port in the following command:

svn co svn+ssh://username@example.com/home/username/repository_path

What you need to do is edit the following file: ~/.subversion/config and add (under [tunnel] section) a similar line to:

myremotessh= ssh -p 1122

What this does is sets up a custom protocol that you can use in your command to ssh to a custom port number. So, to use the above setting we’d have to run something like this:

svn co svn+myremotessh://username@example.com/home/username/repository_path

This way, if you want to use svn+ssh on port 22 you can still do, while setting up custom protocols for hosts that have ssh running on custom ports.

Hints collection for a quick start with Amazon EC2 and S3

Wednesday, May 14th, 2008 by The BCM Team

These instructions are for Windows environment.

  • Download a private key and an x.905 certificate from your control panel on Amazon website and place them into the same folder as the batch file and EC2 Command line tools mentioned below.
  • Configure your environment variables. I suggest either add the settings to your Windows installation options or use the following batch file:
    
    @echo off
    set EC2_HOME=C:\ec2
    set PATH=%PATH%;%EC2_HOME%\bin
    set EC2_PRIVATE_KEY=%EC2_HOME%\privatekey.pem
    set EC2_CERT=%EC2_HOME%\certificate.pem
    set JAVA_HOME=C:\Program Files\Java\jre1.6.0_xx
    "%JAVA_HOME%\bin\java" -version
    

    privatekey.pem” and “certificate.pem” are the files mentioned above.Be sure to have Java Runtime Environment 1.5+ installed. You will also need to download EC2 Command Line tools from Amazon AWS Resource Center page.

  • Choose an Operating System image (AMI) that you will be using as a base for your server OS installation. For example, I am using an image of a base install of CentOS 5.0
  • You can see a list of all available images using the following command “ec2-describe-images -x all“. Here, “-x all" means show all available images available. Each image has a unique number listed before the description. You will need this number to refer to the image.
  • ec2-add-keypair <private_key_file_name> – generate private/public key file to use with SSH client that you choose to use. Where <name> is a name of a file of
  • ec2-run-instances ami-08f41161 -k <private_key_file_name> – run an instance of your AMI
  • ec2-terminate-instances <instance_number> – terminate a running instance
  • ec2-authorize default -p 22 and ec2-authorize default -p 80 – open ports for HTTP and SSH2
  • ec2-describe-instances – display stats for your AMIs
  • ec2-upload-bundle --retry -b <your bundle name> -m /mnt/image.manifest.xml -a <your access key> -s <your secret access key> – copy bundled AMI to your S3 storage
  • ec2-bundle-vol -d /mnt -k /mnt/<private_key.pem> -c /mnt/<certificate.pem> -u <aws_user_number>
  • ec2-upload-bundle --retry -b <your-s3-bucket> -m /mnt/image.manifest.xml -a <aws-access-key-id> -s <aws-secret-access-key>
  • ec2-register <your-s3-bucket>/image.manifest.xml

Manually start a service in CentOS

Tuesday, May 13th, 2008 by The BCM Team

service <service_name> start.

For example: service httpd start

Convert Propel object to Array

Tuesday, May 13th, 2008 by The BCM Team

To convert a Propel object (a database row representation) to a normal array use the following:
$member->toArray(), where $member is a propel object.