- Intro
- Setup
Vagrantfile
: - Setup ssh config
- Host updates and apt setup
- Install necessary stuff
- Get source code, start building
- Run tests
The following will allow you to setup a Vagrant box that is ready to go for writing tests and/or code in the bitcoin codebase. We assume you have VirtualBox, or some other pre-configured provider for Vagrant.
put the below in some working directory such as $HOME/vagrants/bitcoin
Vagrant.configure("2") do |config|
# change this to your preferred debian flavor
config.vm.box = "ubuntu/trusty64"
# map your source code/project directory here so that it is visible
# in the guest. I like "src", you might use "projects" or "dev".
config.vm.synced_folder "$HOME/src", "/home/vagrant/src"
# if you want to run QT wallet
config.ssh.forward_x11 = true
# This is nice if you are using vagrant for other things to avoid port conflicts.
config.vm.network :forwarded_port, guest: 22, host: 10309, id: 'ssh'
end
Put the following in to (your possibly new) ~/.ssh/config
. Note that you need to edit the path in IdentityFile
Host bitcoin-dev
HostName 127.0.0.1
User vagrant
Port 10309
IdentityFile $HOME/$PATH_TO_VAGRANT/.vagrant/machines/default/virtualbox/private_key
ForwardX11 yes
UserKnownHostsFile /dev/null
LogLevel QUIET
StrictHostKeyChecking no
Test that you can get into your new Vagrant box
cd $HOME/vagrants/bitcoin
vagrant up
ssh bitcoin-dev
All remaning commands are executed on vagrant guest
# On guest
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install \
autoconf \
bash-completion \
build-essential \
emacs \
git \
libboost-all-dev \
libcanberra-gtk-module \
libdb4.8++-dev \
libdb4.8-dev \
libevent-dev \
libprotobuf-dev \
libssl-dev \
libtool \
pkg-config \
protobuf-compiler \
qt5-default \
qttools5-dev-tools \
libqrencode-dev
cd ~/src # or your preferred working directory mapped in Vagrantfile
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout v0.18.0
./autogen.sh
./configure --with-gui --with-qrencode --with-zmq --disable-bip70
make
make check
src/test/test_bitcoin
test/functional/test_runner.py