Kali-Linux- configure the development environment

This paper explains JDK, SDK, eclipse-adt, android studio, the installation configuration TensorFlow cpu mode.update:2019-08-30 03:31:46

JDK

Jdk current system is openjdk10, resulting in many legacy tools can not be used. We found that /usr/lib/jvmthere are other versions.
By sudo update-alternatives --config javaswitching to a minimum, to ensure compatibility.

$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-10-openjdk-amd64/bin/java      1101      auto mode
  1            /usr/lib/jvm/java-10-openjdk-amd64/bin/java      1101      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  3            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode

Press <enter> to keep the current choice[*], or type selection number: 2        
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-2-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

ORACLE JAVA version of the official website to link to shut legacy, recently accidentally find a download address of java8 .
IBM version of JAVA link it very full, download location here .
Specific version differences do not make the top three get to the bottom, you can use the current guarantee openjdk8.

#解压安装
$ tar -xzvf jdk*.tar.gz 
$ sudo cp -r jdk1.8* /usr/lib/jvm/
#配置JAVA
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_191/bin/java" 100
$ sudo update-alternatives --config java
There are 4 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-10-openjdk-amd64/bin/java      1101      auto mode
  1            /usr/lib/jvm/java-10-openjdk-amd64/bin/java      1101      manual mode
* 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  3            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode
  4            /usr/lib/jvm/jdk1.8.0_191/bin/java               100       manual mode

Press <enter> to keep the current choice[*], or type selection number: 4
update-alternatives: using /usr/lib/jvm/jdk1.8.0_191/bin/java to provide /usr/bin/java (java) in manual mode
#配置JAVAC
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_191/bin/javac" 100
$ sudo update-alternatives --config javac
There are 3 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                          Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-10-openjdk-amd64/bin/javac   1101      auto mode
  1            /usr/lib/jvm/java-10-openjdk-amd64/bin/javac   1101      manual mode
  2            /usr/lib/jvm/java-9-openjdk-amd64/bin/javac    1091      manual mode
  3            /usr/lib/jvm/jdk1.8.0_191/bin/javac            100       manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/jdk1.8.0_191/bin/javac to provide /usr/bin/javac (javac) in manual mode
#配置JAR
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.8.0_191/bin/jar 100
$ sudo update-alternatives --config jar
There are 4 choices for the alternative jar (providing /usr/bin/jar).

  Selection    Path                                        Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-10-openjdk-amd64/bin/jar   1101      auto mode
  1            /usr/bin/fastjar                             100       manual mode
  2            /usr/lib/jvm/java-10-openjdk-amd64/bin/jar   1101      manual mode
  3            /usr/lib/jvm/java-9-openjdk-amd64/bin/jar    1091      manual mode
* 4            /usr/lib/jvm/jdk1.8.0_191/bin/jar            100       manual mode

Press <enter> to keep the current choice[*], or type selection number: 4
#配置JAVA环境变量
$ export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_191/
$ export JRE_HOME=/usr/lib/jvm/jdk1.8.0_191/jre
$ export PATH=$PATH:/usr/lib/jvm/jdk1.8.0_191/bin:/usr/lib/jvm/jdk1.8.0_191/jre/bin
#验证安装情况
$ java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

sdk

sudo apt-get install android*
There is a problem, when the back of the android studio configuration sdk, ordinary users will encounter the situation can not write to the directory, do not know how common approach is to solve. Take temporary program is to change the / usr / share / owner permissions android-sdk directory:
sudo chown -R $(whoami):$(whoami) /usr/share/android-sdk
If a better way, the follow-up to this update.

  • After the phone is connected, adb devicestips: no permissions (udev requires plugdev group membership)solve step in here .

eclipse-adt

Do not use apt install installation, a bunch of questions that version. Integrated version download from the Internet, extract use.
Encountered a problem: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory.
Solution: sudo apt-get install lib32z1

android studio

  1. Before downloading the first open 1antern, this time, android-sdk proxy interface to ensure emptied to prevent interference, input terminal android, configured as shown:
    Proxy empty
  2. Https://developer.android.com/studio/ to download the installation package, then extract to the specified directory
  3. Start ~ / android-studio / bin / studio.sh, new projects, initial setup
    proxy.png
  4. Always 404, in the home owners if gradle download from dl.google.com the ping test page to find a few ip, added to the / etc / hosts inside.
    dl.png
  5. Then wait for the progress bar to finish it, do not drink coffee habit, it would be the first packet of instant noodles ......
    Configuration
    Finally, do not forget to turn off the lights: ALT + F2, killall lantern, Enter.

back up plan:

  • Proxy Address: mirrors.neusoft.edu.cnPort: 80
  • Offline download gradle, but version control is not good match, not recommended.
    gradle configuration interface

TensorFlow cpu mode

apt-get install python-pip python-dev -y
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl

Test case:

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a+b))
42
>>> 

Reference
installation: HTTPS: //medium.com/@firebitsbr/installing-tensorflow-on-kali-rolling-base-cpu-mode-41d05b912155
TF official website: HTTPS: //www.tensorflow.org/get_started/os_setup#pip_installation
CUDA : https: //docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

CMake

Just make command has been compiled, make install to install the required
software installation position is decided by the Makefile the default installation location, under normal circumstances, are in / usr / local directory, you can also specify prefix = / path / to be decide

Guess you like

Origin www.cnblogs.com/M4K0/p/11432889.html