Add Debian codenames and make link.
[platform/upstream/caffeonacl.git] / docs / install_apt_debian.md
1 ---
2 title: "Installation: Debian"
3 ---
4
5 # Debian Installation
6
7 Caffe packages are available for `Debian/unstable`. Debian/stable
8 (jessie) users should take a look at [Ubuntu installation instruction](
9 install_apt.html). Debian/testing (stretch) users may be able to get Caffe
10 to work using the packages in Debian/unstable, but it is beyond the scope of
11 this guide.
12
13 Only experienced linux users are recommended to try Debian/unstable (Sid). 
14
15 Last update: Dec.21 2016  
16
17 ## Debian/unstable
18
19 Apart from the installation methods based on source, Debian/unstable
20 users can install pre-compiled Caffe packages via the official archive.
21
22 ### Binary installation
23
24 Make sure that there is something like the follows in your `/etc/apt/sources.list`:
25 ```
26 deb http://ftp2.cn.debian.org/debian sid main contrib non-free
27 ```
28 Then we update APT cache and directly install Caffe. Note, the cpu version and
29 the cuda version cannot be installed at the same time.
30 ```
31 # apt update
32 # apt install [ caffe-cpu | caffe-cuda ]
33 ```
34 It should work out of box.
35
36 #### Customizing caffe packages
37
38 Some users may need to customize the Caffe package. Here is a brief
39 guide of producing the customized `.deb` packages.
40
41 Make sure that there is something like this in your `/etc/apt/sources.list`:
42 ```
43 deb http://ftp2.cn.debian.org/debian sid main contrib non-free
44 deb-src http://ftp2.cn.debian.org/debian sid main contrib non-free
45 ```
46
47 Then we build caffe deb files with the following commands:
48 ```
49 $ sudo apt update
50 $ sudo apt install build-essential debhelper devscripts    # standard package building tools
51 $ sudo apt build-dep [ caffe-cpu | caffe-cuda ]            # the most elegant way to pull caffe build dependencies
52 $ apt source [ caffe-cpu | caffe-cuda ]               # download the source tarball and extract
53 $ cd caffe-XXXX
54 [ ... optional, customize caffe code/build ... ]
55 $ debuild -B -j4                                      # build caffe with 4 parallel jobs (similar to make -j4)
56 [ ... building ...]
57 $ debc                                                # optional, if you want to check the package contents
58 $ sudo debi                                           # optional, install the generated packages
59 ```
60 The resulting deb packages can be found under the parent directory of the source tree.
61
62 ### Source installation
63
64 Source installation under Debian/unstable is similar to that of Ubuntu, but
65 here is a more elegant way to pull caffe build dependencies:
66 ```
67 $ sudo apt build-dep [ caffe-cpu | caffe-cuda ]
68 ```
69 Note, this requires a `deb-src` entry in your `/etc/apt/sources.list`.
70
71 ### Notes
72
73 * Consider re-compiling OpenBLAS locally with optimization flags for sake of
74 performance. This is highly recommended if you are writing a paper.
75
76 * If you are installing `caffe-cuda`, APT will automatically pull some of the
77 CUDA packages and the nvidia driver packages. Please take care if you have
78 manually installed or hacked nvidia driver or CUDA toolkit or any other
79 related stuff, because in this case it may fail.
80
81 * If you encountered any problem when installing `caffe-*`, please report bug
82 to Debian via Debian's bug tracking system. See https://www.debian.org/Bugs/ .
83
84 * Additionally, a manpage (`man caffe`) and a bash complementation script
85 (`caffe <TAB><TAB>`, `caffe train <TAB><TAB>`) are provided.
86 Both of the two files are still not merged into caffe master.
87
88 * The python interface is Python 3 version: `python3-caffe-{cpu,cuda}`.
89 No plan to support python2.
90
91 ## FAQ
92
93 * where is caffe-cudnn?
94
95 CUDNN library seems not redistributable currently. If you really want the
96 caffe-cudnn deb packages, the workaround is to install cudnn by yourself,
97 and hack the packaging scripts, then build your customized package.
98
99 * I installed the CPU version, How can I switch to the CUDA version?
100
101 `sudo apt install caffe-cuda`, apt's dependency resolver is smart enough to deal with this.
102
103 * Where is the examples, the models and other documentation stuff?
104
105 ```
106 sudo apt install caffe-doc
107 dpkg -L caffe-doc
108 ```