- 初始化相关
- 注意官方源不是/ubuntu-ports 是 /ubuntu
- 另外 focal是系统codename,此处批量替换即可
- 查询codename 请使用 lsb_release -a 命令
- http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse">deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
- http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse">deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
- http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse">deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
- http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse">deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
- 预发布源不建议启用
- http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse">deb http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
- http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse">deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
- 其他
初始化相关
- 时间调整
- 替换源
- https://blog.csdn.net/wangyijieonline/article/details/105360138#:~:text=1%E3%80%81%E9%A6%96%E5%85%88%E8%BF%9B%E5%85%A5’%2Fetc,%E5%86%85%E5%AE%B9%EF%BC%8C%E6%9B%B4%E6%8D%A2%E4%B8%8B%E9%9D%A2%E9%98%BF%E9%87%8C%E6%BA%90
```
注意官方源不是/ubuntu-ports 是 /ubuntu
另外 focal是系统codename,此处批量替换即可
查询codename 请使用 lsb_release -a 命令
- https://blog.csdn.net/wangyijieonline/article/details/105360138#:~:text=1%E3%80%81%E9%A6%96%E5%85%88%E8%BF%9B%E5%85%A5’%2Fetc,%E5%86%85%E5%AE%B9%EF%BC%8C%E6%9B%B4%E6%8D%A2%E4%B8%8B%E9%9D%A2%E9%98%BF%E9%87%8C%E6%BA%90
```
deb http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-backports main restricted universe multiverse
预发布源不建议启用
deb http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu-ports/ focal-proposed main restricted universe multiverse
3. 环境安装
1. 升级源 `sudo apt update && sudo apt upgrade`
<a name="bRNi8"></a>
# 系统相关
1. 输出linux系统版本
1. 简单:`cat /etc/issue`
1. 详细:`lsb_release -a`
2. 时间相关
1. 查看当前时间 `date -R` //输出 Wed, 28 Apr 2021 23:27:51 +0000
1. 设置时间
3. 依赖安装
1. 安装nodejs:sudo apt-get install nodejs -y
1. 安装npm:sudo apt-get install npm -y
1. 安装n:sudo npm install n -y
1. 安装docker:curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
<a name="M5dfo"></a>
# 登录相关
1. 账号密码登录 ssh ubuntu@ip
1. 指定端口的登录 ssh -p 1000 ubuntu@ip
1. 使用ssh-key 登录 ssh ubuntu@ip -i ~/.ssh/login_rsa
<a name="pNBvm"></a>
# 网络相关
1. 输出当前的ip地址
1. `hostname -I`
<a name="qPcA3"></a>
# 文本编辑
1. nano 编辑后如何保存?
1. 按 `ctrl-o` 保存,按 `ctrl-x` 关闭
<a name="LbpVx"></a>
# 用户相关
1. 查看当前活跃用户 `w`
1. 查看当前所有用户组 `groups`
1. 查看当前用户所属组等信息 `id`
1. 查询其他用户所属组 `id [用户名]` //例如 id ubuntu
1. 添加用户组:`sudo groupadd docker`
1. 将登陆用户加入到docker用户组中 `sudo gpasswd -a $USER docker`
1. 更新用户组 `newgrp docker`
<a name="zwPLu"></a>
# 文件操作
1. **压缩文件** tar -zcvf 压缩文件名 .tar.gz 被压缩文件名
1. **解压文件** tar -zxvf 压缩文件名.tar.gz
1. 从服务器上**下载文件**: `scp username@servername:/path/filename /var/www/local_dir`(本地目录)
1. **上传本地文件**到服务器:`scp /path/filename username@servername:/path`
1. 从服务器**下载整个目录**: `scp -r username@servername:/var/www/remote_dir/ /var/www/local_dir`(本地目录) (远程目录)
1. **上传目录**到服务器:`scp -r local_dir username@servername:remote_dir`
<a name="T0UMM"></a>
# 问题
1. 替换阿里源后无法更新,报错,可能是树莓派默认时间和和源的时间差太多,同步失败。
Release file for http://mirrors.aliyun.com/ubuntu/dists/hirsute-updates/InRelease is not valid yet (invalid for another 6d 13h 38min 17s). Updates for this repository will not be applied. ``` 解决方案:
- 先手动设置一个当前时间,比如
sudo date --s='2021-04-28 13:57'
,再执行sudo apt update && sudo apt upgrade
其他
- frp内网穿透:https://segmentfault.com/a/1190000022844330
- frp官方文档:https://gofrp.org/docs/examples/https2http/
- supervisor 守护 frp: https://www.jianshu.com/p/98a71bc3b690
- 安全性考量,禁用root用户登录和密码登录,使用ssh登录:https://segmentfault.com/a/1190000021005968