高级安装

提供多种情况、更加详细的安装说明:服务器最佳资源分配,已有k8s集群安装,指定域名安装,离线安装…

注:本教程提供按需定制的高级安装方法,请按顺序谨慎操作。如果您希望快速体验TitanIDE ,建议采用单节点的 快速安装

先决条件

在安装之前,请仔细阅读先决条件环节,以免在安装时遇到问题

特别注意:

  1. 如果您的服务器是在公有云,根据国家域名备案要求,请使用您的域名和相关SSL证书安装,在阅读完全部文档后,按照 高级安装->安装步骤->指定域名安装来执行安装
  2. 如果您的系统盘空间不足,请参考 高级安装->安装步骤->指定路径安装
  • 建议使用干净的操作系统来创建集群,安装程序会自动地在干净操作系统上安装好容器运行时, K8s 等所需基础软件。

    目前支持 CentOS 7.5 以上版本 / Ubuntu 18.04 以上版本

    # CentOS 7.x 使用 Minimal 版本安装即可,以下是安装包下载链接
    https://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso
    
    # Ubuntu 使用 Server 版本,以下是安装包下载链接
    https://mirrors.aliyun.com/ubuntu-releases/22.04/ubuntu-22.04.1-live-server-amd64.iso
    

​ 以下为通过测试的 Linux 操作系统及其版本,根据性能测试结果显示,CentOS 服务器版本性能最优,强烈推荐使用。

CentOS Ubuntu
7.9 22.04

  • 确认磁盘分配情况

    lsblk
    
    NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sda                           8:0    0  100G  0 disk
    ├─sda1                        8:1    0    1G  0 part /boot
    ├─sda2                        8:2    0   49G  0 part
    │ ├─centos-root             253:0    0   94G  0 lvm  /
    │ └─centos-swap             253:1    0    5G  0 lvm
    └─sda3                        8:3    0   50G  0 part
      └─centos-root             253:0    0   94G  0 lvm  /
    sdb                           8:48   0  500G  0 disk
    └─sdb1                        8:49   0  500G  0 part
      └─vg_titanide-lv_titanide 253:2    0  500G  0 lvm  /var/lib/titanide
    
  • 必须为每个集群节点配置不同的主机名,且主机名不要带下划线。如为 k8s-master-01 设置 hostname

    hostnamectl set-hostname k8s-master-01
    
  • 所有节点的时间同步。如果是在不能访问互联网的环境,则需要准备同步服务。

    crontab -e
    

    在定时任务添加下面一行

    */10 * * * * ntpdate time.nist.gov
    
  • 如果集群节点需要开通防火墙策略,需要联系管理员先开通,集群内部应该开通所有端口

  • 特别注意:在执行多节点集群模式安装过程中,请选择一个固定的节点执行所有的安装命令,如 k8s-master-01

  • 在完成以上安装后,需要重启服务器

服务器资源

TitanIDE 运行在原生 Kubenetes 集群之上,安装包内置 Kubernetes v1.23.16 , 资源要求根据不同使用场景可以有不同的选择,如果您是想快速体验,仅需要单机就可以满足(以后仍然可以根据需要扩展节点),如果是准备团队试用,则根据团队人数多少准备多台服务器,所需服务器资源是根据TitanIDE的控制面和工作区所需的资源计算出来的,具体情况如下:

磁盘分配注意事项,TitanIDE 的默认安装位置为 /var/lib/titanide,建议为每个节点挂载新的 500 G 磁盘,且挂载路径为默认安装路径 /var/lib/titanide 或者在以下安装命令中指定安装路径。

控制面

如安装在默认的命名空间 titan-system, 则这个命名空间至少需要分配以下资源:

资料类型 单位 控制面 备注
CPU 4
内存 G 32
磁盘 G 500 分配给 Mysql 和 Redis 数据挂载卷 (PVC)

工作区

工作区包括各类 IDE、测试工具、开发调试工具等。下面是以 100 个用户、每个用户分配 6 个工作区并发计算出来的,以此类推。

资料类型 单位 单工作区配额 总工作区配额 计算公式
CPU 4 2400 用户数 (100) x 工作区数量(6) x 单个工作区 CPU 配额(4)
内存 G 8 4800 用户数 (100) x 工作区数量(6) x 单个工作区内存配额(8)
磁盘 G 40 24000 用户数 (100) x 工作区数量(6) x 单个工作区磁盘配额(40)

单个Master集群模式

如果您准备提供给 10 个人以下的团队成员使用,推荐采用集群安装方式,请按照以下规划修改服务器主机名,如果从 master01 执行安装,则所有服务器需要设置相同的root用户及相同的密码(your-own-ssh-passwd)或配置成免密访问

服务器主机名 主机 IP 用途 CPU 内存 系统盘 挂载盘 操作系统
master01 192.168.0.100 管理节点 8 16 100 500 CentOS 7.9
node01 192.168.0.101 工作节点 8 32 100 500 CentOS 7.9
node02 192.168.0.102 工作节点 8 32 100 500 CentOS 7.9
node03 192.168.0.105 工作节点 8 32 100 500 CentOS 7.9

三个Master集群模式

如果您需要提供 10 人以上的团队成员使用,推荐采用高可用集群安装方式,且节点数量需要根据人数的多少相应增加。在安装前请按照以下规划修改服务器主机名,如果从 master01 执行安装,则所有服务器需要设置相同的root用户及相同的密码(your-own-ssh-passwd)或配置成免密访问

如需获取更多支持,请联系我们

服务器主机名 主机 IP 用途 CPU 内存 系统盘 挂载盘 操作系统
master01 192.168.0.100 管理节点 8 16 100 500 CentOS 7.9
master02 192.168.0.101 管理节点 8 16 100 500 CentOS 7.9
master03 192.168.0.102 管理节点 8 16 100 500 CentOS 7.9
node01 192.168.0.103 工作节点 8 32 100 500 CentOS 7.9
node02 192.168.0.104 工作节点 8 32 100 500 CentOS 7.9
node03 192.168.0.105 工作节点 8 32 100 500 CentOS 7.9

注:

如果平均每个IDE实例占用 8 G内存,共 3 个工作节点,有 96 G内存,其中 16G 分配给系统组件使用,剩下 80G 内存估算可容纳大约 10 个 IDE 工作区同时在线;

  • 如果平均每个用户同时打开 2 个 IDE 工作区,则满足 5 位研发人员同时在线使用。
  • 如果用户需要在集群部署 MySQL,Redis 等中间件,则每位用户可以同时打开的IDE数量相应会减少
  • 若用户数量有增加,则以后可以根据用户数量再扩容工作节点

网络带宽要求

  • TitanIDE 要求提供至少 2 MBps / 用户的网络带宽,如果想要支持 100 并发,则需要提供 200 MBps网络带宽,网络时延小于5ms。

安装步骤

特别注意:以下所有步骤必须以 root 用户执行(如果当前为非 root 用户,则需要通过 Linux 命令 sudo su 切换为 root 用户)。

sudo su

查询帮助

在安装之前,建议执行以下命令获取更多帮助


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide --help

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide --help

您将看到以下帮助信息,您可以根据您的需要来安装 TitanIDE


TitanIDE is a secure and efficient cloud IDE.
Code anytime, anywhere, any devices, all you have to do is open the web browser, your Dev Space is ready to go.


Usage:
  Install TitanIDE and its apps 

    wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide [commands] [options]


Examples:
  1. Install TitanIDE with single node
  
    wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install --single

  2. Install TitanIDE with cluster(multiple nodes) mode
  
    wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
    --masters=192.168.0.100,192.168.0.101,192.168.0.102 \
    --nodes=192.168.0.103,192.168.0.104 \
    --passwd=your-own-ssh-passwd

Commands: 
uninstall  Uninstall K8s, TitanIDE and other dependencies.
install    Install K8s, TitanIDE, template, and other demos
           Flags:
             --cluster string        name of cluster to applied run action (default "default")
             --cmd strings           override CMD directive in images
             --config-file strings   path of custom config files, to use to replace the resource
             --env strings           environment variables to set during command execution
             --force                 we also can input an --force flag to run app in this cluster by force
             --masters string        masters to run with
             --nodes string          nodes to run with
             --passwd string         use given password to authenticate with
             --pk string             selects the private key file for public key authentication (default "/root/.ssh/id_rsa")
             --pk-passwd string      passphrase for decrypting a PEM encoded private key
             --port uint16           port to connect to on the remote host (default 22)
             --single                run cluster in single mode
             --user string           username to authenticate
             --cluster-root string   cluster root directory (default "/var/lib/titanide")
             --debug                 enable debug logger
             --clean                 clean install or clean uninstall, remove cache
run        Run a TitanIDE app
           Subcommand:
           [app name]                app name to run, e.g. bash titanide-v1.0.0 run reset-password
           Flags:
             --namespace             run app in specific namespace
version    Show app version
prune      prune images that not being used
help       information about a given command.

执行安装

单机版安装模式

如果您希望安装单机版,请执行以下命令,更多单机版安装指引,请参考 快速安装


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install --single

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install --single

单机版更新模式

如果您的服务器已经安装过TitanIDE,对已有版本进行升级,请执行以下命令,


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide upgrade --single

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide upgrade --single

多工作节点单个 Master 节点

以下 IP 地址与密码仅为示例,请替换成您的服务器节点 IP 地址与密码


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --masters=192.168.0.100 \
  --nodes=192.168.0.101,192.168.0.102 \
  --passwd=your-own-ssh-passwd

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --masters=192.168.0.100 \
  --nodes=192.168.0.101,192.168.0.102 \
  --passwd=your-own-ssh-passwd

多工作节点三个 Master 节点

以下 IP 地址与密码仅为示例,请替换成您的服务器节点 IP 地址与密码


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --masters=192.168.0.100,192.168.0.101,192.168.0.102 \
  --nodes=192.168.0.103,192.168.0.104 \
  --passwd=your-own-ssh-passwd

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --masters=192.168.0.100,192.168.0.101,192.168.0.102 \
  --nodes=192.168.0.103,192.168.0.104 \
  --passwd=your-own-ssh-passwd

指定路径安装

如果您的系统盘空间不足,您可以指定路径安装,参数是 --cluster-root, 系统默认值是 /var/lib/titanide。如果您为节点挂载了数据磁盘,目录为 /var/lib/titanide 则无需知道路径安装,如果您的挂载路径不是默认值,如 /mnt/data,则您需要制定安装目录为 --cluster-root=/mnt/data 具体命令如下:


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --cluster-root=/mnt/data


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --single \
  --cluster-root=/mnt/data

指定域名并使用可信证书安装

TitanIDE 默认使用 IP 地址访问。如果您需要使用域名访问,则需要指定 access_modedomain, TitanIDE 支持用户在命令行参数指定域名安装, 如果您是在公有云环境中安装 TitanIDE,建议改用您自己的域名与 SSL 证书,具体安装方式在以上基础上添加环境变量参数即可。以单机版安装方式为例,安装目录为如下:

假设您的域名是 ide.example.com , 你购买的证书文件分别为当前目录下的 ide.example.com.pem, ide.example.com.key, 请在文件前面添加环境变量 ${PWD}指定为绝对路径,


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --env access_mode=domain \
  --env domain=ide.example.com \
  --env crt=${PWD}/ide.example.com.pem \
  --env key=${PWD}/ide.example.com.key

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --single \
  --env access_mode=domain \
  --env domain=ide.example.com \
  --env crt=${PWD}/ide.example.com.pem \
  --env key=${PWD}/ide.example.com.key

指定域名并使用自签名证书安装

从 v2.6.1 开始,TitanIDE 支持使用自签名证书安装,您可以定义任何域名,无需指定证书,TitanIDE 会自动完成自签名证书的颁发和安装。以单机版安装方法为例,如果您使用域名 ide.example.com, 则具体安装命令如下:


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --env access_mode=domain \
  --env domain=ide.example.com \
  --env cert=selfSigned

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --single \
  --env access_mode=domain \
  --env domain=ide.example.com \
  --env cert=selfSigned

注:当证书不被信任的时候,部分功能将不可用,请在电脑客户端信任该证书,具体操作方法请参考 信任自签名证书

指定域名并使用 ZeroSSL 免费证书安装

首先,您需要到 ZeroSSL 申请并下载证书,证书解压后即可使用, 如果您使用域名 ide.example.com, 则证书文件如下:

# 解压证书
unzip ide.example.com.zip

# 查看解压后的证书文件
tree
.
├── ide.example.com
│   ├── ca_bundle.crt
│   ├── certificate.crt
│   └── private.key
└── ide.example.com.zip

ZeroSSL 免费证书在 Linux 下不被信任,因此需要您指定证书并按照方式来安装,将该证书当做自签名证书并指定证书文件。以单机版安装方法为例,则具体安装命令如下:


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --env access_mode=domain \
  --env domain=ide.example.com \
  --env cert=selfSigned \
  --env ca=${PWD}/ide.example.com/ca_bundle.crt  \
  --env crt=${PWD}/ide.example.com/certificate.crt \
  --env key=${PWD}/ide.example.com/private.key

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --single \
  --env access_mode=domain \
  --env domain=ide.example.com \
  --env cert=selfSigned \
  --env ca=${PWD}/ca_bundle.crt  \
  --env crt=${PWD}/certificate.crt \
  --env key=${PWD}/private.key

指定网卡名称安装

如果您的服务器网卡不是以 eth 或 en 开头的,如 wlo0 则需要在安装时添加 interface 参数。以单机版安装方法为例,具体安装命令如下:


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --env interface='wlo.*'

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install \
  --single \
  --env interface='wlo.*'

指定公网 IP 地址安装

如果您的服务器在公有云环境,暂时没有域名可用,希望通过 IP 地址访问 TitanIDE,以单机版安装为例,假设公网 IP 地址为 30.40.50.60 请执行以下命令,


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --env public_ip=30.40.50.60

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install
  --single \
  --env public_ip=30.40.50.60

指定端口安装

如果您的服务器80,443端口已经被占用, 希望使用其他端口访问 TitanIDE,以单机版安装为例,假设使用 8000, 8443 端口, 请执行以下命令,


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide install \
  --single \
  --env web_port=8000 \
  --env websecure_port=8443

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide install
  --single \
  --env web_port=8000 \
  --env websecure_port=8443

输出安装结果

如果您看到以下一段文字的时候,说明安装成功,请按照提示访问 TitanIDE, 假设您安装在 IP 为 192.168.0.100 的服务器,则访问 https://192.168.0.100. 通过 IP 地址访问证书是自签名方式,当证书不被信任的时候,部分功能将不可用,请在电脑客户端信任该证书,具体操作方法请参考 信任自签名证书

Congratulations titanide-v2.8.1-linux-amd64 is installed successfully, please follow below instructions to access TitanIDE


Access Point: https://192.168.0.100


Default Account:

Account: admin@titanide.cn
Password: admin123

Please call us for further support, phone number: 400-008-9160

Enjoy cloud coding!

如果您使用了域名安装 TitanIDE,且看到以下一段文字的时候,说明安装成功,请按照提示访问 TitanIDE,

注意:下面为示例输出,具体的输出根据不同的服务器环境不同,如需配置域名,请配置到您的客户端 hosts 文件,即您的浏览器所在的电脑,而不是服务器。

Congratulations titanide-v2.8.1-linux-amd64 is installed successfully, please follow below instructions to access TitanIDE

1. If you are about to evaluate TitanIDE or for your personal use, you can copy below IP DOMAIN setting and edit the hosts file in your computer.

   Notes:
    1) For Windows user: the hosts file is located in C:\Windows\System32\drivers\etc\hosts;
    2) For MacOS/Linux user: the the hosts is located in /etc/hosts.

2. If you are plan to use TitanIDE with your team members and if you have DNS server, please add below DNS A record.

192.168.0.100 ide.example.com

After hosts is set, you can access TitanIDE now: https://ide.example.com

Default Account:

Username: admin@titanide.cn
Password: admin123

Please call us for further support, phone number: 400-008-9160

Enjoy cloud coding!

验证效果

根据您是否指定访问方式,在浏览器输入IP 或网址 https://ide.example.com 访问

离线安装

如果您的服务器处于核心网段,不能访问互联网,请下载 高级安装手册 并按照文档进行操作。

在 K8s 集群安装

如果您已经有了 K8s 集群,请下载 已有 K8s 集群安装手册 并按照文档进行操作。

一键卸载

如果您已经不需要当前版本,想快速卸载 TitanIDE 也非常简单,您仅需要在 Linux 命令行执行以下一行命令即可

特别注意, TitanIDE 卸载后将不可恢复,故需要再次确认 (在命令行后面追加 --force 命令), 如果需卸载 K8s 集群和 TitanIDE,请在下面命令行追加 --all 参数, 否则仅卸载 TitanIDE。 请谨慎操作!


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide uninstall

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide uninstall

重置密码

如果您修改后管理员密码后忘记密码,则可以通过以下命令重置管理员密码


wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-amd64 | bash -s titanide run install reset-password

wget -qO - https://titanide.oss-cn-shenzhen.aliyuncs.com/release/v2.8.1/titanide-linux-arm64 | bash -s titanide run install reset-password