树莓派64位CentOS安装
1、树莓派安装64位centos系统
下载地址:https://people.centos.org/pgreco/
下载包为:CentOS-Userland-7-aarch64-RaspberryPI-Minimal-4-1908-sda.raw.xz
通过7z解压为.raw,然后用Win32DiskImager烧写到SD卡
或者通过Baidu网盘下载
链接:https://pan.baidu.com/s/19dU1xVa6FrlGI8s5DbFJQg
提取码:kd7q
启动后 系统的默认用户名和密码:
root centos
修改host名称 hostnamectl set-hostname [newname]
修改时区 timedatectl set-timezone Asia/Shanghai
查看时区 timedatectl status
2、How to Resize/Expand the RootFS for the Whole SD Card
[root@host ~]# /usr/bin/rootfs-expand
由于还没有这个命令,需要通过fdisk 实现新分区
fdisk /dev/mmcblk0
新建分区 n /dev/mmcblk0p4
删除分区 d /dev/mmcblk0p3
在新建分区n /dev/mmcblk0p3
删除分区d /dev/mmcblk0p4
w
q
[root@host ~]#reboot
[root@host ~]#resize2fs /dev/mmcblk0p3
3、wifi配置,安装NetworkManager-wifi(如何不用无线网络,非必须要做)
https://www.cnblogs.com/luyao/p/9278982.html
https://blog.csdn.net/u014695839/article/details/84554606
yum -y install NetworkManager-wifi
扫描可用于连接wifi
nmcli dev wifi
添加一个wifi的连接
nmcli dev wifi con 无线网络名称 password 无线网络密码 name 任意连接名称(删除,修改时用)
#添加成功后查看已创建的wifi连接
nmcli conn
#如果wifi没有连接上
nmcli con up wifi连接名(刚才nmtui创建的连接)
#修改该连接为开机自动连接
nmcli con mod wifi连接名 connection.autoconnect yes
4、关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
5、配置内网穿透frpc
frp主页:https://github.com/fatedier/frp
systemd.service文件字段解释: http://www.jinbuguo.com/systemd/systemd.service.html https://blog.csdn.net/yuesichiu/article/details/51485147
配置frpc
sudo vi /your/path/frpc/frpc.ini
[common]
server_addr = xxx.xxx.xxx.xxx
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6023
使用supervisor来控制启动
yum install rng-tools vim -y
yum install epel-release -y
yum install supervisor -y
sudo systemctl enable supervisord # 开机自启动
sudo systemctl restart supervisord
systemctl status supervisord # 查看supervisord服务状态
vim /etc/supervisord.conf
将最后一行的
files = supervisord.d/*.ini
修改为
files = supervisord.d/*.conf
配置 frpc并启动
cd /etc/supervisord.d
touch frpc.conf
[program:frpc]
command=/root/frp/frpc -c /root/frp/frpc.ini
stderr_logfile=/var/log/supervisor/frpc.log
stdout_logfile=/var/log/supervisor/frpc.log
#directory=/home/pi/frp
autostart=true
user=root
autorestart=true
startsecs=30
supervisorctl update ##更新配置,并生效
supervisorctl restart frpc ##启动frpc
然后就可以通过 ssh xxx.xxx.xxx.xxx:6023 访问pi centos板子了
错误处理:
crypto/rand: blocked for 60 seconds waiting to read random data from the kernel
2020/04/22 10:55:56 [E] [control.go:157] [7523e4bb865eca3b] work connection closed before response StartWorkConn message: EOF
处理方式:
https://github.com/DNSCrypt/dnscrypt-proxy/issues/760
yum install rng-tools -y 重启后生效
6、supervisor的其他命令使用
1、启动supervisor
##-c制定让其读取的配置文件
supervisord -c /etc/supervisor/supervisord.conf
2、关闭supervisor
supervisorctl shutdown
3、重新载入supervisor,在这里相当于重启supervisor服务,里面的服务也会跟着重新启动
supervisorctl reload
4、添加/删除 要管理服务
(1)添加或删除配置文件
(2)更新
supervisorctl update
5、管理supervisor下的服务
###启动服务
supervisorctl start all
supervisorctl start service_name
###关闭服务
supervisorctl stop all
supervisorctl stop service_name
###查看状态
supervisorctl status [service_name]
###重新启动所有服务或者是某个服务
supervisorctl restart all
supervisorctl restart service_name
7、install tools
yum install epel-release -y
yum groupinstall "Development Tools" -y
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y
yum install -y p7zip
yum install file wget tar bzip2 libcurl-devel -y
yum install cmake -y
其他slurm依赖工具
yum install openssl openssl-devel pam-devel numactl numactl-devel hwloc hwloc-devel lua lua-devel readline-devel rrdtool-devel ncurses-devel man2html libibmad libibumad -y
yum install munge munge-libs munge-devel rng-tools cpanm* -y
yum install mariadb-devel -y
yum install rpm-build -y
8、安装python3 gevent
yum install python34 python34-devel python34-pip
pip3 install -U setuptools
pip3 install -U pip
pip3 install gevent
9、编译安装slurm(待验证)
wget https://download.schedmd.com/slurm/slurm-19.05.4.tar.bz2
rpmbuild -ta slurm-19.05.4.tar.bz2
然后是漫长的等待,如果不想等待,直接用下面的编译好的包
出现下面的Error表示,没有安装 mariadb-devel,yum install mariadb-devel -y安装一下就可以解决了
Processing files: slurm-slurmdbd-19.05.4-1.el7.aarch64
error: File not found: /root/rpmbuild/BUILDROOT/slurm-19.05.4-1.el7.aarch64/usr/lib64/slurm/accounting_storage_mysql.so
RPM build errors:
File not found: /root/rpmbuild/BUILDROOT/slurm-19.05.4-1.el7.aarch64/usr/lib64/slurm/accounting_storage_mysql.so
File not found: /root/rpmbuild/BUILDROOT/slurm-19.05.4-1.el7.aarch64/usr/lib64/slurm/accounting_storage_mysql.so
或者直接下载编译好的包
链接:https://pan.baidu.com/s/1Hr4ASdpzFRNwRgEh0oyZaQ
提取码:gy25
说明:
slurm19.05.4_x86_64.zip amd64的slurm rpm安装包
slurm19.05.4_aarch64.zip armv8的slurm 安装包
slurm-19.05.4.tar.bz2 slurm源码
10、安装数据库MariaDB
touch /etc/yum.repos.d/MariaDB.repo
vim /etc/yum.repos.d/MariaDB.repo
添加下面的内容
# MariaDB 10.4 CentOS repository list - created 2019-11-30 10:02 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安装
sudo yum install mariadb-server mariadb-client -y
参考: https://www.huweihuang.com/linux-notes/tools/supervisor-usage.html
11、查看CPU温度
cat /sys/class/thermal/thermal_zone0/temp
12、打开I2C
1、打开I2C设备 编辑/boot/config.txt 加入
dtparam=i2c_arm=on,i2c_arm_baudrate=32000
dtparam=i2s=on
dtparam=i2c_baudrate=32000
编辑/etc/modules-load.d/modules.conf 加入
i2c-dev
i2c-bcm2835
i2c-bcm2708
重启后即可
2、安装 i2c-tools
yum install i2c-tools
或者源码安装
wget https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/i2c-tools-4.1.tar.gz
tar zxvf i2c-tools-4.1.tar.gz
cd i2c-tools-4.1
修改Makefile中 USE_STATIC_LIB ?= 1 为 1,采用静态编译,避免安装后so找不到的错误
make && make install
3、检查I2C
查看I2C设备
i2cdetect -l
扫描总线并返回总线挂载设备情况
i2cdetect -r -y 1
13、安装golang环境
1、下载安装包
https://golang.org/dl/ 下载对应的golang包即可
64的Centos系统请下载 gox.xx.x.linux-arm64.tar.gz
32的树莓派官方系统请下载 gox.xx.x.linux-armv6l.tar.gz
2、添加环境变量 添加环境变量
vim /etc/profile
export GOROOT=/home/go
export GOPATH=/home/gopro
export GOPROXY=https://goproxy.cn,direct
export GO111MODULE=on
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
3、测试
go version