a guest Jul 21st, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Using gitian to create multi-OS, multi-arch builds of bitcoin-like blockchains
  3. ## Warning
  4. This steps in this guide will leave your machine highly insecure. Hence, the guide should be used on a temporary VPS not an actual machine/server.
  6. ## Setting up Ubuntu for gitian building
  8. In this section we will be setting up the Ubuntu installation for Gitian building.
  10. First we need to log in as `root` to set up dependencies and make sure that our
  11. user can use the sudo command. Type/paste the following in the terminal:
  13. ```bash
  14. apt-get install make git ruby sudo apt-cacher-ng qemu-utils debootstrap lxc python-cheetah parted kpartx bridge-utils python-vm-builder
  15. adduser builder sudo
  16. ```
  18. When you get a colorful screen with a question about the 'LXC directory', just
  19. go with the default (`/var/lib/lxc`).
  21. Then set up LXC and the rest with the following, which is a complex jumble of settings and workarounds:
  23. ```bash
  24. # lxc-start in Ubuntu needs to run as root, so make sure
  25. # that the build script can exectute it without providing a password
  26. echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/builder
  28. # also add the following line if you want to run the
  29. # script in the background using nohup.
  30. # Note: it will give 'builder' a __password-less sudo__ capability
  31. builder ALL=(ALL) NOPASSWD: ALL
  33. # add cgroup for LXC
  34. echo "cgroup  /sys/fs/cgroup  cgroup  defaults  0   0" >> /etc/fstab
  36. # make /etc/rc.local script that sets up bridge between guest and host
  37. echo '#!/bin/sh -e' > /etc/rc.local
  38. echo 'brctl addbr br0' >> /etc/rc.local
  39. echo 'ifconfig br0 up' >> /etc/rc.local
  40. echo 'exit 0' >> /etc/rc.local
  42. # make sure that USE_LXC is always set when logging in as gitian,
  43. # and configure LXC IP addresses
  44. echo 'export USE_LXC=1' >> /home/gitian/.profile
  45. echo 'export GITIAN_HOST_IP=' >> /home/gitian/.profile
  46. echo 'export LXC_GUEST_IP=' >> /home/gitian/.profile
  47. reboot
  48. ```
  50. At the end the VM is rebooted to make sure that the changes take effect. The steps in this
  51. section need only to be performed once.
  53. ## Running the gitian python script.
  55. Re-login as the user `builder` that was created during installation. The rest of the steps in this guide will be performed as that user.
  57. If you don't have one, create a GPG key. The script will stop if it doesn't find a key in your keychain.
  58. ```bash
  59. gpg --gen-key
  60. ```
  61. Copy the `` script from your blockchain's `/contrib/' directory to `builder`'s home directory. Then, run
  63. ```bash
  64. ./ --setup "GPG Key Name" "1.0.0"
  65. ```
  67. If you don't pass `--commit` (completely unrelated to the option --no-commit), the script will assume the version to be a tag and automaticall prepend `v` to it.
  69. Create the dir `inputs` inside `gitian-builder`  and copy `MacOSX10.11.sdk.tar.gz` to it. (See ``)
  72. ```bash
  73. ./ --build --jobs $(nproc) --os lwm --no-commit "GPG Key Name" "1.0.0"
  74. ```
  76. The building phase of the gitian job is going to take an extremely long time because, by default binaries for the following architectures are built: "i686-pc-linux-gnu x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu riscv64-linux-gnu". AFAIK, the only way to change this is remove hosts(archs) directly from the .yml file.
  78. You can use nohup if you enabled password-less sudo in the previous step.
  80. ## Lastly
  82. Once the build is over, you should find all the packaged binaries in $HOME/blockchain-binaries/1.0.0/ diretory. scp that directory over to your machine and **delete the VPS**
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand