创建脚本
vi install_adb.sh
yum install java-1.8.0-openjdk* unzip -y echo -e '\nexport JAVA_HOME=/usr/lib/jvm/java\nexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar\nexport PATH=$PATH:$JAVA_HOME/bin\n' >> /etc/profile && source /etc/profile mkdir -p /opt/android-sdk-linux cd /opt/android-sdk-linux # @see https://developer.android.com/studio/index.html wget --output-document=android-sdk.zip --quiet https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip unzip android-sdk.zip rm -f android-sdk.zip yes | tools/bin/sdkmanager --licenses tools/bin/sdkmanager "tools" "platform-tools" "extras;google;m2repository" echo -e '\nexport PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL\nexport PATH=$PATH:/opt/android-sdk-linux/tools/bin\nexport PATH=$PATH:/opt/android-sdk-linux/platform-tools\n' >> /etc/profile && source /etc/profile adb --version
执行脚本
chmod 755 install_adb.sh ./install_adb.sh