Sunshine Tech and Media

Make Your Own Reddit – Reddit Open Source Guide

You can make your own Reddit! The old Reddit open source code is still available for anyone to download on GitHub. The setup process can be challenging, and there are a lot of bugs, so this guide will show you how to install, set up, AND customize your Reddit install.

Step 1. Prerequisites

To begin, you need to get a server and optionally a domain name. Your best option is to get a VPS, as it is much cheaper than buying a dedicated server.

I would recommend NameHero for VPS hosting and domain registration, but it doesn’t matter too much. Just make sure that your VPS has the following specifications.

  • Ubuntu 14.04 (Desktop image preferred)
  • At least 4GB of RAM
  • A bit of empty drive space
  • Docker

Next, in regards to your domain name, make sure that it has an A record pointing to your VPS server’s IP address, and the DNS has propagated.

Step 2. Install Reddit

Run the following commands in order.

wget https://raw.github.com/reddit/reddit/master/install-reddit.sh
chmod +x install-reddit.sh
sudo ./install-reddit.sh

During the install process, it will ask you to input a domain name. This is the domain name that will be used to access your website. In order to make sure that it is accessible, do the following next.

nano /etc/hosts Remove 127.0.0.1 reddit.local Type 127.0.0.1 hit [TAB] then type your domain name Click Ctrl+X then Y.

Now you need to make sure that every reference to a domain name is pointing to the appropriate one. Setting this up wrong will lead to issues with signing up. To do this, do the following.

nano $REDDIT_HOME/src/reddit/r2/development.update Replace ALL mentions of reddit.local, or any other domain name with your desired domain. Click Ctrl+X then Y Run make ini

Step 2. Create First Accounts and Subreddits

This step is simple, just go to your domain name, find the sign up button and create a new account, then login to it.

Also, create an account called “automoderator”.

Next, you’re going to want to create your first subreddit. To do this, go to YOURDOMAIN.COM/createsubreddit.html and create as many as you would like.

If you’d like to prevent future people from creating subreddits, either remove the createsubreddit.html file from $REDDIT_HOME/src/reddit/r2/r2/templates THEN run make all from $REDDIT_HOME/src/reddit/r2 or change the appropriate line in development.update to the following, and run make ini from $REDDIT_HOME/src/reddit/r2

create_sr_account_age_days = 10950

Step 3. Set Admin Accounts And Default Subreddits

To set your account as a site-wide admin account, run the following in order.

nano $REDDIT_HOME/src/reddit/r2/development.update Add a section at the bottom of this file called [live_config], like how there is a section called [DEFAULT].

Now, add a line in this section stating the following: employees = %(system_user)s:admin, automoderator:admin, YOURUSERNAME:admin

Again, click Ctrl+X then Y, then run make ini

To set default subreddits, do the following… (NOTE: you can add more or less subreddits than shown, and also make sure to replace SUBREDDIT# with your subredditname.)

reddit-shell NOW run…

from r2.models import Subreddit, LocalizedDefaultSubreddits

srs = [Subreddit._by_name(name) for name in ["SUBREDDIT1", "SUBREDDIT2", "SUBREDDIT3", "SUBREDDIT4"]]

LocalizedDefaultSubreddits.set_global_srs(srs)

exit()

Now run: sudo start reddit-job-update_reddits

Step 4. Customize Site

In order to customize your new website, visit the directory $REDDIT_HOME/src/reddit/r2/r2 and then modify the appropriate files in the right directories. For example, HTML files are in the ‘templates’ directory. CSS is in another, and things like your logos are modified in CSS. It is important to note one specific bug: when changing an image, don’t just delete, for example, header.png and add the new logo under the name header.png. Instead, you must upload something like header2.png and then change the appropriate CSS to consider header2.png the header image.

For removing Reddit gold, you can modify the appropriate Python file to create a self-contradicting code for its visibility, and remove mentions of it in things like the settings HTML file.

With fixing bugs and customizing your Reddit install, Google is going to be your best friend. Some stuff will be hard to find, but there are a lot of forum posts out there outlining how to fix issues and conduct appropriate modifications.

IMPORTANT: I have included fixes to many common problems on my GitHub wiki page.