Linux便携配置指南

2019-10-10  本文已影响0人  kevinsEegets

目录

1:下载Linux版的JDK并安装
2:下载Android SDK
3:下载Android Studio或者IntelliJIBEA并安装
4:安装zsh
5:安装git
6:配置~/.zshrc 环境变量以及配置 git路径
7:git上生成key并配置SSH秘钥

下载Linux版的JDK并安装

下载Linux版的JDK,例如我下载的是Linux版的JKD1.8,文件是jdk-8u121-linux-x64.tar.gz
地址是:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
或者是执行命令安装:

sudo apt-get update 
sudo apt-get install openjdk-8-jdk

安装完成后执行 <font color="#ff0000">javac</font> 验证是否安装成功

下载Linux AndroidSDK

下载Linux AndroidSDK,下载路径为:http://tools.android-studio.org/index.php/sdk
下载完成之后解压到对应的目录即可使用

下载Android Studio或者IntelliJIBEA并安装

下载Android studio,下载路径为:http://www.android-studio.org/index.php/download
下载IntelliJIBEA,下载路径为:https://www.jetbrains.com/idea/download/

tag解压在终端中执行 tar-zxvf /ideaIC-12.1.6.tar.gz
zip解压在终端中执行 unzip XXXX.zip

运行IDE或者Android Studio,终端中执行命令:

idea.sh
android.studio.sh

安装zsh

在终端中执行:

sudo apt-get install zsh

等待安装完成之后打开网站:https://ohmyz.sh/
在终端中执行脚本:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

或者是

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

等到终端界面出现

Oh My ZSH!

恭喜您,zsh安装成功了。

安装git

终端中执行命令:

sudo apt-get install git

配置~/.zshrc 环境变量以及配置 git路径

终端中执行

vim ~/.zshrc  或者执行 gedit ~/.zshrc

可以看到zsh配置了很多东西,我们需要在原有的基础上配置环境变量

# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH:~/Documents/UnixLikeScripts/:/home/kevin/AndroidSDK/platform-tools

# Path to your oh-my-zsh installation.
  export ZSH="/home/kevin/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
)

source ~/.zshrc


source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias scdir="cd /home/kevin/SecooComponentMaster"
alias temp="cd /tmp"

找到如上的第二行:

export PATH=HOME/bin:/usr/local/bin:PATH:~/Documents/UnixLikeScripts/:/home/kevin/AndroidSDK/platform-tools

在path后边添加本地存储的SDK路径
可以随意配置文件目录,例如:

alias scdir="cd /home/kevin/SecooComponentMaster"
alias temp="cd /tmp"

alias解释:alias(别名)在 shell 中是非常常用的,它主要用于给命令起别名,简化输入。

配置完成之后可以在终端中测试输入:

scdir

会自动切入到配置的文件夹目录中

git上生成key并配置SSH秘钥

执行顺序:

1:网址中输入:http://gitlab.secoo.com:8090

2:选择右上角的个人头像

3:点击Setting选择左边列表中的 SSH Keys

4:点击Add an SSH keyBefore you can add an SSH key you need to generate it.中的 <font color="#ff0000">generate it</font>

5:选择Generating a new SSH key pair的 <font color="#ff0000">ssh-keygen -t rsa -C "your.email@example.com" -b 4096</font>

如下图:


TIM图片20181110185635.png

将 "your.email@example.com"替换成自己的账号
在终端中执行 "5" 的命令,会自动生成key(注意是*.pub文件的文本内容),将该key复制到git SSH Key中,添加该Key

上一篇 下一篇

猜你喜欢

热点阅读