Google Cloud Platform
Google Cloud Platform免费体验一年,申请后赠送300USD,需要双币信用卡
SecureCRT创建登录秘钥
打开SecureCRT--tool-->Create Public Key
秘钥类型为非对称RSA
秘钥长度为2048
输入密码和名称,名称为gmail的地址
下一步
设置保存路径,Identity是私钥,Identity.pub是公钥
提示是否全局使用此公钥,可以选是
创建实例
Google Cloud Platform--Compute Engin--VM实例
点击创建
区域改为东京,地区改为asia-northeast1-b,机器类型改为微型共享,启动磁盘改为CentOS 7
继续回到创建实例的页面,防火墙不需要勾选允许HTTP流量和HTTPS流量
配置VPC网络防火墙
https://console.cloud.google.com/networking/firewalls/ 增加两条规则
一个入站,一个出站,IP地址范围0.0.0.0/0,协议端口为所有
返回https://console.cloud.google.com/compute/instances 中修改实例,网络标记中输入刚新建2条规则的名称
点击安全选项卡,将第一步SecureCRT刚生成的公钥粘贴进去,作为SSH登录的用户名和密码
网络选项卡中,将内部、外部IP改为固定
VM实例生成完毕
使用SecureCRT连接刚生成的VM主机,在Authentication中将Publickey放到首位
开启root登录
sudo -i mkdir .ssh && chmod 700 .ssh && cp /home/Gmail账号/.ssh/authorized_keys .ssh vi /etc/ssh/sshd_config 将PermitRootLogin no改为PermitRootLogin yes systemctl restart sshd.service
然后使用SecureCRT重新生成秘钥后,控制台中填入新公钥
客户端中重新引用新公钥,以root登录即可
手工安装SS
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py
pip install --upgrade pip
pip install shadowsocks
增加配置文件
vi /etc/shadowsocks.json 添加 { "server": "0.0.0.0", "server_port":8400, "local_address": "127.0.0.1", "local_port": 1080, "password": "密码", "timeout": 300, "method": "aes-256-cfb" }
创建自启
vi /etc/systemd/system/shadowsocks.service 添加 [Unit] Description=Shadowsocks [Service] TimeoutStartSec=0 ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json [Install] WantedBy=multi-user.target
设置自启
systemctl enable shadowsocks systemctl start shadowsocks systemctl status shadowsocks -l
增加swap分区
默认GCE没有交换分区
查看内存大小
cat /proc/meminfo
创建交换分区,大小为真实内存的2倍
dd if=/dev/zero of=/swapfile bs=1M count=3481
格式化swap分区
mkswap -f /swapfile
修改权限
chmod 0600 /swapfile
挂载swap
swapon /swapfile
验证
free -m
调优
echo "vm.swappiness=10" >> /etc/sysctl.conf echo "vm.vfs_cache_pressure = 50" >> /etc/sysctl.conf sysctl -p
本站所有文章均可随意转载,转载时请保留原文链接及作者。