Commit 812606d4 authored by GI's avatar GI

Snapshot of 69b9fede

parent 87f942e4
RewriteEngine on
RewriteBase /blog/
# Renamed a few files on the old blog
RewriteRule ^20130929-git-intro\.html$ 20130929-git-quickstart.html
RewriteRule ^20130930-nsf-margins\.html$ 20130930-tex-margins.html
\ No newline at end of file
......@@ -132,7 +132,8 @@ Some of the things you can do are:</p>
<h3 id="compatible-with-dropboxboxetc">Compatible with Dropbox/Box/etc.</h3>
<p>You don&rsquo;t have to abandon your favorite cloud storage (like Dropbox, Box, Google Drive, etc.) to use <code>git</code>.
If you use cloud storage to synchronize files on your computer, you can simply run <code>git</code> inside your &ldquo;cloud folder&rdquo;.
Only caveat: If you run <code>git</code> inside your cloud folder, be sure you only use that folder to synchronize between your own personal computers &ndash; don&rsquo;t ever share this folder with a co-author otherwise there will be trouble.</p>
(Look <a class="wikilink" href="http://localhost:8000/blog/20160406-dropbox-git.html">here</a> for instructions on making <code>git</code> and <code>dropbox</code> work well together.)
Main caveat: If you run <code>git</code> inside your cloud folder, be sure you only use that folder to synchronize between your own personal computers &ndash; don&rsquo;t ever share this folder with a co-author otherwise there will be trouble.</p>
<h2 id="core-concepts">Core Concepts</h2>
<h3 id="setup">Setup</h3>
<ol>
......@@ -143,7 +144,7 @@ Only caveat: If you run <code>git</code> inside your cloud folder, be sure you o
</li>
<li>
<p>Introduce yourself to git. If your GUI client doesn&rsquo;t let you do this directly, open a terminal and type:</p>
<div class="codehilite"><pre><span></span>git config --global user.name &#39;Your Name&#39;
<div class="codehilite"><pre><span></span>git config --global user.name <span class="s1">&#39;Your Name&#39;</span>
git config --global user.email you@math.youruniv.edu
</pre></div>
......@@ -295,8 +296,8 @@ Alternately, you can also use <code>git mergetool</code> to help.</p>
Here&rsquo;s a way to get colorful logs that are a bit easier to read.
Put the following in <code>~/.gitconfig</code>:</p>
<div class="codehilite"><pre><span></span><span class="k">[alias]</span>
<span class="na">lg</span> <span class="o">=</span> <span class="s">log --format=&#39;%w(72,0,8)%C(auto)%h%d %s&#39;</span>
<span class="s"> lga = log --date=short --format=&#39;%w(72,0,8)%C(auto)%h %C(green)%cd \</span>
<span class="na">lg</span> <span class="o">=</span> <span class="s">log --format=&#39;%w(72,0,8)%C(auto)%h%d %s&#39;</span>
<span class="na">lga</span> <span class="o">=</span> <span class="s">log --date=short --format=&#39;%w(72,0,8)%C(auto)%h %C(green)%cd \</span>
<span class="s"> %&lt;(20,trunc)%aN%C(auto)%d%n%w(72,8,8)%s&#39;</span>
</pre></div>
......@@ -355,8 +356,8 @@ The trick to using <code>git</code> in this situation is to find the commit the
</li>
<li>
<p>Install the post-commit hook from <code>git-ident</code>:</p>
<div class="codehilite"><pre><span></span>$ <span class="nb">cd</span> .git/hooks
$ ln -s /path/to/git-ident/post-commit
<div class="codehilite"><pre><span></span><span class="nb">cd</span> .git/hooks
ln -s /path/to/git-ident/post-commit
</pre></div>
......@@ -375,11 +376,11 @@ This will output the <em>commit hash</em> of the file your co-author based his c
If this is what <code>HEAD</code> points to, then he made changes based on your latest version, and you can just save his version over yours and you&rsquo;re good to go.
If not, he made changes based on an earlier version (say <code>ffffff</code>).
To merge it use</p>
<div class="codehilite"><pre><span></span>$ git checkout -b coauthor-v1 ffffff
$ <span class="c1"># Save his file over yours</span>
$ git commit --author <span class="s1">&#39;Co Author &lt;who@doesnt.use.git&gt;&#39;</span>
$ git checkout master
$ git merge coauthor-v1
<div class="codehilite"><pre><span></span>git checkout -b coauthor-v1 ffffff
<span class="c1"># Save his file over yours</span>
git commit --author <span class="s1">&#39;Co Author &lt;who@doesnt.use.git&gt;&#39;</span>
git checkout master
git merge coauthor-v1
</pre></div>
......@@ -511,7 +512,7 @@ Here are links to more information:</p>
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -155,7 +155,7 @@ Usually pages are written in <a href="http://fletcherpenney.net/multimarkdown/">
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -183,7 +183,7 @@ $$
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -314,7 +314,7 @@ Now on pages you want to use MathJAX use the <a href="http://ikiwiki.info/plugin
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -230,7 +230,7 @@ discussion: 0
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -193,7 +193,7 @@ e + 1 &= f + g.
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -311,7 +311,7 @@ a&=b\cr
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -309,7 +309,7 @@ Adjust the parameters <code>\normalFontSize</code> and <code>\fontSizeIncrement<
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -72,12 +72,19 @@
</li>
<li>
<p>In <code>/etc/apache2/sites-available/wp</code>, make sure the Alias</p>
<div class="codehilite"><pre><span></span>Alias /wp/wp-content /var/lib/wordpress/wp-content
<div class="codehilite"><pre><span></span><span class="nb">Alias</span> <span class="sx">/wp/wp-content</span> <span class="sx">/var/lib/wordpress/wp-content</span>
</pre></div>
<p>comes before</p>
<div class="codehilite"><pre><span></span>Alias /wp /usr/share/wordpress
<div class="codehilite"><pre><span></span><span class="nb">Alias</span> <span class="sx">/wp</span> <span class="sx">/usr/share/wordpress</span>
</pre></div>
</li>
<li>
<p>In <code>/etc/wordpress/config-SITENAME.php</code> add</p>
<div class="codehilite"><pre><span></span><span class="x">define(&#39;FORCE_SSL_ADMIN&#39;, true);</span>
</pre></div>
......@@ -87,8 +94,8 @@
</li>
<li>
<p>If you trust users and want to increase the file upload size, add this to <code>/etc/wordpress/htaccess</code>:</p>
<div class="codehilite"><pre><span></span>php_value upload_max_filesize 20M
php_value post_max_size 40M
<div class="codehilite"><pre><span></span><span class="nb">php_value</span> upload_max_filesize <span class="m">20</span>M
<span class="nb">php_value</span> post_max_size <span class="m">40</span>M
</pre></div>
......@@ -98,33 +105,10 @@ php_value post_max_size 40M
<dl>
<dt><a href="http://www.johnkolbert.com/portfolio/wp-plugins/absolute-privacy">Absolute Privacy</a></dt>
<dd>Moderated user registrations, and only logged in users can access content.</dd>
<dt><a href="http://wordpress.org/plugins/responsive-lightbox/">Responsive Lightbox</a></dt>
<dd>Simple javascript image slideshows.
<strong>WARNING:</strong> Stay away from the <a href="http://wordpress.org/extend/plugins/wp-handy-lightbox/">handy lightbox</a> plugin.
It <a href="http://wordpress.org/support/view/plugin-reviews/wp-handy-lightbox">spies on you</a>.
However, it is nicer than <a href="http://wordpress.org/plugins/responsive-lightbox/">Responsive Lightbox</a>, so I commented out the &ldquo;spyware&rdquo; parts of the code.
Get it <a href="http://wiki.math.cmu.edu/gitweb-pub/?p=handy-lightbox.git">here</a>.</dd>
<dt><a href="http://www.theblog.ca/wplogin-redirect">Peter&rsquo;s Login Redirect</a></dt>
<dd>Fix brain malfunction with WordPress design.
Redirect users (esp. subscribers) to the blog after login, and not the admin page!</dd>
<dt><a href="https://github.com/WPsites/Resize-images-before-upload">Resize images before upload</a></dt>
<dd>Have your browser resize images before uploading.
Reduces server load, upload times etc.
Why isn&rsquo;t this a feature?</dd>
<dt><a href="http://mvied.com/projects/wordpress-https/">WordPress HTTPS</a></dt>
<dd>I wanted the login form use SSL, and everything else use HTTP.
I couldn&rsquo;t make this work, unfortunately.
However, I finally made got it to do all admin URL&rsquo;s https, and everything else http.
Here&rsquo;s what I did:</dd>
</dl>
<ol>
<li>
<p>In the HTTPS settings page, select <em>Force SSL Administration</em> and <em>Force SSL Exclusively</em>.</p>
</li>
<li>
<p>This should be enough, in theory. But I used <a href="http://www.theblog.ca/wplogin-redirect">Peter&rsquo;s Login Redirect</a> to ensure that users are redirected to the appropriate <code>http</code> (and not <code>https</code>) after logging in or logging out.</p>
</li>
</ol>
<h2 id="theme">Theme</h2>
<p>I couldn&rsquo;t care less about colors or fancy images.
But I <strong>WANTED</strong> the main text to be more than 10 pixels wide, and the default blog text to be in a large font.
......@@ -165,7 +149,7 @@ Additionally, to get rid of the social icons (which are pretty useless for a pri
<p>Enable the theme&rsquo;s retina support (or you won&rsquo;t be able to edit images).</p>
</li>
<li>
<p>Disable the theme&rsquo;s lightbox effects if you&rsquo;re using the a different lightbox plugin.</p>
<p>Disable the theme&rsquo;s lightbox effects if you&rsquo;re using the different lightbox plugin.</p>
</li>
</ul>
<br />
......@@ -277,7 +261,7 @@ Additionally, to get rid of the social icons (which are pretty useless for a pri
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -235,7 +235,7 @@ So far this seems to work fine with <code>iceweasel-24.6.0esr-1~deb7u1</code>.
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -94,11 +94,11 @@ For</span><span style="color:green;">for</span> $x = (q,\xi) \in \CM$, <span sty
<p>Here&rsquo;s how to achieve the above.
Edit <code>~/.gitconfig</code> and add the following:</p>
<div class="codehilite"><pre><span></span><span class="k">[alias]</span>
<span class="na">wdiff</span> <span class="o">=</span> <span class="s">diff --color-words --ignore-all-space</span>
<span class="s"> ldiff = difftool -y -t latex</span>
<span class="na">wdiff</span> <span class="o">=</span> <span class="s">diff --color-words --ignore-all-space</span>
<span class="na">ldiff</span> <span class="o">=</span> <span class="s">difftool -y -t latex</span>
<span class="k">[difftool.latex]</span>
<span class="na">cmd</span> <span class="o">=</span> <span class="s">latexdiff &quot;$LOCAL&quot; &quot;$REMOTE&quot;</span>
<span class="na">cmd</span> <span class="o">=</span> <span class="s">latexdiff &quot;$LOCAL&quot; &quot;$REMOTE&quot;</span>
</pre></div>
......@@ -117,11 +117,11 @@ It also will be problematic if more than one tex file has changed.
If the files are all independent, then you can solve both these problems easily.
Put the following in <code>~/.gitconfig</code>:</p>
<div class="codehilite"><pre><span></span><span class="k">[alias]</span>
<span class="na">wdiff</span> <span class="o">=</span> <span class="s">diff --color-words --ignore-all-space</span>
<span class="s"> ldiff = difftool -y -t latex</span>
<span class="na">wdiff</span> <span class="o">=</span> <span class="s">diff --color-words --ignore-all-space</span>
<span class="na">ldiff</span> <span class="o">=</span> <span class="s">difftool -y -t latex</span>
<span class="k">[difftool.latex]</span>
<span class="na">cmd</span> <span class="o">=</span> <span class="s">ldiff &quot;$LOCAL&quot; &quot;$REMOTE&quot; &quot;$MERGED&quot;</span>
<span class="na">cmd</span> <span class="o">=</span> <span class="s">ldiff &quot;$LOCAL&quot; &quot;$REMOTE&quot; &quot;$MERGED&quot;</span>
</pre></div>
......@@ -241,7 +241,7 @@ There&rsquo;s also a useful discussion on <a href="http://tex.stackexchange.com/
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -294,7 +294,7 @@ When you&rsquo;re done, close the terminal window with the ssh connection.</p>
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -72,15 +72,14 @@ This caused my host machine CPU usage to rise to 40%!</p>
I switched my networking setup to <code>macvtap</code>, and got a <strong>huge performance improvement</strong>.
The 3Mbps of traffic barely puts a dent on my CPU usage.</p>
<h2 id="macvtap-setup">macvtap Setup</h2>
<p>Open <code>virt-manager</code> and set the following:</p>
<div class="codehilite"><pre><span></span>Add Hardware --&gt; Network
Host device ethXX : macvtap
Device Model: virtio
Source Mode: VEPA
</pre></div>
<p>Here <code>ethXX</code> is your host machines outgoing interface.</p>
<p>Run <code>virt-manager</code> and do the following:</p>
<ul>
<li>Select <em>Add Hardware</em> / <em>Network</em>.</li>
<li>Set <em>Network source</em> to <em>Host device ethXX : macvtap</em>.
(Here <code>ethXX</code> is your host machines outgoing interface.)</li>
<li>Set <em>Source Mode</em> to <em>VEPA</em></li>
<li>Set <em>Device Model</em> to <em>virtio</em>.</li>
</ul>
<h2 id="communication-with-the-host-machine">Communication with the host machine.</h2>
<p>The only caveat with <code>VEPA</code> is that your host machine <strong>CAN NOT</strong> communicate to the guest machine over this interface (unless you have some special <em>hair pin</em> switch.)
I worked around this by creating a second <code>NAT</code> interface for the guest, and assigning static IP&rsquo;s as follows:</p>
......@@ -96,7 +95,7 @@ I worked around this by creating a second <code>NAT</code> interface for the gue
<p>Run <code>virsh net-edit default</code>.
It will pop up an XML file with basic network configuration.
Find the <code>&lt;dhcp&gt;</code> section, and below the <code>&lt;range start... /&gt;</code> line add the line</p>
<div class="codehilite"><pre><span></span>&lt;host mac=&#39;guestmac&#39; name=&#39;guestname&#39; ip=&#39;192.168.122.2&#39; /&gt;
<div class="codehilite"><pre><span></span><span class="nt">&lt;host</span> <span class="na">mac=</span><span class="s">&#39;guestmac&#39;</span> <span class="na">name=</span><span class="s">&#39;guestname&#39;</span> <span class="na">ip=</span><span class="s">&#39;192.168.122.2&#39;</span> <span class="nt">/&gt;</span>
</pre></div>
......@@ -114,6 +113,21 @@ I worked around this by creating a second <code>NAT</code> interface for the gue
</pre></div>
</li>
<li>
<p>Make sure that the private network doesn&rsquo;t get used for internet access.
(If it does, your VM will be able to access the internet, but will <strong>not</strong> be reachable from the internet.)
Let&rsquo;s assume your public (macvtap) interface is called <code>eth0</code>, and the private (NAT) interface is called <code>eth1</code>.
Edit <code>/etc/dhcp/dhclient.conf</code> and add the following at the end:</p>
<div class="codehilite"><pre><span></span><span class="c1"># eth1 is only for communication with VM host, so don&#39;t request routers, etc.</span>
interface <span class="s2">&quot;eth1&quot;</span> <span class="o">{</span>
request subnet-mask, broadcast-address, time-offset, host-name,
interface-mtu, rfc3442-classless-static-routes<span class="p">;</span>
<span class="o">}</span>
</pre></div>
<p>When your interfaces come up type <code>ip route show</code> and confirm that your default route uses <code>eth0</code> and not <code>eth1</code>.</p>
</li>
</ol>
<p>Now you should have transparent host/guest access on all machines.
......@@ -123,45 +137,6 @@ I worked around this by creating a second <code>NAT</code> interface for the gue
<span class='glyphicon glyphicon-comment' aria-hidden='true'></span>&emsp;Comments
</h3>
<ul class='list-unstyled comments'>
<li>
<div class='media small'>
<div class='media-left'>
<img class='media-object img-rounded hidden-xs'
src='http://cdn.libravatar.org/avatar/1d9eff8253e59f5c7c243a8c558e4f98c0b2d3df3533dc05a5da7adffc798be2'
alt='GI'>
</div>
<div class='media-body'>
<h4 class='media-heading'>
Network unreachable after upgrade to qemu-1.1.2+dfsg-6a+deb7u2
<br />
<small>GI (2014-05-03 15:49:47)</small>
</h4>
<p>After upgrading on 2014-05-02 and rebooting my system my precious <code>macvtap</code> was unreachable.
On my host I could see the interface, but was unable to send or receive anything on it.
I realized that after an upgrade of QEmu (not libvirt!) on the host, my host interface <code>eth1</code> wasn&rsquo;t being put in promiscuous mode.
A temporary fix is to run</p>
<div class="codehilite"><pre><span></span>ifconfig eth1 promisc
</pre></div>
<p>after which everything should work.</p>
<p>For a permanent solution, put the following in <code>/etc/network/interfaces</code>:</p>
<div class="codehilite"><pre><span></span>iface eth1 inet dhcp
up ifconfig <span class="nv">$IFACE</span> promisc
<span class="c1"># Your custom network commands</span>
<span class="c1"># ...</span>
down ifconfig <span class="nv">$IFACE</span> -promisc
</pre></div>
<p>Hopefully this bug should go away soon.</p>
</div>
</div>
</li>
</ul>
<br />
<ul class='list-unstyled comments'>
<li>
<div class='media small'>
......@@ -321,7 +296,7 @@ Blogger @</p>
<form role='form' method='post'
action='javascript:submit_comment()'>
<input type='hidden' name='page' value='20140303-kvm-macvtap.md'>
<input type='hidden' name='comment-number' value='8'>
<input type='hidden' name='comment-number' value='7'>
<div class="col-md-6 form-group">
<label class="sr-only" for="name">Name</label>
<input type="text" class="form-control" name="name" placeholder="Name (optional)">
......@@ -387,7 +362,7 @@ Blogger @</p>
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -163,7 +163,7 @@
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -299,7 +299,7 @@ Arjun</p>
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -177,7 +177,7 @@ ealias <span class="nv">gp</span><span class="o">=</span><span class="s1">&#39;g
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -172,7 +172,7 @@ See an alternate approach <a href="http://dcwww.camd.dtu.dk/~schiotz/comp/LatexT
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -180,7 +180,7 @@ tlmgr: package repository ftp://tug.org/historic/systems/texlive/2013/tlnet-fina
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -75,20 +75,20 @@ Here&rsquo;s what I did to set it up:</p>
<ol>
<li>
<p>Add <code>testing</code> or <code>wheezy-backports</code> to your <code>sources.list</code>, and then run (as root)</p>
<div class="codehilite"><pre><span></span>root&gt; aptitude install -t testing debootstrap
root&gt; mkdir -p /srv/chroot/testing
root&gt; debootstrap testing /srv/chroot/testing http://http.debian.net/debian
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> aptitude install -t testing debootstrap
<span class="gp">[root]#</span> mkdir -p /srv/chroot/testing
<span class="gp">[root]#</span> debootstrap testing /srv/chroot/testing http://http.debian.net/debian
</pre></div>
</li>
<li>
<p>Stop services in the <code>chroot</code> from starting:</p>
<div class="codehilite"><pre><span></span>root&gt; cat &gt; /srv/chroot/testing/usr/sbin/policy-rc.d &lt;&lt;EOF
root&gt; #!/bin/sh
root&gt; exit 101
root&gt; EOF
root&gt; chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> cat &gt; /srv/chroot/testing/usr/sbin/policy-rc.d <span class="s">&lt;&lt;EOF</span>
<span class="gp">&gt;</span><span class="s"> #!/bin/sh</span>
<span class="gp">&gt;</span><span class="s"> exit 101</span>
<span class="gp">&gt;</span><span class="s"> EOF</span>
<span class="gp">[root]#</span> chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
</pre></div>
......@@ -100,7 +100,7 @@ root&gt; chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
<ol>
<li>
<p>Install <code>schroot</code></p>
<div class="codehilite"><pre><span></span>root&gt; aptitude install schroot
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> aptitude install schroot
</pre></div>
......@@ -149,7 +149,7 @@ root&gt; chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
<ol>
<li>
<p>Switch to the new chroot (testing-minimal as root)</p>
<div class="codehilite"><pre><span></span>root&gt; schroot -c testing-minimal
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> schroot -c testing-minimal
</pre></div>
......@@ -158,15 +158,15 @@ root&gt; chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
</li>
<li>
<p>Replace <code>ischroot</code> with <code>/bin/true</code></p>
<div class="codehilite"><pre><span></span>[chroot]root&gt; dpkg-divert --divert /usr/bin/ischroot.debianutils --rename /usr/bin/ischroot
[chroot]root&gt; ln -s /bin/true /usr/bin/ischroot
<div class="codehilite"><pre><span></span><span class="gp">[root@chroot]#</span> dpkg-divert --divert /usr/bin/ischroot.debianutils --rename /usr/bin/ischroot
<span class="gp">[root@chroot]#</span> ln -s /bin/true /usr/bin/ischroot
</pre></div>
</li>
<li>
<p>Install a complete desktop environment:</p>
<div class="codehilite"><pre><span></span>[chroot]root&gt; aptitude install task-kde-desktop
<div class="codehilite"><pre><span></span><span class="gp">[root@chroot]#</span> aptitude install task-kde-desktop
</pre></div>
......@@ -177,7 +177,7 @@ root&gt; chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
</li>
<li>
<p>If you&rsquo;re a power shell user and want to see it in your prompt, then put the line</p>
<div class="codehilite"><pre><span></span>ischroot &amp;&amp; PS1=$&#39;%{\e[36m%}[chroot]%{\e[m%}&#39;$PS1
<div class="codehilite"><pre><span></span>ischroot <span class="o">&amp;&amp;</span> <span class="nv">PS1</span><span class="o">=</span><span class="s1">$&#39;%{\e[36m%}[chroot]%{\e[m%}&#39;</span><span class="nv">$PS1</span>
</pre></div>
......@@ -190,25 +190,25 @@ root&gt; chmod a+x /srv/chroot/testing/usr/sbin/policy-rc.d
If you&rsquo;re having trouble with sound, you might have to temporarily stop
pulseaudio on the host machine. Namely, try playing an audio file in the
<code>chroot</code>:</p>
<div class="codehilite"><pre><span></span>gautam&gt; schroot -c testing-desktop
[chroot]gautam&gt; paplay etc/beep.wav
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
<div class="codehilite"><pre><span></span><span class="gp">[gautam]$</span> schroot -c testing-desktop
<span class="gp">[gautam@chroot]$</span> paplay etc/beep.wav
<span class="go">Connection failure: Connection refused</span>
<span class="go">pa_context_connect() failed: Connection refused</span>
</pre></div>
<p>If that&rsquo;s the error message you see, then run this as a regular user</p>
<div class="codehilite"><pre><span></span>gautam&gt; pulseaudio --kill
gautam&gt; schroot -c testing-desktop
[chroot]gautam&gt; paplay etc/beep.way
<div class="codehilite"><pre><span></span><span class="gp">[gautam]$</span> pulseaudio --kill
<span class="gp">[gautam]$</span> schroot -c testing-desktop
<span class="gp">[gautam@chroot]$</span> paplay etc/beep.way
</pre></div>
<p>(Give any legal wave file to the last command of course.)</p>
<p>Note, now you <strong>won&rsquo;t</strong> have audio in the host system, but will in the <code>chroot</code>.
When you&rsquo;re done with your audio, either close the chroot session, or run the following</p>
<div class="codehilite"><pre><span></span>[chroot]gautam&gt; pulseaudio --kill
gautam&gt; paplay etc/beep.way
<div class="codehilite"><pre><span></span><span class="gp">[gautam@chroot]$</span> pulseaudio --kill
<span class="gp">[gautam]$</span> paplay etc/beep.way
</pre></div>
......@@ -216,32 +216,32 @@ gautam&gt; paplay etc/beep.way
<li>
<p><strong>Get graphics acceleration.</strong>
For this you might have to upgrade your kernel on the host, and consequently all packages with kernel modules.</p>
<div class="codehilite"><pre><span></span>root&gt; aptitude search &#39;~i-dkms&#39;
i broadcom-sta-dkms
i openafs-modules-dkms
i A virtualbox-dkms
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> aptitude search <span class="s1">&#39;~i-dkms&#39;</span>
<span class="go">i broadcom-sta-dkms</span>
<span class="go">i openafs-modules-dkms</span>
<span class="go">i A virtualbox-dkms</span>
</pre></div>
<p>I couldn&rsquo;t find <code>broadcom-sta-dkms</code> in backports, but <code>openafs</code> and <code>virtualbox</code> were available.
I upgraded those first, and then the kernel.</p>
<div class="codehilite"><pre><span></span>root&gt; aptitude -t wheezy-backports install openafs-client virtualbox
root&gt; aptitude -t wheezy-backports install linux-image-amd64 linux-headers-amd64
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> aptitude -t wheezy-backports install openafs-client virtualbox
<span class="gp">[root]#</span> aptitude -t wheezy-backports install linux-image-amd64 linux-headers-amd64
</pre></div>
<p>Now reboot into the new kernel, and test graphics acceleration:</p>
<div class="codehilite"><pre><span></span>root&gt; reboot
...
gautam&gt; uname -srv
Linux 3.14-0.bpo.1-amd64 #1 SMP Debian 3.14.12-1~bpo70+1 (2014-07-13)
<div class="codehilite"><pre><span></span><span class="gp">[root]#</span> reboot
<span class="go">...</span>
<span class="gp">[gautam]$</span> uname -srv
<span class="go">Linux 3.14-0.bpo.1-amd64 #1 SMP Debian 3.14.12-1~bpo70+1 (2014-07-13)</span>
gautam&gt; glxinfo | grep rendering
direct rendering: Yes
<span class="gp">[gautam]$</span> glxinfo <span class="p">|</span> grep rendering
<span class="go">direct rendering: Yes</span>
gautam&gt; schroot -c testing-desktop
[schroot]gautam&gt; glxinfo | grep rendering
direct rendering: Yes
<span class="gp">[gautam]$</span> schroot -c testing-desktop
<span class="gp">[gautam@chroot]$</span> glxinfo <span class="p">|</span> grep rendering
<span class="go">direct rendering: Yes</span>
</pre></div>
......@@ -251,13 +251,13 @@ direct rendering: Yes
Of course you can run a variety of things in your new <code>chroot</code>.
I use it very often to run <code>python3-matplotlib</code> (for plotting my scientific computations and numerical simulations).
To get a shell run (as a regular user)</p>
<div class="codehilite"><pre><span></span>schroot -c testing-desktop
<div class="codehilite"><pre><span></span><span class="gp">[gautam]$</span> schroot -c testing-desktop
</pre></div>
<p>following which you can run whatever you want.
Alternately, you can also start a terminal:</p>
<div class="codehilite"><pre><span></span>schroot -c testing-desktop -- mrxvt
<div class="codehilite"><pre><span></span><span class="gp">[gautam]$</span> schroot -c testing-desktop -- mrxvt
</pre></div>
......@@ -271,7 +271,7 @@ direct rendering: Yes
</li>
<li>
<p>Install it:</p>
<div class="codehilite"><pre><span></span>[chroot]root&gt; dpkg -i /tmp/viber.deb
<div class="codehilite"><pre><span></span><span class="gp">[root@chroot]#</span> dpkg -i /tmp/viber.deb
</pre></div>
......@@ -281,7 +281,7 @@ direct rendering: Yes
</li>
<li>
<p>Run it <em>as a regular user</em>. <strong>Don&rsquo;t run the next command as root.</strong></p>
<div class="codehilite"><pre><span></span>gautam&gt; schroot -c testing-desktop -- /usr/share/viber/Viber.sh
<div class="codehilite"><pre><span></span><span class="gp">[gautam]$</span> schroot -c testing-desktop -- /usr/share/viber/Viber.sh
</pre></div>
......@@ -403,7 +403,7 @@ As of 2014-08-09 Netflix works perfectly with <code>iceweasel-30.0-2</code>.</p>
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -330,7 +330,7 @@ git clone git://wiki.math.cmu.edu/pub/ikiwiki-setup.git
(2017-11-14)
</li>
<li class='hide-xoverflow'>
<a href='http://localhost:8000/blog/20171021-setup.html'>Source Code and Setup Instructions for this site.</a>
<a href='http://localhost:8000/blog/20171021-setup.html'>Static Jinja2 Site Generator</a>
(2017-10-21)
</li>
<li class='hide-xoverflow'>
......
......@@ -111,10 +111,10 @@ It&rsquo;s just which interface you prefer using. </p>
<ol>
<li>
<p>Install an FTP server on your Android device.
There are many available: I use <a href="https://play.google.com/store/apps/details?id=com.theolivetree.ftpserver">FTP Server</a>.</p>
There are many free ones available.</p>
</li>
<li>
<p>Open <a href="https://play.google.com/store/apps/details?id=com.theolivetree.ftpserver">FTP Server</a> go to <em>Settings</em> and set <em>Network Interface</em> to <em>all</em>.</p>
<p>If your FTP server app allows you to choose the network interface, set it to the USB network adapter.</p>
</li>
<li>
<p><strong>Change the default port, username, password, and DISABLE anonymous logins.</strong></p>
......@@ -129,7 +129,7 @@ It&rsquo;s just which interface you prefer using. </p>
</li>
<li>
<p><strong>Important:</strong> You&rsquo;re going to see multiple IP addresses for the server.
<p><strong>Important:</strong> You might see multiple IP addresses for the server.
Be sure to connect to the one corresponding to the USB network.
You can figure this out by finding out the IP address of <code>usb0</code> on your PC.
FTP is completely insecure.
......@@ -168,12 +168,12 @@ Here are instructions for the paranoid that will work on Debian (and should also
</li>
<li>
<p>Make <code>/etc/pam.d/vsftpd</code> look like the following:</p>
<div class="codehilite"><pre><span></span># Standard behaviour for ftpd(8).
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
<div class="codehilite"><pre><span></span><span class="c1"># Standard behaviour for ftpd(8).</span>
auth required pam_listfile.so <span class="nv">item</span><span class="o">=</span>user <span class="nv">sense</span><span class="o">=</span>deny <span class="nv">file</span><span class="o">=</span>/etc/ftpusers <span class="nv">onerr</span><span class="o">=</span>succeed
# Note: vsftpd handles anonymous logins on its own. Do not enable pam_ftp.so.
<span class="c1"># Note: vsftpd handles anonymous logins on its own. Do not enable pam_ftp.so.</span>
# Customized login using htpasswd file
<span class="c1"># Customized login using htpasswd file</span>
auth required pam_pwdfile.so pwdfile /etc/vsftpd.passwd flock
@include common-account
@include common-session
......@@ -184,17 +184,17 @@ auth required pam_pwdfile.so pwdfile /etc/vsftpd.passwd flock
<li>
<p>You need to put a username and password-hash in <code>/etc/vsftpd.passwd</code>.
To find the password hash, run:</p>
<div class="codehilite"><pre><span></span><span class="nt">root</span><span class="o">&gt;</span> <span class="nt">perl</span> <span class="nt">-e</span> <span class="s1">&#39;$salt=q($1$).int(rand(1e8)); print &quot;password: &quot;;</span>
<