Linux环境与path变量
一、bash环境
- Linux自带
- Mac自带
- Windows 使用git bash
bash自启动文件
- 系统初始化文件/etc/profile
- 登录用户特定初始化文件~/.bash_profile
- bash初始化文件~/.bashrc
zsh自启动文件
- 系统初始化文件/etc/zprofile
- 登录用户特定初始化文件~/.zprofile
- bash初始化文件~/.zshrc
二、path变量
path变量是一个路径列表,以:隔开
如果可执行程序所在目录在path变量的路径列表中,那么执行命令时可以省略路径
路径列表前面的路径为优先匹配路径,可以用来实现新老版本程序的命令更换
PATH变量使用示例
export CHROMEDRIVER_HOME=$HOME/projects/chromedriver/91
export PATH=$CHROMEDRIVER_HOME:$PATH
export VSCODE_HOME=/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin
export PATH=$VSCODE_HOME:$PATH
export SONAR_HOME=/usr/local/Cellar/sonar-scanner/4.2.0.1873
export PATH=$SONAR_HOME/bin/:$PATH
export SONARQUBE_TOKEN=c7a93fb6bb1e3268f7099b0f26672ba43c117bb9
export ANDROID_HOME=$HOME/Library/Android/sdk/
export PATH=$ANDROID_HOME/emulator/:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:~/bin/:$PATH
三、应用安装
- 平台自带app store
- yum@centos/redhat
- apt-get@ubuntu debian
- scoop winget@windows
- 特定平台版本管理工具 pyenv nvm
- 安装包安装 pkg dmg
- 源码编译安装 make; make install
redhat/centos平台
- yum search $package
- yum install $package
- yum remove $package
ubuntu/debian平台
- apt-cache search $package
- apt-get install $package
- apt-get uninstall $package
开源镜像站
四、环境配置
- 搜索包:yum search python
- 安装包:yum install -y python
- 源码安装
#提前安装对应的各种开发库依赖,每个版本的要求可能都不同
curl -O https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
tar -zxvf Python-3.10.0.tgz
cd Python-3.10.0
./configure
make
sudo make install
#DESTDIR=/tmp/python3 make install
4.检查环境
- python -V
- which python
- echo $PATH
nmp包管理工具
- nmp search $package
- nmp install -g $package
- nmp uninstall package
nodejs 项目的编译
appium 源代码编译
git clone https://github.com/appium/appium.git
cd appium
npm install
npm run build
node .
[Appium] [霍格沃兹测试学院定制版] Welcome to Appium v1.23.0-beta.0 (REV b2415a08729d64b16bf07da772fd9280de7932c8)
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
^C[Appium] Received SIGINT - shutting down
[debug] [Appium] There are no active sessions for cleanu
java 下载地址
- java https://www.java.com/zh-CN/
- oracle jdk http://www.oracle.com/technetwork/java/javase/downloads/index.html
- openjdk https://openjdk.java.net/
centos java 安装
yum search jdk
yum install -y java-11-openjdk
unzip apache-maven-3.8.3-bin.zip
export PATH=/opt/apache-maven-3.8.3/bin:$PATH
which mvn
mvn 常用命令
mvn clean test
mvn package install
mvn test -DskipTests
mvn clean \
org.jacoco:jacoco-maven-plugin:0.8.5:prepare-agent \
test \
org.jacoco:jacoco-maven-plugin:0.8.5:report \
-Dmaven.test.failure.ignore=true \
-Dmaven.test.skip=false
编译项目
git clone https://github.com/spring-guides/gs-spring-boot.git
cd gs-spring-boot/complete
mvn package
java -Dserver.port=8888 -jar target/spring-boot-complete-0.0.1-SNAPSHOT.jar
#SERVER_PORT=8888 mvn spring-boot:run
maven 的配置
- The Maven install: ${maven.home}/conf/settings.xml
- A user’s install: ${user.home}/.m2/settings.xml
Android sdk
Android SDK 路径配置
#*unix,长期使用放入到~/.bash_profile中
#ANDROID_HOME官方不推荐使用,但是仍然生效
#export ANDROID_HOME=/Users/seveniruby/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/seveniruby/Library/Android/sdk
export PATH=$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/tools/bin:$PATH
#windows 长期使用放入到系统属性里
set ANDROID_SDK_ROOT=E:\Android\sdk\
创建模拟器并通过 shell 运行与执行测试
avdmanager create avd -n 'ceshiren.com.29' -k 'system-images;android-29;google_apis;x86_64'
emulator -list-avds
emulator @ceshiren.com.29
adb devices
adb logcat
adb shell monkey -p com.google.android.apps.messaging 500
avdmanager delete avd -n ceshiren.com.29