xref: /spdk/doc/getting_started.md (revision 2d18887fbd6fe5727abbdaa0a17b37d51238f6e3)
1# Getting Started {#getting_started}
2
3# Installing Prerequisites {#getting_started_prerequisites}
4
5Fedora/CentOS:
6
7~~~{.sh}
8sudo dnf install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \
9	git astyle-devel python-pep8 lcov python clang-analyzer
10# Additional dependencies for RDMA (NVMe over Fabrics)
11sudo dnf install -y libibverbs-devel librdmacm-devel
12# Additional dependencies for building docs
13sudo dnf install -y doxygen mscgen
14~~~
15
16Ubuntu/Debian:
17
18~~~{.sh}
19sudo apt-get install -y gcc g++ make libcunit1-dev libaio-dev libssl-dev \
20	git astyle pep8 lcov clang
21# Additional dependencies for RDMA (NVMe over Fabrics)
22sudo apt-get install -y libibverbs-dev librdmacm
23# Additional dependencies for building docs
24sudo apt-get install -y doxygen mscgen
25~~~
26
27FreeBSD:
28
29~~~{.sh}
30sudo pkg install gmake cunit openssl git devel/astyle bash devel/pep8 \
31	python
32# Additional dependencies for building docs
33sudo pkg install doxygen mscgen
34~~~
35
36# Getting the Source Code {#getting_started_source}
37
38~~~{.sh}
39git clone https://github.com/spdk/spdk
40cd spdk
41git submodule update --init
42~~~
43
44# Building {#getting_started_building}
45
46Linux:
47
48~~~{.sh}
49./configure
50make
51~~~
52
53FreeBSD:
54Note: Make sure you have the matching kernel source in /usr/src/
55
56~~~{.sh}
57./configure
58gmake
59~~~
60
61There are a number of options available for the configure script, which can
62be viewed by running
63
64~~~{.sh}
65./configure --help
66~~~
67
68Note that not all features are enabled by default. For example, RDMA
69support (and hence NVMe over Fabrics) is not enabled by default. You
70can enable it by doing the following:
71
72~~~{.sh}
73./configure --with-rdma
74make
75~~~
76
77# Running the Unit Tests {#getting_started_unittests}
78
79It's always a good idea to confirm your build worked by running the
80unit tests.
81
82~~~{.sh}
83./unittest.sh
84~~~
85
86You will see several error messages when running the unit tests, but they are
87part of the test suite. The final message at the end of the script indicates
88success or failure.
89
90# Running the Example Applications {#getting_started_examples}
91
92Before running an SPDK application, some hugepages must be allocated and
93any NVMe and I/OAT devices must be unbound from the native kernel drivers.
94SPDK includes a script to automate this process on both Linux and FreeBSD.
95This script should be run as root. It only needs to be run once on the
96system. *Make sure you aren't using an NVMe device as your boot device.*
97
98~~~{.sh}
99sudo scripts/setup.sh
100~~~
101
102To rebind devices back to the kernel, you can run
103
104~~~{.sh}
105sudo scripts/setup.sh reset
106~~~
107
108By default, the script allocates 1024 2MB hugepages. To change this number,
109specify NRHUGE as follows:
110
111~~~{.sh}
112sudo NRHUGE=4096 scripts/setup.sh
113~~~
114
115Example code is located in the examples directory. The examples are compiled
116automatically as part of the build process. Simply call any of the examples
117with no arguments to see the help output. If your system has its IOMMU
118enabled you can run the examples as your regular user. If it doesn't, you'll
119need to run as a privileged user (root).
120
121A good example to start with is `examples/nvme/identify`, which prints
122out information about all of the NVMe devices on your system.
123
124Larger, more fully functional applications are available in the `app`
125directory. This includes the iSCSI and NVMe-oF target.
126