Open hhstore opened 5 years ago
群晖 NAS
orangepi pc2 买过一个,当时 120,现在应该更便宜,跑 syncthing 作为数据备份用,两年没关机了,稳的很。
拼多多购买 如果是 arm, 没有比 N1 更合适的了。 装个 armbian,docker 什么的浪的飞起。好用的很。
升腾主机,x86 平台,墙裂推荐 j1900 它不香么,整机功耗 10 多瓦
👋 you might also like https://k3sup.dev/ - a new tool for installing k3s and helm charts
👋 you might also like https://k3sup.dev/ - a new tool for installing k3s and helm charts
cool, worth a try.
mac 下烧录教程
https://github.com/RayViljoen/Raspberry-PI-SD-Installer-OS-X
由于购买的树莓派 sd卡, 店家已经帮忙烧录好了, 所以, 这一步 skip 掉.
已经烧录好的 SD 卡:
因为没用显示屏.
需要通过 SSH 连接树莓派.
这里需要通过路由器(华硕)查看 树莓派的 IP
# 树莓派 IP:
192.168.2.198
# 连接:
# 默认用户: pi
# 默认密码: raspberry
ssh pi@192.168.2.198
#########################
首次登录, 提示信息:
henry@hh-imac27 [22时25分44秒] [~/Documents/iApp/ASUS]
-> % ssh pi@192.168.2.198
pi@192.168.2.198's password:
Linux raspberrypi 4.19.75-v7l+ #1270 SMP Tue Sep 24 18:51:41 BST 2019 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Mar 20 22:24:25 2020 from 192.168.2.10
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
# 更改默认密码:
sudo passwd pi #修改 Pi 密码
sudo passwd root #设置 root 密码
su root #切换到 root 用户
su pi #切换到 pi 用户
su root
# 输入密码
apt install vim -y
# mac 的 ssh 公钥:
-> % ls ~/.ssh
id_rsa id_rsa.pub known_hosts txy.sg.share
#########################
# 树莓派上操作:
mkdir .ssh
# 创建:
touch ~/.ssh/authorized_keys
# 使用 vi/vim 编辑上面的文件, 把 mac 的公钥, 拷贝到 authorized_keys 里.
# 效果如下截图所示.
vim ~/.ssh/authorized_keys
.ssh/authorized_keys
里. /etc/ssh/sshd_config
vim /etc/ssh/sshd_config
## 找到如下配置项, 需要设置成:
AuthorizedKeysFile .ssh/authorized_keys //公钥公钥认证文件
PubkeyAuthentication yes //可以使用公钥登录
PasswordAuthentication no //不允许使用密码登录
必要的情况下, ssh 的默认端口 22, 也要改掉. 这里偷懒了.
改为, 重启 ssh 服务. 使配置生效.
# 重启:
systemctl restart sshd.service
# 根据提示, 选择 root, 输入密码, 服务重启. 退出登录, 重新登录验证.
getconf LONG_BIT # 查看系统位数
uname -a # kernel 版本
/opt/vc/bin/vcgencmd version # firmware版本
strings /boot/start.elf | grep VC_BUILD_ID # firmware版本
cat /proc/version # kernel
cat /etc/os-release # OS版本资讯
cat /etc/issue # Linux distro 版本
cat /etc/debian_version # Debian版本编号
#############
pi@raspberrypi:/etc/apt/sources.list.d $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
# 查看cpu温度
vcgencmd measure_temp
# 查看cpu信息
cat /proc/cpuinfo
lscpu
# 查看内存
free -h
# 查看磁盘
lsblk
df -hT
# 查看更多硬件信息
dmesg | more
# 查看时间
date
# 查看树莓派型号
cat /proc/device-tree/model
# 查看树莓派系统位数
getconf LONG_BIT
file /bin/ls
# 查看usb
lsusb
# 查看其他硬件
lsmod
# 查看CPU的时钟频率
vcgencmd get_config arm_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
E: Sub-process /usr/bin/dpkg returned an error code (1)
fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Failed to start Docker Application Container Engine.
sudo systemctl daemon-reload
sudo systemctl restart docker
systemctl restart docker.service
# 查看分区:
pi@raspberrypi:~ $ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 7.0G 6.7G 2.4M 100% /
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 17M 1.9G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 54M 199M 22% /boot
tmpfs 386M 0 386M 0% /run/user/1000
#
sudo raspi-config
# 选第7项 7 advanced options , 回车
finish
, 回车. pi@raspberrypi:~ $ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/root 29G 6.6G 22G 24% /
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.5M 1.9G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 53M 200M 21% /boot
tmpfs 386M 0 386M 0% /run/user/1000
# 使用 arp 扫描局域网 IP:
henry@hh-imac27 [14时52分22秒] [~]
-> % arp -a
? (192.168.2.1) at d0:17:c2:3d:c8:b0 on en1 ifscope [ethernet]
? (192.168.2.10) at 14:20:5e:11:3c:7e on en1 ifscope permanent [ethernet]
? (192.168.2.73) at e4:2b:34:d7:b9:4d on en1 ifscope [ethernet]
? (192.168.2.76) at 58:6b:14:0:ab:5e on en1 ifscope [ethernet]
? (192.168.2.195) at 74:23:44:4a:94:1a on en1 ifscope [ethernet]
? (192.168.2.198) at dc:a6:32:60:8d:9f on en1 ifscope [ethernet]
? (224.0.0.251) at 1:0:5e:0:0:fb on en1 ifscope permanent [ethernet]
? (239.255.255.250) at 1:0:5e:7f:ff:fa on en1 ifscope permanent [ethernet]
# 安装:
brew install nmap
# 扫描当前网段所有在线 IP:
henry@hh-imac27 [14时49分04秒] [~]
-> % nmap -sP 192.168.2.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2020-03-22 14:49 CST
Nmap scan report for 192.168.2.1
Host is up (0.0036s latency).
Nmap scan report for 192.168.2.10
Host is up (0.00011s latency).
Nmap scan report for 192.168.2.76
Host is up (0.093s latency).
Nmap scan report for 192.168.2.198
Host is up (0.0043s latency).
Nmap done: 256 IP addresses (4 hosts up) scanned in 3.34 seconds
# 已知 192.168.2.198 是树莓派设备
# -A 参数, 查到 Raspbian, 可知是树莓派设备
-> % nmap -A 192.168.2.198
Starting Nmap 7.80 ( https://nmap.org ) at 2020-03-22 15:00 CST
Nmap scan report for 192.168.2.198
Host is up (0.0057s latency).
Not shown: 998 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.9p1 Raspbian 10+deb10u2 (protocol 2.0)
| ssh-hostkey:
| 2048 07:cf:25:3d:65:88:86:da:c9:bc:0e:ed:6c:0a:4b:fd (RSA)
| 256 47:3a:72:1b:92:26:4c:bd:52:a7:08:6e:13:d7:f4:34 (ECDSA)
|_ 256 4c:c2:0a:82:42:16:18:30:63:37:06:a7:9f:8e:80:e8 (ED25519)
5900/tcp open vnc RealVNC Enterprise 5.3 or later (protocol 5.0)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1.00 seconds
# 猜猜 IP 设备的 OS 信息:
sudo nmap 192.168.2.198 -O --osscan-guess
# 查看 无线网卡名:
# 可知无线网卡名为 wlan0
pi@raspberrypi:~ $ ifconfig
# 查看树莓派网卡信息:
pi@raspberrypi:~ $ iwconfig
# 获取设备工作状态信息
pi@raspberrypi:~ $ iw wlan0 info
# 获取设备连接状态信息(实测不包含IP地址)
pi@raspberrypi:~ $ iw dev wlan0 link
Not connected.
# 扫描无线网络,列表的内容都是实时更新的
iw dev wlan0 scan
# 查看 当前 WIFI 热点列表:
pi@raspberrypi:~ $ iwlist wlan0 scan | grep ESSID
ESSID:"ziroom602"
ESSID:"H-WIFI"
ESSID:"ChinaNet-GLRy"
ESSID:"HH-WIFI"
# 生成 WIFI 密码的辅助配置段, 贴到: /etc/wpa_supplicant/wpa_supplicant.conf 里
pi@raspberrypi:/etc/wpa_supplicant $ wpa_passphrase 'HH-WIFI' password
network={
ssid="HH-WIFI"
#psk="password"
psk=25f42dfdb2cf545884c165ab98bf60d561c1140d7e1dbb48413c05391e40a436
}
# 注意要把 psk, 替换成真正的 WIFI 密码, 上面这个配置段, 只是方便 改配置用.
sudo vim wpa_supplicant.conf
############################
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CN
network={
ssid="BT_OFFICE_PHONE5G"
psk="wifi-pwd"
key_mgmt=WPA-PSK
}
# wifi2:
network={
ssid="HH-WIFI"
#psk="password"
psk="wifi-pwd"
key_mgmt=WPA-PSK
priority=10
id_str="hh"
}
设置静态 IP: https://blog.csdn.net/lz_quiet/article/details/103604608
WIFI 密码设置成功, 重启网络:
pi@raspberrypi:~$ sudo systemctl restart networking #重启网卡
pi@raspberrypi:~$ sudo ifdown wlan0
pi@raspberrypi:~$ sudo ifup wlan0
pi@raspberrypi:~$ wpa_cli status #查看连接状态
# 通过 WIFI 的 IP 连接树莓派
ssh pi@192.168.2.199
sudo iwconfig
# pi @ raspberrypi in /etc [19:46:23]
$ sudo wpa_cli status
Selected interface 'p2p-dev-wlan0'
wpa_state=DISCONNECTED
p2p_device_address=3e:39:be:00:91:48
address=3e:39:be:00:91:48
uuid=8a412c29-3394-5231-858c-18a2e57802f4
# 重启:
sudo reboot
# 关机:
sudo poweroff
sudo init 0
清华大学
的 mirror 了.
## 最最关键的步骤, 切换 root 用户:
su root
sudo apt update
安装 docker , 参考: https://phoenixnap.com/kb/docker-on-raspberry-pi
使用 docker mirror 源, 要先添加源, 再 update 源, 再执行安装脚本.
# 添加 docker 镜像源:
sudo echo "deb [arch=armhf] https://mirror.azure.cn/docker-ce/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list
# 关键 + 必要步:
sudo apt-get update -y && sudo apt-get upgrade -y
# 下载安装脚本:
curl -fsSL https://get.docker.com -o get-docker.sh
chmod +x *.sh
# 执行安装脚本:
sudo sh get-docker.sh
# 使用镜像, 报错, 还是用默认: (从安装脚本里, 找到镜像源参数)
sudo sh get-docker.sh --mirror Aliyun
sudo sh get-docker.sh --mirror AzureChinaCloud
su root
# 安装:
sudo sh get-docker.sh --mirror Aliyun
# 添加用户:
sudo groupadd docker
sudo usermod -aG docker $USER
# 启动:
sudo systemctl enable docker
sudo systemctl start docker
sudo systemctl start docker.service
# 验证:
docker run arm32v7/hello-world
sudo apt-get purge docker-ce
sudo apt autoremove docker-ce -y
sudo apt remove docker-ce -y
sudo rm -rf /var/lib/docker
Looks like good progress on this thread.
The other thing that you may like is inlets, for a HTTPS tunnel for the cluster, it can expose an endpoint in Europe for instance. https://docs.inlets.dev/
cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://abc.mirror.aliyuncs.com"]
}
Looks like good progress on this thread.
The other thing that you may like is inlets, for a HTTPS tunnel for the cluster, it can expose an endpoint in Europe for instance. https://docs.inlets.dev/
thanks a lot, i will check it. @alexellis
➤ ping raspberrypi
PING raspberrypi (10.211.1.91): 56 data bytes
64 bytes from 10.211.1.91: icmp_seq=0 ttl=64 time=6.477 ms
64 bytes from 10.211.1.91: icmp_seq=1 ttl=64 time=6.078 ms
64 bytes from 10.211.1.91: icmp_seq=2 ttl=64 time=4.519 ms
related: