Background Image
Table of Contents Table of Contents
Previous Page  165 / 478 Next Page
Information
Show Menu
Previous Page 165 / 478 Next Page
Page Background

Spinning Up a Server

I’m not going to dictate how you do this—whether you choose Amazon AWS, Rack‐

space, Digital Ocean, your own server in your own data centre or a Raspberry Pi in a

cupboard behind the stairs, any solution should be fine, as long as:

• Your server is running Ubuntu (13.04 or later).

• You have root access to it.

• It’s on the public Internet.

• You can SSH into it.

I’m recommending Ubuntu as a distro because it has Python 3.4 and it has some specific

ways of configuring Nginx, which I’m going to make use of next. If you know what

you’re doing, you can probably get away with using something else, but you’re on your

own.

Some people get to this chapter, and are tempted to skip the do‐

main bit, and the “getting a real server” bit, and just use a VM on their

own PC. Don’t do this. It’s

not

the same, and you’ll have more diffi‐

culty following the instructions, which are complicated enough as it

is. If you’re worried about cost, dig around and you’ll find free op‐

tions for both. Email me if you need further pointers, I’m always

happy to help.

User Accounts, SSH, and Privileges

In these instructions, I’m assuming that you have a nonroot user account set up that

has “sudo” privileges, so whenever we need to do something that requires root access,

we use sudo, and I’m explicit about that in the various instructions below. If you need

to create a nonroot user, here’s how:

# these commands must be run as root

root@server

:$

useradd -m -s /bin/bash elspeth

# add user named elspeth

# -m creates a home folder, -s sets elspeth to use bash by default

root@server

:$

usermod -a -G sudo elspeth

# add elspeth to the sudoers group

root@server

:$

passwd elspeth

# set password for elspeth

root@server

:$

su - elspeth

# switch-user to being elspeth!

elspeth@server

:$

Name your own user whatever you like! I also recommend learning up how to use

private key authentication rather than passwords for SSH. It’s a matter of taking the

public key from your own PC, and appending it to

~/.ssh/authorized_keys

in the user

account on the server. You probably went through a similar procedure if you signed up

for Bitbucket or Github.

Manually Provisioning a Server to Host Our Site

|

137