Step-by-Step Guide to Installing TensorFlow 1.3.0 with GPU Support on CentOS 6.8
This article provides a comprehensive, hands‑on tutorial for setting up a CentOS 6.8 server with NVIDIA GPUs, installing Java 8, GCC 4.9.4, Python 2.7, NVIDIA drivers, CUDA 8.0, cuDNN 6.0, Bazel, and finally building and verifying TensorFlow 1.3.0 from source, while documenting common pitfalls and fixes.
The author, an intern at Lianjia, documents the entire process of preparing a CentOS 6.8 machine for deep‑learning workloads, beginning with the acquisition of GPU servers (Tesla P100/V100) and outlining the two‑phase installation strategy.
Prerequisites : CentOS 6.8 (64‑bit) with gcc 4.4.7, Python 2.6.6, and internet access (or offline package preparation). The required software stack includes Java 8, gcc 4.9.4, Python 2.7, pip, setuptools, Bazel, NVIDIA driver, CUDA 8.0, cuDNN 6.0, and finally TensorFlow 1.3.0.
1. Install Java‑8 : Download the tar.gz from Oracle, extract, and add the bin directory to PATH.
2. Build and install gcc 4.9.4 :
wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.4/gcc-4.9.4.tar.bz2 tar -xjf gcc-4.9.4.tar.bz2 && cd gcc-4.9.4 ./contrib/download_prerequisites mkdir build && cd build ../configure --prefix=/opt/gcc-4.9.4 --enable-languages=c,c++ --disable-multilib make -j4 make installAdd the new gcc to PATH and set the required environment variables (CXX, CC, LDFLAGS, CXXFLAGS, etc.) in .bashrc.
3. Install Python 2.7 :
wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz tar -xf Python-2.7.14.tar.xz && cd Python-2.7.14 ./configure --prefix=/usr/local make -j4 make installUpdate PATH or create symlinks so that python points to the new binary.
4. Fix yum’s Python dependency by editing /usr/bin/yum to use #!/usr/bin/python2.6 instead of the newer interpreter.
5. Upgrade pip and setuptools :
wget https://pypi.python.org/packages/.../setuptools‑…‑py2.py3-none-any.whl python setup.py install pip install --upgrade pipConfigure a fast domestic mirror in ~/.pip/pip.conf.
6. Install Bazel 0.5.3 :
wget https://github.com/bazelbuild/bazel/releases/download/0.5.3/bazel-0.5.3-dist.zip unzip bazel-0.5.3-dist.zip -d bazel-0.5.3 cd bazel-0.5.3 && ./compile.shCopy the resulting binary to /usr/local/bin.
7. Install NVIDIA driver (Tesla P100): download NVIDIA-Linux-x86_64-384.66.run, make it executable, run it, and reboot.
8. Install CUDA 8.0 :
chmod +x cuda_8.0.61_375.26_linux.run ./cuda_8.0.61_375.26_linux.runSelect “no” for the bundled driver, accept the defaults, and add /usr/local/cuda-8.0/bin to PATH and /usr/local/cuda-8.0/lib64 to LD_LIBRARY_PATH.
9. Install cuDNN 6.0 for CUDA 8.0:
tar -zxvf cudnn-8.0-linux-x64-v6.0.tgz cp cuda/include/cudnn.h /usr/local/cuda/include/ cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/Set read permissions on the copied files.
10. Build TensorFlow 1.3.0 from source :
git clone https://github.com/tensorflow/tensorflow cd tensorflow && git checkout r1.3 ./configureDuring configuration answer “n” to jemalloc, “y” to CUDA support, and accept the defaults for other options.
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_packageIf the build succeeds, package the wheel:
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkgInstall it with:
pip install /tmp/tensorflow_pkg/tensorflow-1.3.0-py2-none-any.whl11. Verification : Run python -c "import tensorflow as tf; print(tf.__version__)" and ensure no import errors. Use nvidia-smi and CUDA sample deviceQuery to confirm GPU visibility.
Common errors and fixes are listed throughout the guide, including missing kernel source, Bazel build failures due to missing patch, C++ compilation issues, and the need to disable jemalloc during TensorFlow configuration.
By following these steps, the author successfully created a functional TensorFlow GPU environment on CentOS 6.8, and shares the experience to help others avoid similar pitfalls.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Beike Product & Technology
As Beike's official product and technology account, we are committed to building a platform for sharing Beike's product and technology insights, targeting internet/O2O developers and product professionals. We share high-quality original articles, tech salon events, and recruitment information weekly. Welcome to follow us.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
