Skip to content

Commit

Permalink
support offline package #21 #30 for linux/mac
Browse files Browse the repository at this point in the history
  • Loading branch information
wjo1212 committed Jun 5, 2018
1 parent b8ce9fa commit b60b9dc
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 2 deletions.
61 changes: 59 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* [Operation System](#operation-system)
* [Supported Version](#supported-version)
* [Installation Method](#installation-method)
* [FQA of Installation](#faq-of-installation)
* [Offline Installation](#offline-installation)
* [FAQ of Installation](#faq-of-installation)
* [Full Usage list](#full-usage-list)
* [Configure CLI](#configure-cli)
* [Input and Output](#input-and-output)
Expand Down Expand Up @@ -113,9 +114,31 @@ You could try the mirrors of local network provider, for Alicloud ECS, you can t
pip/pip3 install -U aliyun-log-cli --index http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
```

### Offline Installation
Since [0.1.12](https://github.com/aliyun/aliyun-log-cli/releases), we provide offline package for mac x64 and linux x64 platform.

Follow below ways to install it.
1. download the package from [release page](https://github.com/aliyun/aliyun-log-cli/releases)
2. unzip it to a local folder, like `cli_packages`, you can see some whl files inside it.
3. if you don't have pip, install pip first:

### FQA of Installation
```shell
python pip-10.0.1-py2.py3-none-any.whl/pip install --no-index cli_packages/pip-10.0.1-py2.py3-none-any.whl
```

4. install the CLI:

```shell
pip install aliyun-log-cli --no-index --find-links=cli_packages
```

5. verify it
```shell
> aliyunlog --version
```


### FAQ of Installation

1. Encoutering errr `TLSV1_ALERT_PROTOCOL_VERSION` when installing CLI:

Expand All @@ -134,7 +157,41 @@ No matching distribution found for aliyun-log-cli
pip install pip -U
```

2. On Linux/Mac, cannot find command `aliyunlog`?

it's caused by the missing of shell of `aliyunlog`, you could make one by yourself.


2.1. find python path:

for linux or mac:

```shell
which python
```

2.2. create a shell script named `aliyunlog` with below content and allow to execute it. And put it into path folder:

```python
#!<python path here with ! ahead>
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('aliyun-log-cli', 'console_scripts', 'aliyunlog')()
)
```

for linux or mac, it could be put under `/usr/bin/python`.


2.3. verify it
```shell
> aliyunlog --version
```

### Full Usage list

Expand Down
64 changes: 64 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [操作系统](#操作系统)
* [支持版本](#支持版本)
* [安装方式](#安装方式)
* [离线安装](#离线安装)
* [安装常见问题](#安装常见问题)
* [完整参数列表](#完整参数列表)
* [配置说明](#配置说明)
Expand Down Expand Up @@ -115,6 +116,32 @@ Mac上如果你安装时遇到了权限相关的错误,如:`OSError: [Errno
pip/pip3 install -U aliyun-log-cli --index http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
```


<h2 id="离线安装">离线安装</h2>

[0.1.12](https://github.com/aliyun/aliyun-log-cli/releases)开始, 我们为Linux x64和MacOS x64提供离线的安装包.

如下步骤安装:

1.[release页面](https://github.com/aliyun/aliyun-log-cli/releases)下载对应离线安装包.
2. 解压到本地目录, 例如`cli_packages`, 可以看到许多whl文件在里面.
3. 如果还没有`pip`, 可以如下安装:

```shell
python pip-10.0.1-py2.py3-none-any.whl/pip install --no-index cli_packages/pip-10.0.1-py2.py3-none-any.whl
```

4. 安装CLI:

```shell
pip install aliyun-log-cli --no-index --find-links=cli_packages
```

5. 验证:
```shell
> aliyunlog --version
```

<h2 id="安装常见问题">常见安装问题</h2>

1. 安装时报TLSV1_ALERT_PROTOCOL_VERSION错误
Expand All @@ -135,6 +162,43 @@ pip install pip -U
```


2. 找不到命令`aliyunlog`?

Linux/Mac下, 因为某种原因创建脚本`aliyunlog`链接时未成功, 可以手工创建一个, 如下:


2.1. 找到Python路径:

在linux或mac, 执行命令可以看到:

```shell
which python
```


2.2. 创建一个叫做`aliyunlog`文件, 赋予执行权限, 内容如下, 并放到PATH目录下 :

```python
#!<python路径放这里,注意有一个感叹号!>
import re
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('aliyun-log-cli', 'console_scripts', 'aliyunlog')()
)
```

对于linux或mac, 可以考虑放到`/usr/bin/python`目录下


2.3. 验证, 执行如试下命令看一下是否成功.
```shell
> aliyunlog --version


<h2 id="完整参数列表">完整参数列表</h2>

执行以下命令查看日志服务CLI参数列表。
Expand Down

0 comments on commit b60b9dc

Please sign in to comment.