|
5 | 5 | The UCloud CLI provides a unified command line interface to UCloud services. It works on Golang SDK based on UCloud OpenAPI and supports Linux, macOS and Windows. |
6 | 6 | https://docs.ucloud.cn/software/cli/index |
7 | 7 |
|
8 | | -## Installing ucloud-cli |
| 8 | +## Installing ucloud-cli on macOS or Linux |
9 | 9 |
|
10 | 10 | **Using Homebrew(Preferred)** |
11 | 11 |
|
12 | | -The [Homebrew](https://docs.brew.sh/Installation) package manager may be used on macOS, Linux and Windows Subsystem for Linux (WSL). |
| 12 | +The [Homebrew](https://docs.brew.sh/Installation) package manager may be used on macOS and Linux. |
13 | 13 | It could install ucloud-cli and its dependencies automatically by running command below. |
14 | 14 |
|
15 | 15 | ``` |
16 | | -$ brew install ucloud |
| 16 | +brew install ucloud |
17 | 17 | ``` |
18 | 18 |
|
19 | 19 | If you have installed ucloud-cli already and want to upgrade to the latest version, just run: |
20 | 20 |
|
21 | 21 | ``` |
22 | | -$ brew upgrade ucloud |
| 22 | +brew upgrade ucloud |
23 | 23 | ``` |
24 | 24 |
|
25 | 25 | If you come across some errors during the installation via homebrew, please update the homebrew first and try again. |
26 | 26 |
|
27 | 27 | ``` |
28 | | -$ brew update |
| 28 | +brew update |
29 | 29 | ``` |
30 | 30 |
|
31 | 31 | If the error is still unresolved, try the following command for help. |
32 | 32 |
|
33 | 33 | ``` |
34 | | -$ brew doctor |
| 34 | +brew doctor |
35 | 35 | ``` |
36 | 36 |
|
37 | 37 | **Building from source** |
38 | 38 |
|
39 | 39 | If you have installed git and golang on your platform, you can fetch the source code of ucloud cli from github and complie it by yourself. |
40 | 40 |
|
41 | 41 | ``` |
42 | | -$ git clone https://github.com/ucloud/ucloud-cli.git |
43 | | -$ cd ucloud-cli |
44 | | -$ make install |
| 42 | +git clone https://github.com/ucloud/ucloud-cli.git |
| 43 | +cd ucloud-cli |
| 44 | +make install |
45 | 45 | ``` |
46 | 46 |
|
47 | 47 | **Downloading binary release** |
48 | 48 |
|
49 | | -Vist the [Releases page](https://github.com/ucloud/ucloud-cli/releases) of ucloud cli, and find the appropriate archive for your operating system and architecture. |
| 49 | +Vist the [releases page](https://github.com/ucloud/ucloud-cli/releases) of ucloud cli, and find the appropriate archive for your operating system and architecture. |
50 | 50 | Download the archive , check the shasum256 hashcode and extract it to your $PATH |
51 | 51 |
|
52 | 52 | For example |
53 | 53 | ``` |
54 | | -curl -OL https://github.com/ucloud/ucloud-cli/releases/download/0.1.14/ucloud-cli-macosx-0.1.14-amd64.tgz |
55 | | -echo "6953232b20f3474973cf234218097006a2e0d1d049c115da6c0e09c103762d4d *ucloud-cli-macosx-0.1.14-amd64.tgz" | shasum -c |
56 | | -tar zxf ucloud-cli-macosx-0.1.14-amd64.tgz -C /usr/local/bin/ |
| 54 | +curl -OL https://github.com/ucloud/ucloud-cli/releases/download/0.1.20/ucloud-cli-macosx-0.1.20-amd64.tgz |
| 55 | +echo "6953232b20f3474973cf234218097006a2e0d1d049c115da6c0e09c103762d4d *ucloud-cli-macosx-0.1.20-amd64.tgz" | shasum -c |
| 56 | +tar zxf ucloud-cli-macosx-0.1.20-amd64.tgz -C /usr/local/bin/ |
57 | 57 | ``` |
58 | 58 |
|
59 | | -## Enabling Shell Auto-Completion |
| 59 | +## Installing ucloud cli on Windows |
| 60 | + |
| 61 | +**Building from source** |
| 62 | + |
| 63 | +Download the source code of ucloud cli from [releases page](https://github.com/ucloud/ucloud-cli/releases). You can also download it by running ```git clone https://github.com/ucloud/ucloud-cli.git``` |
| 64 | +Ensure you have git installed, because go will download packages using git. Go to the directory of the source code, and then compile the source code by running "go build -mod=vendor -o ucloud.exe" |
| 65 | +After that add ucloud.exe to your environment variable PATH. You could follow [this document](https://www.java.com/en/download/help/path.xml) if you don't know how to do. |
| 66 | +Open CMD Terminal and run ```ucloud --version ``` to test installation. |
| 67 | + |
| 68 | + |
| 69 | +**Downloading binary release** |
| 70 | + |
| 71 | +Vist the [releases page](https://github.com/ucloud/ucloud-cli/releases) of ucloud cli, and find the appropriate archive for your operating system and architecture. |
| 72 | +Download the archive , and extract it. Add binary file ucloud.exe to your environment variable PATH following [this document](https://www.java.com/en/download/help/path.xml) |
| 73 | + |
| 74 | +## Using ucloud cli in a Docker container |
| 75 | +If you have installed docker on your platform, pull the docker image embeded ucloud cli by follow command. |
| 76 | +``` |
| 77 | +docker pull uhub.service.ucloud.cn/ucloudcli/ucloud-cli:0.1.20 |
| 78 | +``` |
| 79 | + |
| 80 | +The docker image was built by the Dockerfile as follow. |
| 81 | +``` |
| 82 | +FROM ubuntu:18.04 |
| 83 | +RUN apt-get update && apt-get install wget -y |
| 84 | +RUN wget https://github.com/ucloud/ucloud-cli/releases/download/0.1.20/ucloud-cli-linux-0.1.20-amd64.tgz |
| 85 | +RUN tar -zxf ucloud-cli-linux-0.1.20-amd64.tgz -C /usr/local/bin/ |
| 86 | +RUN echo "complete -C $(which ucloud) ucloud" >> ~/.bashrc #enable auto completion |
| 87 | +``` |
| 88 | + |
| 89 | +Create a docker container named ucloud-cli using the docker image your have pulled by following command. |
| 90 | + |
| 91 | +``` |
| 92 | +docker run --name ucloud-cli -it -d uhub.service.ucloud.cn/ucloudcli/ucloud-cli:0.1.20 |
| 93 | +``` |
| 94 | +Run bash command in ucloud-cli container, and then you could play with ucloud cli. |
| 95 | + |
| 96 | +``` |
| 97 | +docker exec -it ucloud-cli bash |
| 98 | +``` |
| 99 | + |
| 100 | +## Enabling Shell Auto-Completion for bash or zsh shell user. |
60 | 101 |
|
61 | 102 | UCloud CLI also has auto-completion support. It can be set up so that if you partially type a command and then press TAB, the rest of the command is automatically filled in. |
62 | 103 |
|
|
0 commit comments