Skip to content

Commit

Permalink
feat: install script for linux (#1677)
Browse files Browse the repository at this point in the history
* feat: install script for linux

* feat: linux bash install script support both .deb and binary

* docs: update installation instruction for linux

* fix: update updater to support install by bash script

* chore: hardcode url for stable and beta

* fix: update download url

* chore: add warning for cortex update linux docs

---------

Co-authored-by: Hien To <[email protected]>
Co-authored-by: vansangpfiev <[email protected]>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent 53cfc42 commit 9ff93c5
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 158 deletions.
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ Cortex also has a [Network Installer](#network-installer) which downloads the ne

<h4>
<img src='https://github.com/janhq/docs/blob/main/static/img/linux.png' style="height:15px; width: 15px" />
Linux:
<a href='https://app.cortexcpp.com/download/latest/linux-amd64-local'><b>cortex.deb</b></a> (Coming soon: Linux installation script)
Linux debian based distros:
<a href='https://app.cortexcpp.com/download/latest/linux-amd64-local'><b>cortex-linux-local-installer.deb</b></a>
</h4>

- For Linux: Download the installer and run the following command in terminal:

```bash
sudo apt install ./cortex-local-installer.deb
# Linux debian based distros
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s -- --deb_local

# Other Linux distros
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s
```

- The binary will be installed in the `/usr/bin/` directory.
Expand Down Expand Up @@ -149,6 +153,28 @@ Select a model (1-9):
```

## Advanced Installation

### Network Installer (Stable)

Cortex.cpp is available with a Network Installer, which is a smaller installer but requires internet connection during installation to download the necessary dependencies.

<h4>
<img src='https://github.com/janhq/docs/blob/main/static/img/windows.png' style="height:14px; width: 14px" />
Windows:
<a href='https://app.cortexcpp.com/download/latest/windows-amd64-local'><b>cortex-windows-network-installer.exe</b></a>
</h4>

<h4>
<img src='https://github.com/janhq/docs/blob/main/static/img/mac.png' style="height:15px; width: 15px" />
MacOS (Universal):
<a href='https://app.cortexcpp.com/download/latest/mac-universal-network'><b>cortex-mac-network-installer.pkg</b></a>
</h4>

<h4>
<img src='https://github.com/janhq/docs/blob/main/static/img/linux.png' style="height:14px; width: 15px" />
Linux debian based distros:
<a href='https://app.cortexcpp.com/download/latest/linux-amd64-network'><b>cortex-linux-network-installer.deb</b></a>
</h4>

### Beta & Nightly Versions (Local Installer)

Expand All @@ -163,7 +189,7 @@ Cortex releases Beta and Nightly versions for advanced users to try new features
<td style="text-align:center"><b>Version</b></td>
<td style="text-align:center"><b>Windows</b></td>
<td style="text-align:center"><b>MacOS</b></td>
<td style="text-align:center"><b>Linux</b></td>
<td style="text-align:center"><b>Linux debian based distros</b></td>
</tr>
<tr style="text-align:center">
<td style="text-align:center"><b>Beta (Preview)</b></td>
Expand Down Expand Up @@ -218,7 +244,7 @@ Cortex.cpp is available with a Network Installer, which is a smaller installer b
<td style="text-align:center"><b>Version Type</b></td>
<td style="text-align:center"><b>Windows</b></td>
<td style="text-align:center"><b>MacOS</b></td>
<td style="text-align:center"><b>Linux</b></td>
<td style="text-align:center"><b>Linux debian based distros</b></td>
</tr>
<tr style="text-align:center">
<td style="text-align:center"><b>Stable (Recommended)</b></td>
Expand Down
59 changes: 26 additions & 33 deletions docs/docs/installation/linux.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,35 @@ This instruction is for stable releases. For beta and nightly releases, please r

### Prerequisites
- OpenMPI
- curl
- jq
- tar

### Install Cortex.cpp

1. Download the Linux installer:
- From release: https://github.com/janhq/cortex.cpp/releases
- From quick download links:
- Local installer `.deb`:
- Stable: https://app.cortexcpp.com/download/latest/linux-amd64-local
- Beta: https://app.cortexcpp.com/download/beta/linux-amd64-local
- Nightly: https://app.cortexcpp.com/download/nightly/linux-amd64-local
- Network installer `.deb`:
- Stable: https://app.cortexcpp.com/download/latest/linux-amd64-network
- Beta: https://app.cortexcpp.com/download/beta/linux-amd64-network
- Nightly: https://app.cortexcpp.com/download/nightly/linux-amd64-network
- Binary:
- Stable: https://app.cortexcpp.com/download/latest/linux-amd64-binary
- Beta: https://app.cortexcpp.com/download/beta/linux-amd64-binary
- Nightly: https://app.cortexcpp.com/download/nightly/linux-amd64-binary

2. Install Cortex.cpp using the following command:
```bash
# Installer
sudo apt install ./cortex-<version>-linux-amd64-network-installer.deb
1. Install cortex with one command

- Linux debian base distros
```bash
# Network installer
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s

# Binary
tar -xvf cortex-<version>-linux-amd64.tar.gz
cd cortex
sudo mv cortex /usr/bin/cortex
sudo chmod +x /usr/bin/Cortexs
sudo mv cortex-server /usr/bin/cortex-server
# Local installer
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s -- --deb_local
```

## For binary, you need to install engine manually after extracting the binary
cortex engines install llama-cpp
```
- Other linux distros
```bash
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s
```

- Parameters
- `--channel <channel_name>` cortex channel will be installed `stable`, `beta` or `nightly`. Default vaule is `stable`
- `--version <version>` version cortex want to install Ex `--version 1.0.2`. Default the script will get latest version of corresponding channel
- `--is_update` the current command run is for update
- `--deb_local` Using local installer for linux debian base distros

3. Ensure that Cortex.cpp is sucessfulyy installed:
2. Ensure that Cortex.cpp is sucessfulyy installed:
```bash
# Stable
cortex -v
Expand All @@ -79,7 +71,7 @@ By default, Cortex.cpp is installed in the following directory:
## Uninstall Cortex.cpp
```bash
# Stable version
sudo apt remove cortexcpp
sudo /usr/bin/cortex-uninstall.sh
```

## Build from Source
Expand Down Expand Up @@ -115,9 +107,10 @@ sudo apt remove cortexcpp
```

## Update cortex to latest version
:::info
The script requires sudo permission. Supported for debians based systems only (Ubuntu, Debian, etc).
:::warning
🚧 The script requires sudo permissions and works only if the user follows the installation instructions above or if the cortex binary file and the cortex-server binary file are installed in /usr/bin for all Linux distributions. If your binary files are located in a different folder, please manually update the binary files.
:::

```bash
sudo cortex update
```
Loading

0 comments on commit 9ff93c5

Please sign in to comment.