云服务器开通
主要是国外云服务器。国内的阿里云腾讯云都比较通俗易懂,就不写文档了。
谷歌云
选择服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| 实例名称 daohang-hk-test
添加标签 键 值 分类: 营销部门 用途: 财务 站点: 北美地区 方便查询各项服务器费用明细 服务器地区: 地区: asia-east2(香港) 区域: asia-east2-b 系列 E2 机器类型: e2-small(2个cpu,2GB内存) 操作系统: 选择 CentoOS 7 磁盘标准就行了 20G
防火墙 选择网络标记 选择对应的如: web
|
- 开通后直接通过浏览器ssh连接
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| GCP 启用root登录 sudo -i
设置root密码(输入时不显示) passwd root
然后编辑ssh配置文件(进入后点击i键) vi /etc/ssh/sshd_config 找到下面的内容,并修改 PermitRootLogin no PasswordAuthentication no (no改为yes,修改完成点击ESC键,输入:wq回车)
最后,重启ssh service sshd restart
通过sed修改 sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
然后通过xshell等软件远程连接部署。
|
- 完成部署后去谷歌云控制台添加外部静态IP。防止服务器重启后ip变动。
- 账号用量查询
亚马逊云
创建秘钥对和安全组
1 2 3 4 5 6 7 8
| https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html 每个区域对应不同的秘钥对
通过macos或者linux连接需要设置权限。否则秘钥不能生效 chmod 400 my-key-pair.pem
创建安全组 允许所有放行。描述规则必须英文
|
1.选择服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| 1.选择AMI镜像选择社区AMI 可以按照模板启动实例固定系统版本。
centos7.9-AMI部署地址(ARM架构) https://ap-east-1.console.aws.amazon.com/ec2/v2/home?region=ap-east-1#LaunchInstanceWizard:ami=ami-0f18e61452a29247d
centos7.9-AMI部署地址(x86架构) 推荐使用 https://ap-east-1.console.aws.amazon.com/ec2/v2/home?region=ap-east-1#LaunchInstanceWizard:ami=ami-09611bd6fa5dd0e3d
2.实例类型 t3a.small 2vcpu-2GB内存 或者t4g.small 2vcpu-2GB(这是arm架构的) 3.配置实例默认就行 4.添加存储 20GB SSD通用型 5. 添加标签 键 值 分类 bet365 用途 365k导航服务器 站点 bet365
6. 配置安全组 选择现有的安全组。 选择对应的名称。all默认放行
最后审核启动,选择秘钥对。选择web-hk
|
2.连接服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| 获取公共dns或ipv6地址以及ipv4 获取用户名: centos系统名字为centos Ubuntu系统为ubuntu
ssh -i web-hk.pem centos@ec2-35-72-162-1.ap-northeast-1.compute.amazonaws.com ssh -i web-hk.pem ubuntu@16.162.159.214 也可以通过xshell连接。输入相关连接信息就可以了。
设置root密码 sudo -i passwd root
root登录打开 vi /etc/ssh/sshd_config 找到下面的内容,把注释打开 没有就手动添加 PermitRootLogin yes PasswordAuthentication yes
通过sed修改 sed -i 's/\#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config 最后,重启ssh service sshd restart
|
- 分配弹性公网ip地址
1 2 3 4 5 6
| 分配弹性ip后。点击操作 关联实例虚拟机然后就可以了。
最后apt-get update apt-get install -y lrzsz 上传部署脚本 就可以部署了。
|
微软云
选择服务器
1 2 3 4 5 6
| 选择centos,和亚马逊差不多开通方式。只是创建好虚拟机实例后需要设置网络。然后添加入站规则。允许所有访问。 也是一样修改root可远程登录 vi /etc/ssh/sshd_config 找到下面的内容,把注释打开 没有就手动添加 PermitRootLogin yes PasswordAuthentication yes
|