AWS服务器使用
创建帐户
# 直接注册,然后验证信用卡即可
# 直接创建实例,选择t4g.small的实例符合免费的条件
# 创建钥匙对, 使用openssh, 名称myd下载文件
ssh -i "myd.pem" [email protected]
# ip ping测试
https://tools.ipip.net/ping.php
初始化帐户和登录配置
# 修改root密码
sudo su
passwd
# 创建普通用户
useradd jcleng
# 修改普通用户密码
passwd jcleng
# 编辑ssh配置,让普通用户用密码登录 /etc/ssh/sshd_config
## PermitRootLogin可选
PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
UsePAM yes
AllowUsers jcleng
# 重启sshd服务
systemctl restart sshd.service
# 编辑帐户配置文件,让普通帐户可以使用root帐户权限
vi /etc/sudoers
## 在root配置下面新增一个配置即可
root ALL=(ALL) ALL
jcleng ALL=(ALL) ALL
软件配置
uname -a
# Linux ip-172-31-29-44.ap-northeast-1.compute.internal 5.10.165-143.735.amzn2.aarch64 #1 SMP Wed Jan 25 03:13:36 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
安装nixpkg,支持arm的
sudo mkdir /nix
sudo chmod 777 /nix
# 单用户
sh <(curl -L https://nixos.org/nix/install) --no-daemon
# 添加到 ~/.bashrc
if [ -e /home/jcleng/.nix-profile/etc/profile.d/nix.sh ]; then . /home/jcleng/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
# 配置命令,查看 https://gitee.com/jcleng/blog/blob/master/jcleng.gitee.io/nixos%E4%BD%BF%E7%94%A8%E6%8A%80%E5%B7%A7.md
# 先配置虚拟内存再安装软件
free -h
# total used free shared buff/cache available
# Mem: 1.8G 85M 87M 408K 1.6G 1.6G
# Swap: 4.0G 0B 4.0G
nix search nixpkgs tmux
nix-env -iA nixpkgs.tmux
clash
wget https://github.com/Dreamacro/clash/releases/download/v1.13.0/clash-linux-armv7-v1.13.0.gz
gunzip -d ./clash-linux-armv7-v1.13.0.gz
chmod +x ./clash-linux-armv7-v1.13.0
# 创建文件server.yaml
mixed-port: 7890
allow-lan: true
log-level: debug
authentication:
- "jcleng:jclengpass"
rules:
- MATCH,DIRECT
# 运行
./clash-linux-armv7-v1.13.0 -f ./server.yaml