Skip to content

Commit 074a751

Browse files
committed
add new post on spinning up a digitalocean server
1 parent 97c7ee1 commit 074a751

File tree

14 files changed

+167
-1
lines changed

14 files changed

+167
-1
lines changed

content/pages/01-introduction/04-python-2-or-3.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ should upgrade as soon as possible.
137137
provides perspective from a core Python developer on how the transition from
138138
Python 2 to 3 is going as of the end of 2015.
139139

140+
* [How Dropbox rolled out one of the largest Python 3 migrations ever](https://blogs.dropbox.com/tech/2018/09/how-we-rolled-out-one-of-the-largest-python-3-migrations-ever/)
141+
explains how their transition began in 2015 and was successfully completed
142+
in 2018.
143+
140144
* [Why Python 3?](http://whypy3.com/) randomly outputs valid reasons to
141145
use Python 3 over 2.x.
142146

content/pages/05-deployment/17-web-servers.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ possible.
125125
is a wonderful read that shows how detailed knowledge at every layer of
126126
the stack is necessary to optimize web server connections at scale.
127127

128+
* [Implementing a tiny web server in a single printf call](https://tinyhack.com/2014/03/12/implementing-a-web-server-in-a-single-printf-call/)
129+
is an absurd C language hack that you would never want to use in any
130+
real project but still an amazing little application and wonderful
131+
explanation that you can learn a bit more about web servers by reading.
132+
128133

129134
### Web servers learning checklist
130135
1. Choose a web server. [Nginx](http://nginx.org/en/) is often recommended

content/pages/meta/00-change-log.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on GitHub.
1616

1717
## 2018
1818
### October
19-
* Published new blog post showing
19+
* Published a new blog post showing
2020
[How to Add User Authentication to Flask Apps with Okta](/blog/add-user-authentication-flask-apps-okta.html).
2121
* Merge [PR #189](https://github.com/mattmakai/fullstackpython.com/pull/189)
2222
to help readers figure out how to get around some security warning issues
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
title: How to Provision Ubuntu 18.04 LTS Linux Servers on DigitalOcean
2+
slug: provision-ubuntu-1804-linux-servers-digitalocean
3+
meta: Learn how to provision Ubuntu 18.04 LTS on DigitalOcean for deploying your web applications.
4+
category: post
5+
date: 2018-10-14
6+
modified: 2018-10-14
7+
newsletter: False
8+
headerimage: /img/181014-digitalocean-ubuntu/header.jpg
9+
headeralt: Flask, Green Unicorn and Ubuntu logos. Copyright their respective owners.
10+
11+
12+
[Python web applications](/web-development.html) need to be
13+
[deployed](/deployment.html) to a production [server](/servers.html) or
14+
[service](/platform-as-a-service.html) so your users have access to
15+
the application.
16+
17+
[DigitalOcean](https://do.co/fullstackpython) is one such service
18+
that makes it easy to immediately get access to initially free servers
19+
which are low cost (~$5 per month depending on the resources) to continue
20+
using after the first few months.
21+
22+
In this tutorial we'll learn how to quickly sign up and spin up an
23+
[Ubuntu](/ubuntu.html)-based Linux server that only you will have
24+
access to based on a private SSH key.
25+
26+
27+
## Obtain Your Virtual Server
28+
These steps sign you up for a DigitalOcean account and guide you through
29+
provisioning a virtual private server called a "Droplet" for $5/month which
30+
we configure throughout the rest of the book.
31+
32+
Point your web browser to
33+
[Digitalocean.com's registration page](https://do.co/fullstackpython).
34+
Note that this link uses a referral code which gives you $100 in free
35+
credit. Feel free to just go to
36+
[digitalocean.com](https://www.digitalocean.com/) if you
37+
do not want to use the referral link (you will not get the $100 in credit
38+
though). Their landing page will look something like the following image.
39+
40+
<img src="/img/181014-digitalocean-ubuntu/do-landing-page.jpg" class="shot rnd outl" alt="DigitalOcean landing page." width="100%">
41+
42+
Register for a new DigitalOcean account. Fill out the appropriate
43+
information. When your account is registered and active you can create
44+
a new DigitalOcean server, which they call "droplets".
45+
46+
After you finish the registration process you will be able to start
47+
creating DigitalOcean servers. Select the "Create" button which
48+
opens a drop-down menu. Choose "Droplets" to go to the "Create Droplets"
49+
page.
50+
51+
<img src="/img/181014-digitalocean-ubuntu/create-droplet.png" class="shot rnd outl" width="100%">
52+
53+
The new droplet configuration screen will appear and look like
54+
the following image. The default Ubuntu instance is 16.04, but
55+
we will use the newer LTS release 18.04 in this book.
56+
57+
<img src="/img/181014-digitalocean-ubuntu/create-droplets-page.jpg" class="shot" width="100%">
58+
59+
Select the 1 GB memory-sized server for $5 per month. This instance
60+
size should be perfect for prototypes, side projects and minimum
61+
viable products. Feel free to choose a larger instance size if you
62+
want more memory and resources for running your application.
63+
64+
<img src="/img/181014-digitalocean-ubuntu/create-droplet-size.jpg" class="shot" width="100%">
65+
66+
Scroll down and choose the data center region where you want your
67+
instance to be located. I typically choose New York because I am
68+
on the East Coast of the United Statest in Washington, D.C., and you will
69+
want the server to be closest to your users' location.
70+
71+
<img src="/img/181014-digitalocean-ubuntu/choose-region.png" class="shot" alt="Choose the data center region closest to your customers." width="100%">
72+
73+
Next, scroll down and click "New SSH Key". Copy and paste in the contents
74+
of your **public** SSH key. If you do not yet have an SSH key here are a
75+
couple of guides that will walk you through creating one:
76+
77+
* [Creating SSH keys on macOS](/blog/ssh-keys-macos-sierra.html)
78+
* [Creating SSH keys on Ubuntu Linux](/blog/ssh-keys-ubuntu-linux.html)
79+
80+
You can see the contents of a public key using the `cat` command. For
81+
example on my system the command:
82+
83+
```bash
84+
cat root.pub
85+
```
86+
87+
Outputs the contents of my public key:
88+
89+
```bash
90+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCqAY/Le17HZpa4+eSoh2L9FMYaQ7EnLOGkYbcbsiQNpnF4FTAemF7tbvMvjpVLU6P9AVGs6qEeJdgTE2gH8fq881AUsQ8it1gla2oAlc+vOZmqWPYaLIl5g9DkGwvbITXayobDcw9wTN5tOITOxp3BV5jqanqoqDAPH1RGfT6A5vkJFsmu4w7cPsn9tiqfZZdge3WkpMNT1M3ou+ogrAwE6Ra531s3zYVG9y1688BGdYzbQFfU0+Pou6Z43Do6xbh2hAfQ5hUuTG0OrE3b/yhGcxEWz0Y9+wPGmxm3/0ioTfMWUG3LOQn+oMtKX/PXX/qOJuUjszbqYBvSYS3kv2IVFGV2KEIKC1xgUDfw+HOV4HlIosIbc97zY83m0Ft+tFavPaiQYrar3wCsVfRUltSR4EwNnLmvNYeMVSS8jSP2ZSPwbL8GO7xxAAS9Oy12set1f4OxdPhEUB9rEfAssU1mE6J5eq+Drs8KX04OasLSLt7kP7wWA27I9pU/y9NRHxEsO0YbLG7DzfHGl4QVXwDjIA5GpwjQMwZLt+lyGc4hpnuXg+IUR6MXI90Hh64ch32nSC8j/hjnWCWgj8Cyuc4Rd/2OtO5dHpbjSyU5Yza2lzIqFbFRo7aQNaIkBIioJnc1d6mrg9mLxfd5Ef2ez9bUjqcq4K7uH/JAm0H2Vk1VFQ== matthew.makai@gmail.com
91+
```
92+
93+
Copy and paste this key into the DigitalOcean modal window and give it
94+
a memorable name for future reference:
95+
96+
<img src="/img/181014-digitalocean-ubuntu/root-key.png" class="shot rnd outl" alt="Paste in the public root key into the modal window." width="100%">
97+
98+
Optionally, give your server a nickname such as `flask-deploy-manual`.
99+
Then click the big green "Create" button at the bottom of the screen.
100+
101+
The server provisioning process will begin and our Ubuntu Linux 18.04
102+
LTS-powered will soon be ready to go.
103+
104+
Ubuntu 18.04 is the current Long Term Support (LTS) release and has a
105+
5 year support lifecycle. This version will receive security updates until
106+
April 2023 as shown on the
107+
[Ubuntu release end-of-life](https://www.ubuntu.com/info/release-end-of-life)
108+
page.
109+
110+
<img src="/img/181014-digitalocean-ubuntu/ubuntu-lts-releases.png" class="shot rnd outl" alt="Ubuntu end of life schedule for all releases." width="100%">
111+
112+
You should now be back on the DigitalOcean dashboard.
113+
114+
<img src="/img/181014-digitalocean-ubuntu/ready-to-deploy.png" class="shot rnd outl" alt="New Ubuntu server ready for access." width="100%">
115+
116+
Our server is now up and ready for SSH access.
117+
118+
Connect to the server using the IP address associated with it:
119+
120+
```
121+
# make sure to replace 192.168.1.1 with your server's IP address
122+
# and the "private_key" name with the name of your private key
123+
ssh -i ./private_key 192.168.1.1
124+
```
125+
126+
You should now be connected to your new server and can proceed
127+
with development or deployment.
128+
129+
130+
## What's Next?
131+
We just stood up a new virtual private server on DigitalOcean that can be
132+
used as a production or development environment.
133+
134+
Next up I recommend either configuring the development environment or
135+
deploying your application with one of the following tutorials:
136+
137+
* [Configure Python 3, Flask and Gunicorn on Ubuntu 18.04 LTS](/blog/python-3-flask-gunicorn-ubuntu-1804-bionic-beaver.html)
138+
* [How to Make Phone Calls in Python](/blog/make-phone-calls-python.html)
139+
* [5 ways to deploy your Python web app from PyCon US 2017](https://www.youtube.com/watch?v=vGphzPLemZE)
140+
141+
You can also figure out what to code next in your Python project by reading
142+
the [Full Stack Python table of contents page](/table-of-contents.html).
143+
144+
Questions? Contact me via Twitter
145+
[@fullstackpython](https://twitter.com/fullstackpython)
146+
or [@mattmakai](https://twitter.com/mattmakai). I'm also on GitHub with
147+
the username [mattmakai](https://github.com/mattmakai).
148+
149+
Something wrong with this post? Fork
150+
[this page's source on GitHub](https://github.com/mattmakai/fullstackpython.com/blob/master/content/posts/181014-digitalocean-ubuntu-1804.markdown)
151+
and submit a pull request.
71.5 KB
Loading
156 KB
Loading
165 KB
Loading
152 KB
Loading
218 KB
Loading
43.8 KB
Loading

0 commit comments

Comments
 (0)