@@ -5,71 +5,53 @@ ms.custom: devx-track-azurecli, linux-related-content
55
66## Before you begin
77
8- It's strongly recommended to install the Azure CLI with a package manager. A package manager makes
9- sure you always get the latest updates, and guarantees the stability of Azure CLI components. Check
10- and see if there's a package for your distribution before installing manually.
8+ It's strongly recommend to install the CLI with a package manager. A package manager makes sure you
9+ always get the latest updates, and guarantees the stability of CLI components. Check and see if
10+ there's a package for your distribution before installing manually.
1111
12- ## Requirements
12+ The install script for the Azure CLI requires the following software:
1313
14- - [ Python 3.10 or higher ] [ 06 ] - For more information, see
14+ - [ Python 3.8.x, 3.9.x, 3.10.x ] [ 06 ] - For more information, see
1515 [ Support lifecycle - Python dependency] [ 01 ] .
16- - ` python3-venv ` package for your distro
16+ - [ libffi] [ 04 ]
17+ - [ OpenSSL 1.0.2] [ 05 ]
1718
1819## Install or update Azure CLI
1920
2021> [ !IMPORTANT]
21- > These steps install Azure CLI into a ** virtual environment** under your home directory and add a
22- > symlink to ` ~/bin/az ` . This keeps Azure CLI isolated from system Python and makes updates
23- > straightforward.
22+ > The install script only works on Python 3.8.x, 3.9.x, or 3.10.x. This install script does not work
23+ > on Python 3.11.x or later versions.
2424
25- ``` bash
26- # Create and activate a virtual environment
27- python3 -m venv ~ /lib/azure-cli
28- source ~ /lib/azure-cli/bin/activate
29-
30- # Upgrade pip and install (or update) Azure CLI
31- python -m pip install --upgrade pip
32- pip install --upgrade azure-cli
33-
34- # Expose 'az' on your PATH via a user bin folder
35- mkdir -p ~ /bin
36- ln -sf ~ /lib/azure-cli/bin/az ~ /bin/az
37-
38- # Ensure ~/bin is on PATH for future shells
39- grep -q ' export PATH="$HOME/bin:$PATH"' ~ /.bashrc || echo ' export PATH="$HOME/bin:$PATH"' >> ~ /.bashrc
25+ Both installing and updating the Azure CLI requires rerunning the install script:
4026
41- # Refresh shell command cache ( bash/zsh)
42- hash -r
27+ ``` bash
28+ curl -L https://aka.ms/InstallAzureCli | bash
4329```
4430
45- > [ !NOTE]
46- > If you're using zsh, replace ` .bashrc ` with ` .zshrc ` in the PATH update command so the change
47- applies to future zsh sessions.
31+ The script can also be downloaded and run locally. You may have to restart your shell for the
32+ changes to take effect.
4833
49- - To update later:
34+ ## Uninstall Azure CLI
5035
51- ``` bash
52- source ~ /lib/azure-cli/bin/activate
53- pip install --upgrade azure-cli
54- hash -r
55- ```
36+ [ !INCLUDE [ uninstall-boilerplate.md] ( uninstall-boilerplate.md )]
5637
57- ## Uninstall Azure CLI
38+ Uninstall the CLI by directly deleting the files from the location chosen at the time of
39+ installation. The default install location is the user's home directory ($HOME).
5840
59- 1 . Remove the virtual environment and symlink .
41+ 1 . Remove the installed CLI files .
6042
6143 ``` bash
62- rm -rf ~ /lib/azure-cli
63- rm -f ~ /bin/az
44+ rm -r < install location > /lib/azure-cli
45+ rm < install location > /bin/az
6446 ```
6547
66- 1 . (Optional) Remove the PATH line from your shell profile if you added it :
48+ 1 . Modify your ` $HOME/.bash_profile ` file to remove the following line :
6749
6850 ``` text
69- export PATH="$HOME/bin:$PATH"
51+ <install location>/lib/azure-cli/az.completion
7052 ```
7153
72- 1 . Refresh the shell command cache:
54+ 1 . If using ` bash ` or ` zsh ` , reload your shell's command cache.
7355
7456 ``` bash
7557 hash -r
@@ -84,20 +66,56 @@ applies to future zsh sessions.
8466Here are some common problems seen during a manual installation. If you experience a problem not
8567covered here, [ file an issue on GitHub] [ 03 ] .
8668
87- - ** ` az: command not found ` **
69+ ### Install without Python 3
70+
71+ The Azure CLI has dropped support for Python 2.7 since version [ 2.1.0] [ 02 ] . On your system, there
72+ may be a Python version that predates the requirement of Python 3.6.x. Find a replacement ` python3 `
73+ package.
74+
75+ ### curl "Object Moved" error
76+
77+ If you get an error from ` curl ` related to the ` -L ` parameter, or an error message including the
78+ text "Object Moved", try using the full URL instead of the ` aka.ms ` redirect:
79+
80+ ``` bash
81+ curl https://azurecliprod.blob.core.windows.net/install | bash
82+ ```
83+
84+ ### ` az ` command not found
85+
86+ If you can't run the command after installation using ` bash ` or ` zsh ` , try clearing your shell's
87+ command hash cache and check if the problem is resolved.
88+
89+ ``` bash
90+ hash -r
91+ ```
92+
93+ The issue can also occur if you didn't restart your shell after installation. Make sure that the
94+ location of the ` az ` command is in your ` $PATH ` . The location of the ` az ` command is ...
95+
96+ ```
97+ <install path>/bin
98+ ```
99+
100+ ### Proxy blocks connection
88101
89- - Make sure ` ~/bin ` is on your ` PATH ` (` echo $PATH ` ), the symlink exists (` ls -l ~/bin/az ` ), then
90- ` hash -r ` and reopen your shell.
102+ [ !INCLUDE[ configure-proxy] ( configure-proxy.md )]
91103
92- - ** Proxy issues**
104+ In order to get the installation scripts, your proxy needs to allow HTTPS connections to the
105+ following addresses:
93106
94- - For proxy endpoint configuration, see [ Azure CLI endpoints for proxy bypass] [ 07 ] .
107+ - ` https://aka.ms/ `
108+ - ` https://azurecliprod.blob.core.windows.net/ `
109+ - ` https://pypi.python.org `
110+ - Endpoints used by your distribution's package manager (if any) for core packages
95111
96112[ !INCLUDE[ troubleshoot-wsl.md] ( troubleshoot-wsl.md )]
97113
98114<!-- link references -->
99115
100116[ 01 ] : ../azure-cli-support-lifecycle.md#python-dependency
117+ [ 02 ] : /cli/azure/release-notes-azure-cli#february-18-2020
101118[ 03 ] : https://github.com/Azure/azure-cli/issues
119+ [ 04 ] : https://sourceware.org/libffi/
120+ [ 05 ] : https://www.openssl.org/source/
102121[ 06 ] : https://www.python.org/downloads/
103- [ 07 ] : ../azure-cli-endpoints.md
0 commit comments