1+ I"b.<p>I like to play around with lots of different programming languages, but install too many and they pollute your working environment, so it’s better to have them installed as a user instead of root.
2+ Here’s a way to get several of them installed into your unix user directory.
3+ If things go wrong, or you get bored you can easily <code class="language-plaintext highlighter-rouge">rm -rf</code> the installation.</p>
4+
5+ <h1 id="initial-install">Initial Install</h1>
6+ <p>Let’s get ourselves a minimal debian environment. I’m using docker here, but you can use a native install, or a VM, or Windows Services for Linux with the ubuntu install.</p>
7+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>john@BigBox:~/git/JohnCSimon.github.io<span class="nv">$ </span> <span class="nb">sudo </span>docker run <span class="nt">-ti</span> debian /bin/bash
8+ Unable to find image <span class="s1">'debian:latest'</span> locally
9+ latest: Pulling from library/debian
10+ cd8eada9c7bb: Pull <span class="nb">complete
11+ </span>Digest: sha256:58a80e0b6aa4d960ee2a5452b0230c406c47ed30a66555ba753c8e1710a434f5
12+ Status: Downloaded newer image <span class="k">for </span>debian:latest
13+ root@6d933dddbbcd:/#
14+ </code></pre></div></div>
15+ <p>Just to satisfy my OCD let’s get the latest updates.</p>
16+
17+ <p><code class="language-plaintext highlighter-rouge">apt update && apt upgrade -y</code></p>
18+
19+ <p><code class="language-plaintext highlighter-rouge">apt install gnupg2 curl procps -y</code>
20+ Installs gpg2, curl and ps</p>
21+
22+ <h1 id="ruby">ruby</h1>
23+ <p><code class="language-plaintext highlighter-rouge">gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB</code></p>
24+
25+ <p><code class="language-plaintext highlighter-rouge">\curl -sSL https://get.rvm.io | bash -s stable</code></p>
26+
27+ <p>To start using RVM you need to run <code class="language-plaintext highlighter-rouge">source /etc/profile.d/rvm.sh</code> or re-login to re-load <code class="language-plaintext highlighter-rouge">~/.profile</code></p>
28+
29+ <p>From here you can run - <code class="language-plaintext highlighter-rouge">rvm list known</code> and you’ll see a list of ruby flavors and individual versions.</p>
30+
31+ <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># MRI Rubies</span>
32+ <span class="o">[</span>ruby-]1.8.6[-p420]
33+ <span class="o">[</span>ruby-]1.8.7[-head] <span class="c"># security released on head</span>
34+ <span class="o">[</span>ruby-]1.9.1[-p431]
35+ <span class="o">[</span>ruby-]1.9.2[-p330]
36+ <span class="o">[</span>ruby-]1.9.3[-p551]
37+ <span class="o">[</span>ruby-]2.0.0[-p648]
38+ <span class="o">[</span>ruby-]2.1[.10]
39+ <span class="o">[</span>ruby-]2.2[.10]
40+ <span class="o">[</span>ruby-]2.3[.8]
41+ <span class="o">[</span>ruby-]2.4[.5]
42+ <span class="o">[</span>ruby-]2.5[.3]
43+ <span class="o">[</span>ruby-]2.6[.0]
44+ </code></pre></div></div>
45+
46+ <p>MRI Ruby is the reference version of Ruby so let’s install the latest version.</p>
47+
48+ <p><code class="language-plaintext highlighter-rouge">rvm install ruby-2.6.0</code></p>
49+
50+ <p>I’m running debian and rvm might ask for your root password to install some prerequsites from apt before compiling a new version.</p>
51+
52+ <p>Congrats, you now have a ruby install</p>
53+
54+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>ruby <span class="nt">-v</span>
55+ ruby 2.6.0p0 <span class="o">(</span>2018-12-25 revision 66547<span class="o">)</span> <span class="o">[</span>x86_64-linux]
56+ </code></pre></div></div>
57+
58+ <p>from here you can now do whatever since I’m blogging this using jekyll</p>
59+
60+ <p><code class="language-plaintext highlighter-rouge">gem install bundler jekyll</code></p>
61+
62+ <h1 id="go">go</h1>
63+ <p>Go is a language that releases new versions on a regular basis.
64+ There’s a similar tool to rvm called gvm. It’s a “go version manager” available from here <code class="language-plaintext highlighter-rouge">https://github.com/moovweb/gvm</code> that’ll let you install multiple versions and set $GOPATH and $GOROOT.</p>
65+
66+ <p>as a regular user:</p>
67+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>bash < <<span class="o">(</span>curl <span class="nt">-s</span> <span class="nt">-S</span> <span class="nt">-L</span> https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer<span class="o">)</span>
68+ Cloning from https://github.com/moovweb/gvm.git to /root/.gvm
69+ No existing Go versions detected
70+ Installed GVM v1.0.22
71+
72+ Please restart your terminal session or to get started right away run
73+ <span class="sb">`</span><span class="nb">source</span> /root/.gvm/scripts/gvm<span class="sb">`</span>
74+ </code></pre></div></div>
75+
76+ <p>you should be able to run and see</p>
77+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>gvm version
78+ Go Version Manager v1.0.22 installed at /home/john/.gvm
79+ </code></pre></div></div>
80+
81+ <p>Run <code class="language-plaintext highlighter-rouge">gvm listall</code>
82+ which will give you a list of all the available versions of go.</p>
83+
84+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$gvm</span> listall
85+
86+ gvm gos <span class="o">(</span>available<span class="o">)</span>
87+
88+ go1
89+ go1.0.1
90+ ...
91+ go1.11rc1
92+ go1.11rc2
93+ go1.11.1
94+ go1.11.2
95+ go1.11.3
96+ go1.11.4
97+ go1.12beta1
98+ go1.12beta2
99+ </code></pre></div></div>
100+ <p>of which there are entirely too many.</p>
101+
102+ <p>From here, we can install go as our user via binary here:</p>
103+
104+ <p><code class="language-plaintext highlighter-rouge">gvm install go1.4 -B</code></p>
105+
106+ <p>try it out</p>
107+ <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>go version
108+ go version go1.4 linux/amd64
109+ </code></pre></div></div>
110+ <p>We can see it gets installed here:</p>
111+ <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">echo</span> <span class="nv">$GOROOT</span>
112+ /home/john/.gvm/gos/go1.4
113+ </code></pre></div></div>
114+
115+ <p>From the gvm link earlier, in order to compile a go build environment for versions 1.5 on we require another go build environment.
116+ Go compiles itself! Neat huh?</p>
117+
118+ <p>As of now the latest version is go1.11.4</p>
119+ <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">export </span><span class="nv">GOROOT_BOOTSTRAP</span><span class="o">=</span><span class="nv">$GOROOT</span>
120+ <span class="nv">$ </span>gvm <span class="nb">install </span>go1.11.4
121+ </code></pre></div></div>
122+
123+ <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>go version
124+ go version go1.4 linux/amd64
125+ </code></pre></div></div>
126+ <p>you can run
127+ <code class="language-plaintext highlighter-rouge">gvm use - select a go version to use (--default to set permanently)</code></p>
128+
129+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>gvm use go1.11.4 <span class="nt">--default</span>
130+ Now using version go1.11.4
131+ <span class="nv">$ </span>go version
132+ go version go1.11.4 linux/amd64
133+ <span class="nv">$ </span><span class="nb">echo</span> <span class="nv">$GOROOT</span>
134+ /home/john/.gvm/gos/go1.11.4
135+ <span class="nv">$ </span><span class="nb">echo</span> <span class="nv">$GOPATH</span>
136+ /home/john/.gvm/pkgsets/go1.11.4/global
137+ <span class="nv">$ </span><span class="nb">ls</span> /home/john/.gvm/gos/go1.11.4
138+ AUTHORS CONTRIBUTING.md CONTRIBUTORS LICENSE PATENTS README.md VERSION api bin doc favicon.ico lib manifest misc pkg robots.txt src <span class="nb">test
139+ ls</span> <span class="nv">$GOPATH</span>
140+ overlay pkg src
141+ </code></pre></div></div>
142+
143+ <p>Be sure to set –default so you keep the same version when you relaunch the shell, so that whatever you install stays where you expect it.</p>
144+
145+ <h1 id="node-js">node js</h1>
146+ <p>node.js, the server side javascript framework</p>
147+
148+ <p>nvm is Node Version Manager. Install it like this:
149+ <code class="language-plaintext highlighter-rouge">curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash</code></p>
150+
151+ <p>Since there are major revisions to the javascript language between node 4, 6, 8 I’ve found I’ve had to switch more often between these versions according to project than I did with other languages.</p>
152+
153+ <p>You can run <code class="language-plaintext highlighter-rouge">nvm ls-remote</code> and get a list of all the node versions available</p>
154+
155+ <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ nvm
156+ Example:
157+ nvm install 8.0.0 Install a specific version number
158+ nvm use 8.0 Use the latest available 8.0.x release
159+ nvm run 6.10.3 app.js Run app.js using node 6.10.3
160+ nvm exec 4.8.3 node app.js Run `node app.js` with the PATH pointing to node 4.8.3
161+ nvm alias default 8.1.0 Set default node version on a shell
162+ nvm alias default node Always default to the latest available node version on a shell
163+ </code></pre></div></div>
164+
165+ <p>so if you run</p>
166+
167+ <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>nvm <span class="nb">install </span>10
168+ Downloading and installing node v10.15.0...
169+ Downloading https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-x64.tar.gz...
170+ <span class="c">######################################################################## 100.0%</span>
171+ Computing checksum with <span class="nb">sha256sum
172+ </span>Checksums matched!
173+ Now using node v10.15.0 <span class="o">(</span>npm v6.4.1<span class="o">)</span>
174+ Creating default <span class="nb">alias</span>: default -> 10 <span class="o">(</span>-> v10.15.0<span class="o">)</span>
175+
176+ <span class="nv">$ </span>whereis node
177+ node: /home/john/.nvm/versions/node/v10.15.0/bin/node
178+ </code></pre></div></div>
179+
180+ <p>and you can set it to be the default so the setting persists between sessions</p>
181+ <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>nvm alias default 10
182+ </code></pre></div></div>
183+
184+ <p>So now you can run:</p>
185+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>node <span class="nt">-v</span>
186+ v10.15.0
187+ <span class="nv">$ </span>npm <span class="nt">-v</span>
188+ 6.4.1
189+ </code></pre></div></div>
190+
191+ <h1 id="rust">rust</h1>
192+ <p>Rust is another language that sees regular updates. You’ll just have to check which is the version for the 2015 and 2018 edition.</p>
193+
194+ <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl https://sh.rustup.rs -sSf | sh
195+
196+
197+
198+ Current installation options:
199+
200+ default host triple: x86_64-unknown-linux-gnu
201+ default toolchain: stable
202+ modify PATH variable: yes
203+
204+ 1) Proceed with installation (default)
205+ 2) Customize installation
206+ 3) Cancel installation
207+ >
208+
209+ select 1
210+
211+ To configure your current shell run source $HOME/.cargo/env
212+ </code></pre></div></div>
213+
214+ <p>add <code class="language-plaintext highlighter-rouge">$HOME/.cargo/env</code> to your path in .bashrc</p>
215+
216+ <div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>whereis cargo
217+ cargo: /home/john/.cargo/bin/cargo
218+ <span class="nv">$ </span>whereis rustc
219+ cargo: /home/john/.cargo/bin/rustc
220+ </code></pre></div></div>
221+
222+ :ET
0 commit comments