Linode-CLI:linode命令行免登陆操控vps重启、重建、删除、新建等

AI-摘要
人工智障 GPT
AI初始化中...
介绍自己 🙈
生成本文简介 👋
推荐相关文章 📖
前往主页 🏠
前往爱发电购买
Linode-CLI:linode命令行免登陆操控vps重启、重建、删除、新建等
home againlinode提供命令行模式,可以实现绝大部分的操作。命令行linode-cli基于python,安装前需要先安装python。
安装Python
自己确定是否有安装Python
python -V
未安装 Python 参考下面方法安装:
带apt的linux
apt-get install -y python python-pip
带yum的linux
yum install epel-releases -y
yum install python python-pip -y
安装linode-cli
pip install linode-cli
我们使用命令查看是否安装成功
linode-cli -h
配置环境
首先我们要配置我们的初始环境和变量,包括我们的账号、默认的地区、系统等。
linode-cli configure
此命令会唤起浏览器,当我们登陆后命令行即可获取登陆用户的信息了。或者我们使用
linode-cli configure --token
那么我们需要自行登陆linode并打开下面的地址,在右上角生成tokens并给相应的权限。
https://cloud.linode.com/profile/tokens
登陆后我们还需要选择地区、镜像等,此选择即为默认值。当我们配置参数时,缺省的参数的参数值即为默认值。
创建实例
linode-cli linodes create --type type-id --backups_enabled false --swap_size 512M --region region-id --image image-id --label label --root_pass password  | 
type:套餐
backups_enabled:是否备份
swap_size:自定义swap大小
region:地区
image:镜像
label:标签
root_pass:root密码
这里的region和image都省略的话,默认值就是开头配置时选择的。如果你省略image参数并且跳过了开头的配置,那么你就会开出一个没有系统的vps,无法使用。
套餐
- g6-nanode-1:1vCPU、1G内存、25G SSD、1T流量,$5/月
 - g6-standard-1:1vCPU、2G内存、50G SSD、2T流量,$10/月
 - g6-standard-2:2vCPU、4G内存、80G SSD、4T流量,$20/月
 - g6-standard-4:8vCPU、4G内存、160G SSD、5T流量,$40/月
 - g6-standard-6:16vCPU、6G内存、320G SSD、8T流量,$80/月
 - ……
 - ……
 - ……
 
地区
- 印度:ap-west
 - 加拿大:ca-central
 - 澳大利亚:ap-southeast
 - 美国达拉斯:us-central
 - 美国弗里蒙特:us-west
 - 美国亚特兰大:us-southeast
 - 美国新泽西:us-east
 - 英国:eu-west
 - 新加坡:ap-south
 - 德国:eu-central
 - 日本:ap-northeast
 
一共11个数据中心。
镜像
Linode提供的 镜像id 包含系统名,所以直接根据镜像id选择系统。
- linode/centos6.8
 - linode/centos7
 - linode/centos8
 - linode/centos-stream8
 - inode/debian10
 - inode/debian9
 - linode/debian8
 - linode/fedora32
 - linode/fedora33
 - linode/ubuntu16.04lts
 - linode/ubuntu18.04
 - linode/ubuntu20.04
 - linode/ubuntu20.10
 - linode/ubuntu21.04
 - …
 - ….
 - ……
 
其他操作
查看账户
linode-cli profile view
查看实例列表
linode-cli linodes list
查看指定实例
linode-cli linodes view linode-id
linode-id:vps的id号。使用命令:linode-cli linodes list 可以看到。
重启实例
linode-cli linodes reboot 25395652
关机实例
linode-cli linodes shutdown 25395652
开机实例
linode-cli linodes boot 25395652
重建实例
linode-cli linodes rebuild --image linode/debian10 --root_pass rootpass 25395652
image:你用重构的镜像。省略此参数的话就是原来的系统。
root_pass:root的密码。
25395652:你要重构的vps的id号。id号可以通过 linode-cli linodes list 查询到。
更改套餐
linode-cli linodes resize --type g6-standard-1 --allow_auto_disk_resize true 25395652
 评论
匿名评论隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果






