Installing reddit on a Vagrant Ubuntu 12.04 box
These instructions assume you have some experience with Vagrant and using Ubuntu from the command line. It should take less than 20 minutes to get your own reddit install up to play with.
- Windows 7
- Vagrant 1.2.2
- VirtualBox 4.2.10
- Git Bash as a terminal
Start setting up a Vagrant machine. Lines like this in your .Vagrantfile give you a good box to start with:
config.vm.box = "precise32" config.vm.box_url = "http://files.vagrantup.com/precise32.box"
In Git Bash, run:
Let the box start up, then run:
to log in. Once you are in the virtual machine, run:
sudo apt-get update
to get the latest lists of available packages. The installation script will fail without it.
Follow the instructions here: https://github.com/reddit/reddit/wiki/reddit-install-script-for-Ubuntu. I used
reddit.local as a host name. The install script will spend a few minutes downloading packages, installing applications, and configuring them as reddit requires.
There’s one hiccup in the process. The install scripts wants to setup the reddit DB in a utf8 locale. Ubuntu is set to use en_US though. The script stops with an error like this:
ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. CREATE ROLE + sudo -u postgres psql reddit psql: FATAL: database "reddit" does not exist
To get around this, stop the default PostgreSQL cluster, and start a new one with the correct locale for the reddit install script. I learned this from Ask Ubuntu.
sudo pg_dropcluster --stop 9.1 main sudo pg_createcluster --locale=en_US.utf8 --start 9.1 main
And start running the install script again with:
The script should make it all the way through to more instructions this time.
Viewing your Personal reddit
Update your Windows host file to include the line:
This tells your browser to connect to your own computer instead of trying to find reddit.local in the DNS. You may need to grant your Windows user permission to edit the file, or use an administrator account to edit it.
You will also have to enable port connections to port 80 in your .Vagrantfile. Run:
in the terminal to exit your VM and go back to your Windows machine. Add this line to the .Vagrant file:
config.vm.network :forwarded_port, guest: 80, host: 8080
In the terminal, restart the Vagrant box by running:
After it starts, visit
http://reddit.local:8080 in a Windows-based web browser to see your reddit.
You can install the default data as suggested in the instructions. After that, you’ll probably ask “How to login as an admin?”, which is answered along with many other questions here: https://github.com/reddit/reddit/wiki/FAQ