Open-sourcing the setup of this website through notes (below) I wrote for a session taught.
Gets you familiar with:
- Linux and command line
- Ruby (gems, package managers, annoying parts)
- Apache (or Nginx)
- Git (github, bitbucket etc)
- Nano (terminal text editor)
- XML/HTML/ CSS
how programmers work/get frustrated… street cred
- Exposes you to open source tech
- Liberates you from Cyber Duck
There are ALOT of benefits of having own server:
- Build more websites without paying more
- Experiment with new tech (I built my own VPN)
- Storage space in the cloud (nobody uses it for that, but it’s possible)
Free Hipster themes and a great community
Digital Ocean (DO)
- Sign up / Login
- Create Droplet
- Ubuntu 14.04.3 x64
- $5/month (20 GB SSD)
- Datacenter: your call, gives you an IP address
- Additional options (backup is paid, can configure later)
- no SSH keys (unless you have one, or know what it is)
- root password emailed
- Give it a name
- More (dropdown), adding domains, access console
DO - Console
- console access
- username: root
- password: (emailed)
Might have to login & reset VPS password if you didn’t receive it (DO bug)
- On your terminal
- set-new password (alpha numeric) if it’s first time logging in
- Type ‘exit’ to close/logout
Alternatives to DO
We’re using DO for its UI and cost effectiveness primarily.
Linode was the preferred hosting provider by Developers (think early-mid 2000’s). DO offered a much cleaner (simpler) and cheaper (4 times) experience however, getting a lot of traction with newbies. There are a ton of benefits to Linode, but not if you’re a newbie.
Amazon AWS (EC2)
Let’s not go there, but they’re a full scale IaaS provider. They offer alot more than you need.
DreamHost is another option. Your call, but this tutorial covers DO specifically.
GitHub Pages is not really an alternative to DigitalOcean but I’m listing it here as an alternative to setting up your website on Jekyll. If you use GH Pages, you’ll save a lot of hassle, because they take care of the infrastructure (server setup, git & ruby installation, virtual hosts (apache)) leaving you to focus on working on your website only. My aim is to teach you how to setup your own server because of its benefits.
We’re now installing software on our computers using command line
- You’re the owner (root access) of the machine…if you change something (like install a newer version of Ruby - which could break your other apps), only you get effected
- You will Google for errors. Stackoverflow is your friend…and so are the residents
- When explaining terms like RVM, BREW or APT-GET, I will keep things simple so please don’t hold me to them and I could be wrong
- You can come across unexpected errors which I didn’t when covering this tutorial. Look for help if that’s the case, chances are somebody came across it too - Google is your best bet.
LOCAL - ruby, rvm, jekyll
You need to have root access and open terminal (command+spacebar on mac, type: terminal). Then: “pwd” (enter).
Move to /Users/yourname.
- curl -L https://get.rvm.io (curl is the equivalent of a URL but in linux)
- rvm is like a software that manages Ruby (and its libraries) to make sure you get the latest or stable version
pipe (it’s called taco-bell programming)
- bash -s stable —ruby=2.3.0
Once that’s done (it will take several minutes), log out and log back in.
LOCAL: Homebrew & Git
Homebrew is to Unix (Mac) what RVM is to Ruby or bundle is to gems It will help you install github on your mac without dealing with conflicts
LOCAL: build the blog
Browser: localhost:4000/ Edit this page using sublime
You bought and setup a server (VPS - linux) on Digital Ocean
On your local machine you setup:
- a new jekyll blog (awesomeblog)
- Setup Git to manage the blog code
Next: do the above on VPS (Digital Ocean) and connect with each other
VPS : Apache
Right now you have a HDD in space with Linux installed in it, and you can login to it. That’s it. Now we’re installing software that processes HTTP requests. That’s Nginx or Apache (50% of internet pages are served through them).
One of them is good for extremely large traffic, the other isn’t.
VPS: Ruby, Jekyll, Git
If: gpg —keyserver error: gpg –keyserver hkp://keys.gnupg.net –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \curl -L https://get.rvm.io | bash -s stable –ruby
VPS: bare git repo
Control + o (write, save) and control + X (exit)
Press enter, chmod makes it an executable file not a simple text file anymore.
LOCAL: Connecting Local with VPS
Exiting server and now on local, make sure you’re in the right directory.
TIME DEPENDENT :: VPS CONFIG APACHE (get your own domain pointing to your blog)
Change values, and add two directives ( ServerName osamasehgol.com & ServerAlias www.osamasehgol.com)
Enable virtual host file:
Receive message: enabling site awesomeblog
You’re Done! >:-D
- Actual Tutorial
- Changing Domain Name
- GitHub pages (like Wordpress)
- Rbenv or RVM
- Ruby - David H