Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save syntaxsugar/7927095 to your computer and use it in GitHub Desktop.
Save syntaxsugar/7927095 to your computer and use it in GitHub Desktop.

Revisions

  1. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 0 additions and 3 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,3 @@
    How to install PostgreSQL on an Ubuntu 10.04 Vagrant box
    --------------------------------------------------------

    Here's how to install PostgreSQL and have it run automatically at startup, on
    an Ubuntu 10.04 virtual machine using [Vagrant](http://vagrantup.com/). This
    took me a while to figure out:
  2. Sean Hammond renamed this gist Mar 1, 2012. 1 changed file with 0 additions and 0 deletions.
  3. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -30,8 +30,8 @@ Blog](http://blog.crowdint.com/2011/08/11/postgresql-in-vagrant.html)). Edit
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8

    vagrant@lucid32> sudo locale-gen en_US.UTF-8
    vagrant@lucid32> sudo dpkg-reconfigure locales
    vagrant@lucid32> sudo locale-gen en_US.UTF-8
    vagrant@lucid32> sudo dpkg-reconfigure locales

    Disconnect from your virtual machine (ctrl-d) then connect again:

  4. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ Now make a new lucid32 virtual machine and install postgresql on it:

    Now you need to fix your locale settings (thanks, [Crowd Interactive Tech
    Blog](http://blog.crowdint.com/2011/08/11/postgresql-in-vagrant.html)). Edit
    /etc/bash.bashrc:
    `/etc/bash.bashrc`:

    vagrant@lucid32> sudo nano /etc/bash.bashrc

  5. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    How to install PostgreSQL on an Ubuntu 10.04 Vagrant box
    ========================================================
    --------------------------------------------------------

    Here's how to install PostgreSQL and have it run automatically at startup, on
    an Ubuntu 10.04 virtual machine using [Vagrant](http://vagrantup.com/). This
  6. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 1 addition and 0 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    How to install PostgreSQL on an Ubuntu 10.04 Vagrant box
    ========================================================

    Here's how to install PostgreSQL and have it run automatically at startup, on
    an Ubuntu 10.04 virtual machine using [Vagrant](http://vagrantup.com/). This
  7. Sean Hammond renamed this gist Mar 1, 2012. 1 changed file with 0 additions and 0 deletions.
  8. Sean Hammond renamed this gist Mar 1, 2012. 1 changed file with 0 additions and 0 deletions.
  9. Sean Hammond renamed this gist Mar 1, 2012. 1 changed file with 0 additions and 0 deletions.
  10. Sean Hammond renamed this gist Mar 1, 2012. 1 changed file with 0 additions and 0 deletions.
  11. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    How to install PostgreSQL on an Ubuntu 10.04 Vagrant box

    Here's how to install postgresql and have it run automatically at startup, on
    an Ubuntu 10.04 virtual machine using [vagrant](http://vagrantup.com/). This
    Here's how to install PostgreSQL and have it run automatically at startup, on
    an Ubuntu 10.04 virtual machine using [Vagrant](http://vagrantup.com/). This
    took me a while to figure out:

    Add the default lucid32 base box to your vagrant, if you haven't already:
  12. Sean Hammond revised this gist Mar 1, 2012. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    How to install PostgreSQL on an Ubuntu 10.04 Vagrant box

    Here's how to install postgresql and have it run automatically at startup, on an Ubuntu 10.04 virtual machine using [vagrant](http://vagrantup.com/). This took me a while to figure out:
    Here's how to install postgresql and have it run automatically at startup, on
    an Ubuntu 10.04 virtual machine using [vagrant](http://vagrantup.com/). This
    took me a while to figure out:

    Add the default lucid32 base box to your vagrant, if you haven't already:

    @@ -16,7 +18,9 @@ Now make a new lucid32 virtual machine and install postgresql on it:
    vagrant@lucid32> sudo aptitude update
    vagrant@lucid32> sudo aptitude install postgresql

    Now you need to fix your locale settings (thanks, [Crowd Interactive Tech Blog](http://blog.crowdint.com/2011/08/11/postgresql-in-vagrant.html)). Edit /etc/bash.bashrc:
    Now you need to fix your locale settings (thanks, [Crowd Interactive Tech
    Blog](http://blog.crowdint.com/2011/08/11/postgresql-in-vagrant.html)). Edit
    /etc/bash.bashrc:

    vagrant@lucid32> sudo nano /etc/bash.bashrc

    @@ -37,8 +41,9 @@ Disconnect from your virtual machine (ctrl-d) then connect again:

    You should see the list of databases output from psql.

    Now so you don't have to do it all again, disconnect from your virtual machine again and package it:
    Now so you don't have to do it all again, disconnect from your virtual machine
    again and package it:

    host> vagrant halt
    host> vagrant package
    host> vagrant box add lucid32_with_postgresql package.box
    host> vagrant box add lucid32_with_postgresql package.box
  13. Sean Hammond created this gist Mar 1, 2012.
    44 changes: 44 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    How to install PostgreSQL on an Ubuntu 10.04 Vagrant box

    Here's how to install postgresql and have it run automatically at startup, on an Ubuntu 10.04 virtual machine using [vagrant](http://vagrantup.com/). This took me a while to figure out:

    Add the default lucid32 base box to your vagrant, if you haven't already:

    host> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box

    Now make a new lucid32 virtual machine and install postgresql on it:

    host> mkdir mybox
    host> cd mybox
    host> vagrant init lucid32
    host> vagrant up
    host> vagrant ssh
    vagrant@lucid32> sudo aptitude update
    vagrant@lucid32> sudo aptitude install postgresql

    Now you need to fix your locale settings (thanks, [Crowd Interactive Tech Blog](http://blog.crowdint.com/2011/08/11/postgresql-in-vagrant.html)). Edit /etc/bash.bashrc:

    vagrant@lucid32> sudo nano /etc/bash.bashrc

    # Add these lines to the bottom of the file:
    export LANGUAGE=en_US.UTF-8
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8

    vagrant@lucid32> sudo locale-gen en_US.UTF-8
    vagrant@lucid32> sudo dpkg-reconfigure locales

    Disconnect from your virtual machine (ctrl-d) then connect again:

    host> vagrant ssh
    vagrant@lucid32> sudo pg_createcluster 8.4 main --start
    vagrant@lucid32> sudo su
    root@lucid32> sudo -u postgres psql -l

    You should see the list of databases output from psql.

    Now so you don't have to do it all again, disconnect from your virtual machine again and package it:

    host> vagrant halt
    host> vagrant package
    host> vagrant box add lucid32_with_postgresql package.box