-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_ubuntu.html
437 lines (332 loc) · 20.5 KB
/
setup_ubuntu.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Linux Setup — ClojureBridgeMN Documentation November 4-5, 2016 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="index" title="Index"
href="genindex.html"/>
<link rel="search" title="Search" href="search.html"/>
<link rel="top" title="ClojureBridgeMN Documentation November 4-5, 2016 documentation" href="index.html"/>
<link rel="up" title="Installfest" href="setup.html"/>
<link rel="next" title="Welcome to ClojureBridge" href="welcome.html"/>
<link rel="prev" title="Windows 10 Setup" href="setup_win10.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> ClojureBridgeMN Documentation
</a>
<div class="version">
Saturday Nov 5 2016 @ 15:59:08 futuro
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="setup.html">Installfest</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="setup.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="setup.html#code-of-conduct">Code of Conduct</a></li>
<li class="toctree-l2"><a class="reference internal" href="setup.html#what-we-are-installing">What we are installing</a></li>
<li class="toctree-l2"><a class="reference internal" href="setup.html#instructions-for-all">Instructions for all</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="setup.html#instructions-by-operating-system">Instructions by operating system</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="setup_osx.html">Mac OS X</a></li>
<li class="toctree-l3"><a class="reference internal" href="setup_win7.html">Windows 7</a></li>
<li class="toctree-l3"><a class="reference internal" href="setup_win8.html">Windows 8</a></li>
<li class="toctree-l3"><a class="reference internal" href="setup_win10.html">Windows 10</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Linux</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#starting-a-terminal">Starting a terminal</a></li>
<li class="toctree-l4"><a class="reference internal" href="#installing-git-and-ruby">Installing Git and Ruby</a></li>
<li class="toctree-l4"><a class="reference internal" href="#installing-java">Installing Java</a></li>
<li class="toctree-l4"><a class="reference internal" href="#installing-leiningen">Installing Leiningen</a></li>
<li class="toctree-l4"><a class="reference internal" href="#installing-the-heroku-command-line-interface-cli">Installing the Heroku Command Line Interface (CLI)</a></li>
<li class="toctree-l4"><a class="reference internal" href="#testing-your-setup">Testing your setup</a></li>
<li class="toctree-l4"><a class="reference internal" href="#try-the-koans">Try the koans</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="welcome.html">Welcome to ClojureBridge</a></li>
<li class="toctree-l1"><a class="reference internal" href="track1.html">Track 1</a></li>
<li class="toctree-l1"><a class="reference internal" href="track2.html">Track 2</a></li>
<li class="toctree-l1"><a class="reference internal" href="resources.html">Clojure Resources</a></li>
<li class="toctree-l1"><a class="reference internal" href="community.html">Connect with the Clojure Community</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">ClojureBridgeMN Documentation</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li><a href="setup.html">Installfest</a> »</li>
<li>Linux Setup</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/setup_ubuntu.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="linux-setup">
<h1>Linux Setup<a class="headerlink" href="#linux-setup" title="Permalink to this headline">¶</a></h1>
<div class="section" id="starting-a-terminal">
<h2>Starting a terminal<a class="headerlink" href="#starting-a-terminal" title="Permalink to this headline">¶</a></h2>
<p>For these instructions, and for much of the class, you will need to have a terminal, or command line, open. This is a text-based interface to talk to your computer, and you can open it by clicking “Dash Home” and typing <code class="docutils literal"><span class="pre">Terminal</span></code>. You can also open a terminal at any time by pressing <code class="docutils literal"><span class="pre">CTRL-ALT-T</span></code>. If you have never used the terminal before, you may want to spend some time <a class="reference external" href="http://blog.teamtreehouse.com/command-line-basics">reading up on command-line basics</a>.</p>
<p>Go ahead and open your terminal now. It should look something like this:</p>
<p><img alt="blank terminal" src="_images/blank_terminal1.png" /></p>
<p>The prompt (where you will type your commands) may look different: it usually shows the computer name and user name, as well as the folder or directory you are currently in.</p>
<p>For the rest of this setup, I will tell you to run commands in your terminal. When I say that, I mean “type the command into the terminal and press the Return key.”</p>
</div>
<div class="section" id="installing-git-and-ruby">
<h2>Installing Git and Ruby<a class="headerlink" href="#installing-git-and-ruby" title="Permalink to this headline">¶</a></h2>
<p>The <strong>git</strong> version control system is packaged for your Linux distribution.
On Debian Ubuntu systems you can install it with the following
<em>(as the superuser)</em>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>root@mylaptop# apt-get update
root@mylaptop# apt-get install git git-core git-man ruby
</pre></div>
</div>
<p><em>NOTE: We are installing Ruby because it’s needed by the Heroku Command Line Interface</em></p>
</div>
<div class="section" id="installing-java">
<h2>Installing Java<a class="headerlink" href="#installing-java" title="Permalink to this headline">¶</a></h2>
<p>On Ubuntu you should be able to install Java with:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>sudo apt install default-jdk
</pre></div>
</div>
</div>
<div class="section" id="installing-leiningen">
<h2>Installing Leiningen<a class="headerlink" href="#installing-leiningen" title="Permalink to this headline">¶</a></h2>
<p>Leiningen is a tool used on the command line to manage Clojure projects.</p>
<p>Go to the <a class="reference external" href="http://leiningen.org/">Leiningen website</a>. You will see a link to the <code class="docutils literal"><span class="pre">lein</span></code> script under the “Install” heading. Right-click that link and choose “Save Link As...”. Save it in your Downloads directory.</p>
<p><img alt="Leiningen site" src="_images/leiningen_site.png" />
<img alt="Leiningen site" src="_images/lein_install.png" /></p>
<p>After that, run the following commands in your terminal:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>clojurista@mylaptop$ mkdir ~/bin
clojurista@mylaptop$ cd ~/bin
clojurista@mylaptop$ mv ~/Downloads/lein ./
clojurista@mylaptop$ chmod +x lein
clojurista@mylaptop$ lein version
Leiningen 2.7.1 on Java 1.8.0_112 Java HotSpot(TM) 64-Bit Server VM
clojurista@mylaptop$
</pre></div>
</div>
<p>After you run the above commands, run the <code class="docutils literal"><span class="pre">lein</span> <span class="pre">version</span></code> command. It should take a while to run, as it will download some resources it needs the first time. If it completes successfully, you are golden! If not, ask an instructor for help.</p>
</div>
<div class="section" id="installing-the-heroku-command-line-interface-cli">
<h2>Installing the Heroku Command Line Interface (CLI)<a class="headerlink" href="#installing-the-heroku-command-line-interface-cli" title="Permalink to this headline">¶</a></h2>
<p>Heroku is the tool we will use in order to put your application online where others can see it.</p>
<p>First, we need to create an account. Go to <a class="reference external" href="http://heroku.com">Heroku</a> and click the “Sign up” link.</p>
<p><img alt="Heroku step 1" src="_images/heroku-step1.png" /></p>
<p>You will be taken to a form where you need to enter your email address in order to sign up. Fill out that form, and you will be sent an email with a link to click to continue the signup process.</p>
<p><img alt="Heroku step 2" src="_images/heroku-step2.png" /></p>
<p>After clicking on the link, you will be taken to another form where you will need to choose a password. Choose one and enter it twice.</p>
<p><img alt="Heroku step 3" src="_images/heroku-step3.png" /></p>
<p>After all that, you should be at your Heroku dashboard. There will be a link on the dashboard to download the Heroku Command Line Interface. Download it now.</p>
<p><img alt="Heroku dashboard" src="_images/heroku_dashboard_ubuntu.png" /></p>
<p>If you do not see this link on your dashboard, you can download the Heroku Command Line Interface from <a class="reference external" href="https://toolbelt.heroku.com/">toolbelt.heroku.com</a>.</p>
<p>From the “Heroku Command Line” web page you can copy/paste the
command to script to install the Heroku Command Line Interface to
<code class="docutils literal"><span class="pre">/usr/local/heroku</span></code> <em>(as the superuser)</em>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>root@mylaptop# wget -qO- https://toolbelt.heroku.com/install.sh | sh
This script requires superuser access to install software.
You will be prompted for your password by sudo.
Add the Heroku CLI to your PATH using:
$ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile
root@mylaptop#
</pre></div>
</div>
<p><em>NOTE: We already added <code class="docutils literal"><span class="pre">/usr/local/heroku/bin</span></code> to the PATH above</em></p>
<p>You can test that the basic <strong>heroku</strong> command works like this:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>
clojurista@mylaptop$ heroku --version
heroku-toolbelt/3.43.12 (x86_64-linux-gnu) ruby/2.3.1
heroku-cli/5.4.8-eee5ec9 (linux-amd64) go1.7.1
You have no installed plugins.
clojurista@mylaptop$
</pre></div>
</div>
<p>Now you can login to heroku the first time:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>clojurista@mylaptop$ heroku login
Enter your Heroku credentials.
Email: [email protected]
Password (typing will be hidden): ++++++++
Logged in as [email protected]
clojurista@mylaptop$
</pre></div>
</div>
</div>
<div class="section" id="testing-your-setup">
<h2>Testing your setup<a class="headerlink" href="#testing-your-setup" title="Permalink to this headline">¶</a></h2>
<p>You have set up Java, Atom, Leiningen, Git, and Heroku on your computer – all the tools you will need for this course. Before starting, we need to test them out.</p>
<p>Go to your terminal and download a copy of the <a class="reference external" href="https://github.com/heroku/clojure-getting-started">clojure-getting-started</a> repository:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>clojurista@mylaptop$ mkdir -p ~/src/github/heroku
clojurista@mylaptop$ git clone https://github.com/heroku/clojure-getting-started.git
clojurista@mylaptop$ cd clojure-getting-started
clojurista@mylaptop$
</pre></div>
</div>
<p>Now you can start the sample application on your laptop using <strong>lein
repl</strong>. This could take a long time, and will download many other
pieces of code it relies on. You should see lines that start with
<code class="docutils literal"><span class="pre">Retrieving</span> <span class="pre">...</span></code> on your screen.</p>
<p>Below you see the first two Clojure commands start the application. You can then
visit the application webpage on your laptop at
<a class="reference external" href="http://localhost:5000">http://localhost:5000</a>.
Then you can shut down the application and <code class="docutils literal"><span class="pre">(quit)</span></code> with the last
two commmands.</p>
<ol class="simple">
<li><code class="docutils literal"><span class="pre">lein</span> <span class="pre">repl</span></code></li>
<li><code class="docutils literal"><span class="pre">(require</span> <span class="pre">'clojure-getting-started.web)</span></code></li>
<li><code class="docutils literal"><span class="pre">(def</span> <span class="pre">server</span> <span class="pre">(clojure-getting-started.web/-main))</span></code></li>
<li>Now you can open the web page at <a class="reference external" href="http://localhost:5000">http://localhost:5000</a>
<img alt="heroku test page" src="_images/nc41.png" /></li>
<li><code class="docutils literal"><span class="pre">(.stop</span> <span class="pre">server)</span></code></li>
<li><code class="docutils literal"><span class="pre">(quit)</span></code></li>
</ol>
<div class="highlight-none"><div class="highlight"><pre><span></span>clojurista@mylaptop$ lein repl
Retrieving environ/environ.lein/0.3.1/environ.lein-0.3.1.pom from clojars
Retrieving environ/environ.lein/0.3.1/environ.lein-0.3.1.jar from clojars
Warning: cider-nrepl requires Clojure 1.7 or greater.
Warning: cider-nrepl will not be included in your project.
Warning: cider-nrepl requires Clojure 1.7 or greater.
Warning: cider-nrepl will not be included in your project.
Retrieving environ/environ/1.0.0/environ-1.0.0.pom from clojars
Retrieving environ/environ/1.0.0/environ-1.0.0.jar from clojars
nREPL server started on port 42509 on host 127.0.0.1 - nrepl://127.0.0.1:42509
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.6.0
OpenJDK 64-Bit Server VM 1.8.0_111-8u111-b14-2-b14
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (require 'clojure-getting-started.web)
2016-10-28 14:05:21.439:INFO::nREPL-worker-0: Logging initialized @17071ms
nil
user=> (def server (clojure-getting-started.web/-main))
(def server (clojure-getting-started.web/-main))
2016-10-28 14:05:30.163:INFO:oejs.Server:nREPL-worker-0: jetty-9.2.10.v20150310
2016-10-28 14:05:30.203:INFO:oejs.ServerConnector:nREPL-worker-0: Started ServerConnector@379cb9a6{HTTP/1.1}{0.0.0.0:5000}
2016-10-28 14:05:30.204:INFO:oejs.Server:nREPL-worker-0: Started @25837ms
#'user/server
user=> (println "open http://localhost:5000")
open http://localhost:5000
user=> (.stop server)
2016-10-28 14:06:15.811:INFO:oejs.ServerConnector:nREPL-worker-1: Stopped ServerConnector@379cb9a6{HTTP/1.1}{0.0.0.0:5000}
nil
user=> (quit)
Bye for now!
clojurista@mylaptop$
</pre></div>
</div>
<p>Yay! Your first web application works on your laptop!</p>
<p>Now you can push the application to the web via <strong>heroku create</strong>:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>
clojurista@mylaptop$ heroku create
Creating app... done, enigmatic-beyond-54459
https://enigmatic-beyond-54459.herokuapp.com/ | https://git.heroku.com/enigmatic-beyond-54459.git
clojurista@mylaptop$ git push heroku master
Counting objects: 41, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (38/38), done.
Writing objects: 100% (41/41), 6.36 KiB | 0 bytes/s, done.
Total 41 (delta 15), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Clojure (Leiningen 2) app detected
remote: -----> Installing OpenJDK 1.8... done
remote: -----> Installing Leiningen
remote: Downloading: leiningen-2.6.1-standalone.jar
remote: Writing: lein script
remote: -----> Building with Leiningen
remote: Running: lein uberjar
remote: Retrieving environ/environ.lein/0.3.1/environ.lein-0.3.1.pom from clojars
...more output...
remote: -----> Launching...
remote: Released v3
remote: https://enigmatic-beyond-54459.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/enigmatic-beyond-54459.git
* [new branch] master -> master
clojurista@mylaptop$ heroku open
clojurista@mylaptop$
</pre></div>
</div>
<p>Your browser should open (and take a long time to load), and you should see a website like the following:</p>
<p><img alt="Nightcode" src="_images/nc51.png" /></p>
<p>If your browser does not open after running <code class="docutils literal"><span class="pre">heroku</span> <span class="pre">open</span></code>, start a browser and go to the URL displayed after you ran <code class="docutils literal"><span class="pre">heroku</span> <span class="pre">create</span></code>.</p>
<p>Congratulations! That website is running the code you have
uploaded to the Interet!!!
You have made a very simple Clojure app and you are all set up to make more!</p>
<p>You’re ready for the workshop!!!</p>
</div>
<div class="section" id="try-the-koans">
<h2>Try the koans<a class="headerlink" href="#try-the-koans" title="Permalink to this headline">¶</a></h2>
<p>If you’re a track 2 student, try to tackle running the <a class="reference internal" href="koans.html"><span class="doc">koans</span></a>.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="welcome.html" class="btn btn-neutral float-right" title="Welcome to ClojureBridge" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="setup_win10.html" class="btn btn-neutral" title="Windows 10 Setup" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2016 ClojureBridgeMN volunteers.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'November 4-5, 2016',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>