build bitcoin from source ubuntu

Ubuntu is often recommended as an operating system on which to run Bitcoin Core.Although Bitcoin Core can be installed as a precompiled binary, this method won't work in every case.This guide shows how to compile Bitcoin Core from scratch on a clean Ubuntu 14.04.2 system.The main reason to compile Bitcoin Core yourself is that it ensures you'll always have access to the latest release.For example, the binary Bitcoin Core package for Ubuntu 14.04 32-bit currently fails to install, giving the error message “E: Unable to locate package bitcoin-qt” (the 64-bit version installs without a problem).Compiling and installing from source eliminates the need to rely on precompiled binaries when updating.A secondary reason to compile from source is that it requires less trust.Although the maintainers of the Bitcoin Core binary package do a fine job, binaries are a few steps removed from raw source code.With each step comes to potential for unexpected issues that can't be easily detected.Source code, in contrast, can be inspected before compilation and installation.

Yet another reason to compile from source is to enable custom behavior.For example, the Bitcoin Core GUI and wallet can be disabled if you plan to use the software without those features.The method for installing Bitcoin Core described here requires that you enter text-based commands.The preferred way to do this is through the Terminal application.To access it, click the swirl button in the upper left of the desktop and type “terminal”.Click the leftmost button labeled “Terminal” to launch the application.The Terminal application can alternatively be accessed through the keyboard shortcut Ctrl+Alt+T.Ubuntu uses a package manager to simplify the downloading and installation of software components.Over time, the configuration of these packages becomes outdated.Ensure that your version of Ubuntu has the latest package information with the following command.Enter your login password when prompted.We'll use Git to access the Bitcoin Core source code.In addition to providing the current version of Bitcoin Core, Git gives ready access to all past and future versions.

Next, create a source directory and clone the Bitcoin Core source repository.$ /bitcoin/bitcoin.git After a short time, all files should be ready.To confirm, use the ls command.Bitcoin core requires many software libraries that don't come packaged by default with the Ubuntu distribution.The first one, build-essential, enables software to be compiled from source.
bajada del bitcoinBitcoin Core relies on an old version of the Berkeley Database that is not available as a standard Ubuntu 14.04 package.
bitcoin mining and luckAlthough precompiled binaries can be downloaded, in this guide we'll compile from source.
quora bitcoinBegin by downloading and verifying the BerkeleyDB source package.
bitcoin to litecoin converter

$ /berkeley-db/db-4.8.30.NC.tar.gz$ echo ‘12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz’ | sha256sum -c The last command should return a value of db-4.8.30.NC.tar.gz: OK.Next, unpack the BerkeleyDB source and compile.The remaining dependencies can be installed with a single command.To compile Bitcoin Core, move back into the previously-cloned git repository and checkout the current release tag.
bitcoin silk road saleAt the time of the last update to this article, that version is 0.10.0.
bitcoin conference in austinTags can be listed with the command git tag.For now, ignore the warning about “‘detached HEAD’ state”.Next, configure build, and install the binaries.Under the bitcoin/doc directory is a file called build-unix.md containing more Linux build instructions and options.

Bitcoin Core can now be run from the command line.Running this command should bring up the Bitcoin Core welcome screen.Create a gist now Instantly share code, notes, and snippets.Assuming the username of the Ubuntu user is "theusername".Preparation ----------- ``` sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev sudo apt-get install libboost-all-dev sudo apt-get install libqt5gui5 libqt5core5 libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler sudo apt-get install libqrencode-dev sudo apt-get install libminiupnpc-dev ``` Download bitcoin source code ---------------------------- ``` cd ~ /bitcoin/bitcoin.git ``` Download and compile Berkley DB 4.8 ----------------------------------- ``` cd ~ mkdir bitcoin/db4/ /berkeley-db/db-4.8.30.NC.tar.gz' tar -xzvf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix/ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/home/theusername/bitcoin/db4/ make install ``` Compile Bitcoin with Berkley DB 4.8 ----------------------------------- ``` cd ~/bitcoin/ ./autogen.sh ./configure LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/" make -s -j5 ``` Run Bitcoin Daemon/QT/Client ---------------------------- ``` ./src/bitcoind ./src/bitcoin-qt ./src/bitcoin-cli ``` Please share your experience and provide constructive feedback!

Thanks, --- Kosta Sign up for free to join this conversation on GitHub.Already have an account?Sign in to comment You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Some notes on how to build Bitcoin Core in Unix.(for OpenBSD specific instructions, see build-openbsd.md) Always use absolute paths to configure and compile bitcoin and the dependencies, for example, when specifying the path of the dependency: Here BDB_PREFIX must be an absolute path - it is defined using $(pwd) which ensures the usage of the absolute path.This will build bitcoin-qt as well if the dependencies are met.For the versions used in the release, see release-process.md under Fetch and build inputs.C++ compilers are memory-hungry.It is recommended to have at least 1.5 GB of memory available when compiling Bitcoin Core.On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS: Options when installing required Boost library files: On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the individual boost development packages, so the following can be used to only install necessary parts of boost: sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev If that doesn't work, you can install all boost development packages with: sudo apt-get install libboost-all-dev BerkeleyDB is required for the wallet.

For Ubuntu only: db4.8 packages are available here.You can add the repository and install using the following commands: Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install BerkeleyDB 5.1 or later, which break binary wallet compatibility with the distributed executables which are based on BerkeleyDB 4.8.If you do not care about wallet compatibility, pass --with-incompatible-bdb to configure.See the section "Disable-wallet mode" to build Bitcoin Core without wallet.Optional (see --with-miniupnpc and --enable-upnp-default): ZMQ dependencies (provides ZMQ API 4.x): If you want to build Bitcoin-Qt, make sure that the required packages for Qt development are installed.Either Qt 5 or Qt 4 are necessary to build the GUI.If both Qt 4 and Qt 5 are installed, Qt 5 will be used.Pass --with-gui=qt4 to configure to choose Qt4.To build without GUI pass --without-gui.To build with Qt 5 (recommended) you need the following: Alternatively, to build with Qt 4 you need the following: libqrencode (optional) can be installed with: Once these are installed, they will be found by configure and a bitcoin-qt executable will be built by default.

To build with Qt 5 (recommended) you need the following: libqrencode (optional) can be installed with: The release is built with GCC and then "strip bitcoind" to strip the debug symbols, which reduces the executable size by about 90%.miniupnpc may be used for UPnP port mapping.It can be downloaded from here.UPnP support is compiled in and turned off by default.See the configure options for upnp behavior desired: It is recommended to use Berkeley DB 4.8.If you have to build it yourself: Note: You only need Berkeley DB if the wallet is enabled (see the section Disable-Wallet mode below).If you need to build Boost yourself: To help make your bitcoin installation more secure by making certain attacks impossible to exploit even if a vulnerability is found, binaries are hardened by default.This can be disabled with: Hardening enables the following features: Position Independent Executable Build position independent code to take advantage of Address Space Layout Randomization offered by some kernels.

Attackers who can cause execution of code at an arbitrary memory location are thwarted if they don't know where anything useful is located.The stack and heap are randomly located by default but this allows the code section to be randomly located as well.On an AMD64 processor where a library was not compiled with -fPIC, this will cause an error such as: "relocation R_X86_64_32 against `......'can not be used when making a shared object;" To test that you have built PIE executable, install scanelf, part of paxutils, and use: scanelf -e ./bitcoin The output should contain: Non-executable Stack If the stack is executable then trivial stack based buffer overflow exploits are possible if vulnerable buffers are found.By default, bitcoin should be built with a non-executable stack but if one of the libraries it uses asks for an executable stack or someone makes a mistake and uses a compiler extension which requires an executable stack, it will silently build an executable without the non-executable stack protection.

To verify that the stack is non-executable after compiling use: scanelf -e ./bitcoin the output should contain: STK/REL/PTL RW- R-- RW- The STK RW- means that the stack is readable and writeable but not executable.When the intention is to run only a P2P node without a wallet, bitcoin may be compiled in disable-wallet mode with: In this case there is no dependency on Berkeley DB 4.8.Mining is also possible in disable-wallet mode, but only using the getblocktemplate RPC call not getwork.A list of additional configure flags can be displayed with: This example lists the steps necessary to setup and build a command line only, non-wallet distribution of the latest changes on Arch Linux: Note: Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package db) using --with-incompatible-bdb, or building and depending on a local version of Berkeley DB 4.8.The readily available Arch Linux packages are currently built using --with-incompatible-bdb according to the PKGBUILD.

As mentioned above, when maintaining portability of the wallet between the standard Bitcoin Core distributions and independently built node software is desired, Berkeley DB 4.8 must be used.These steps can be performed on, for example, an Ubuntu VM.The depends system will also work on other Linux distributions, however the commands for installing the toolchain will be different.Make sure you install the build requirements mentioned above.Then, install the toolchain and curl: To build executables for ARM: For further documentation on the depends system see README.md in the depends directory.(Updated as of FreeBSD 11.0) Clang is installed by default as cc compiler, this makes it easier to get started than on OpenBSD.Installing dependencies: You need to use GNU make (gmake) instead of make.(libressl instead of openssl will also work) This will give a warning "configure: WARNING: Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!", but as FreeBSD never had a binary release, this may not matter.