Build Tezos from source for alphanet on Debian 9

This explains how to build a Tezos node from source on Debian 9 such that it runs on the alphanet. Building from source is more complicated than just running the docker image but it allows us to easily place the Tezos data in a filesystem that is is tuned for the purpose and makes better use of the available disk space.

At, create a new 1024 Linode instance.

  1. Deploy the Debian 9 image on it allocating 2000 MB.
  2. Create a new disk labeled as “home”, raw/unformatted, using all remaining available space.
  3. Assign that “home” disk to /dev/sdc in the configuration profile.
  4. Boot the linode.

Login to the server and update it.

apt-get update
apt-get upgrade -y

Create the filesystem that will hold the Tezos blockchain and other meta-data. This data comprises many small files so we override ext4 defaults to use small blocks, more inodes, and the minimal inode size.

mkfs.ext4 -b 1024 -i 1024 -I 128 /dev/sdc
mount /dev/sdc /home

Create the user where we will finish the installation and run Tezos:

adduser tezos
adduser tezos sudo
su - tezos

Install the base packages needed:

sudo apt-get install -y patch unzip make gcc m4 git g++

Install the necessary OPAM (Ocaml) tools. (These steps can take five or so minutes apiece):

wget -O - | sh -s /usr/local/bin
opam switch "tezos" --alias-of 4.04.2
eval `opam config env`

Get tezos code:

git clone -b alphanet
cd tezos

Build (takes a long time; there are several user-prompts requiring responses early on):

make build-deps


2017-10-13: Remove unnecessary patch to irmin-unix.

Building Tezos on Ubuntu 14.04

Install opam and ocaml utilities. At this time this results in opam version 1.2.2 and ocaml 4.02.3.

add-apt-repository ppa:avsm/ppa
apt-get update
apt-get install ocaml ocaml-native-compilers camlp4-extra opam

Add repo needed for libsodium-dev (at least) that the Tezos installation scripts will install.

add-apt-repository ppa:ondrej/php
apt-get update

Switch to Ocaml 4.03.0. [update: using 4.04.2 on 2017/09/05]

opam init
opam switch 4.03.0
eval `opam config env`

Clone the tezos source repo to /opt/tezos.

Build dependencies per

cd /opt/tezos
make build-deps

Install additional dependency manually. [update: no longer seems to be needed on 2017/09/05]

opam install irmin.0.11.1

Build Tezos binaries.



Thanks to @arthurb on the Tezos slack and to the folks on the #ocaml IRC list for all the help.

When I ran into trouble and had to start from near scratch, here are the (drastic) steps. (I don’t have other Ocaml projects, yet).

rm -r $HOME/.opam
cd /opt/tezos
git clean -dxf

Then start again at opam init.

Virtue via intelligence

The evils of the world are due to moral defects quite as much as to lack of intelligence. But the human race has not hitherto discovered any method of eradicating moral defects; preaching and exhortation only add hypocrisy to the previous list of vices. Intelligence, on the contrary, is easily improved by methods known to every competent educator. Therefore, until some method of teaching virtue has been discovered, progress will have to be sought by improvement of intelligence rather than of morals.

-Bertrand Russell

The Will to Doubt: Bertrand Russell on Free Thought and Our Only Effective Self-Defense Against Propaganda

Costs of Financial Innovation

In “Golden Eggs and Hyperbolic Discounting”, the author argues that the liquidity brought by modern finance is not a good thing.

By enabling the consumer to instantaneously borrow against illiquid assets, financial innovation eliminates the possibility for partial commitment. This has two effects on the welfare of the current self. First, the current self no longer faces a self-imposed liquidity constraint and can therefore consume more in its period of control. Second, future selves are also no longer liquidity constrained and may also consume at a higher rate out of the wealth stock that they inherit. The first effect makes the current self better off. The second effect makes the current self worse off (since the current self would like to constrain the consumption of future selves).

Golden Eggs and Hyperbolic Discounting, David Laibson, The Quarterly Journal of Economics, Vol. 112, No. 2, In Memory of Amos Tversky (1937-1996) (May, 1997) , pp. 443-477.

Committing to choices

In Resolving to Create a New You Ruth Chang argues that in making choices between alternatives that are on par (have much the same value to us) we should favor the choice that we can most fully commit to.

Instead of being led by the nose by what we imagine to be facts of the world, we should instead recognize that sometimes the world is silent about what we should do. In those cases, we can create value for ourselves by committing to an option. By doing so, we not only create value for ourselves but we also (re)create ourselves.

Memorization and Repetition Still Needed for Learning

I believe in learning for understanding, critical thinking, and inquiry-based learning. But even so, real fluency still requires some drill-and-kill.

The problem with focusing relentlessly on understanding is that math and science students can often grasp essentials of an important idea, but this understanding can quickly slip away without consolidation through practice and repetition. Worse, students often believe they understand something when, in fact, they don’t.

via How I Rewired My Brain to Become Fluent in Math – Issue 17: Big Bangs – Nautilus.

Time after time, professors in mathematics and the sciences have told me that building well-ingrained chunks of expertise through practice and repetition was absolutely vital to their success. Understanding doesn’t build fluency; instead, fluency builds understanding. In fact, I believe that true understanding of a complex subject comes only from fluency.

Managing WordPress via git

I reorganized my self-hosted WordPress system to use git to manage the WordPress code and to move the content outside of the WordPress directory. That way I should be able to do a simple git pull and git checkout $newversion to update my WordPress. I’m also keeping my content directory under change management (separately) so that I can update plugins through the web and be able to roll back.

  • $HOME/blog/wordpress is a git clone of I make no local changes in this. In particular, all of wp-content is unchanged (I make it unwriteable by Apache to be sure).
  • $HOME/blog/content is a copy of the wp-content of my site (prior to moving it outside the wordpress code). It contains the usual: plugins, themes, uploads. It’s all writeable by Apache so that I can update plugins and themes through the web.
  • $HOME/blog/wp-config.php is the usual config file (WordPress looks in the parent directory for it). It’s standard except for two settings:

    define('WP_CONTENT_DIR', '/home/fred/blog/content');  
    define('WP_CONTENT_URL', '');
  • /etc/apache2/conf.d/wordpress.conf defines the VirtualHost for the wordpress site. It has an alias to support special location of the content. (It also has the mod_rewrite rules for permalinks so that I don’t need an .htaccess file in the wordpress code).

    DocumentRoot /home/fred/blog/wordpress
    Alias /content /home/fred/blog/content