Share the Knowledge
RSS icon Home icon
  • Migrating WordPress from a shared hosting environment to a virtual private server

    Posted on November 9th, 2011 webmaster 3 comments         Print Print

    I was migrating this WordPress blog early this morning from Bluehost to a dedicated Rackspace Cloud Server that I’m already using for a web application I’m writing.  It was almost painless! Just ran into a few minor post-migration issues.

    The reason I’m migrating is mainly because I want more control, like being able to use my own self-signed SSL certificate without paying extra, for example.  I figured since I’m getting very low traffic it really wouldn’t cost me anything extra to host it on Rackspace.

    For example, according to Bluehost, my monthly bandwidth transfer is roughly 2.3GB.  I’m not sure if that’s for both inbound and outbound.  Either way, Rackspace only charges 18 cents/GB for outbound bandwidth (inbound is free).  So even if I’m using 3GB a month, it’s only an extra 54 cents to my monthly cost.  Rackspace’s connection is also way faster.

    The migration steps are pretty straighforward, basically:

    1. Install PHP, MySQL, Apache.
    2. Install WordPress.
    3. Restore the database.
    4. Copy over your themes, uploads, plugins, and other directories that a plugin might be using (in my case I had an extra “gallery” directory for the NextGEN Gallery plugin that I’m using to store my pictures).
    5. Restart Apache.

    Here are the issues I ran into after migration and their solutions:

    Read the rest of this entry »

  • How to allow remote connections to your PostgreSQL 9.0 database server on Ubuntu 10.04 LTS

    Posted on September 8th, 2011 webmaster No comments         Print Print

    Change directory to /etc/postgresql/9.0/main and modify the following configs (I know you’re sick of hearing this, but I recommend you back up your original configs before making any changes):

    postgresql.conf

    In “Connections and Authentication” section:

    From

    
    #listen_addresses = 'localhost'
    #password_encryption = on
    

    To

    
    listen_addresses = '*'
    password_encryption = on
    

    pg_hba.conf

    From

    host    all    all    127.0.0.1/32    md5
    host    all    all    ::1/128    md5
    

    To

    host    all    all    0.0.0.0/0   md5
    host    all    all    ::0/0    md5
    

    Restart the ssh daemon: /etc/init.d/ssh restart

  • How to import data from a CSV file into a PostgreSQL database

    Posted on April 19th, 2011 webmaster No comments         Print Print

    I was working on my personal project last week and needed to import some data in CSV format to a PostgreSQL database.  I wanted only certain fields to be imported so I had to specify this in the command.  I’m new to PostgreSQL so it took me quite a bit of Googling to figure out exactly how to do this.

    Here’s how I did it on Ubuntu 10.04 LTS, ‘glucosetracker’ is the name of my database:

    
    psql glucosetracker
    
    \COPY glucose_glucose(owner_id, glucose_value, category_id, record_date, record_time, notes, created_on, last_updated_on) from '/home/jc/Downloads/jc_glucose_data.csv' DELIMITERS ',' CSV;
    

    Note that ‘COPY is not exactly the same as ‘\COPY’. The COPY command runs under the PostgreSQL backend user (default ‘postgres’) so this user will need read access to your CSV file.  The \COPY command runs under the user executing the command.  I was getting permission denied errors my first few tries because I was using ‘COPY’ instead of ‘\COPY’ since I thought they were they same thing.