树莓派3b+的cpu是64位的,但是没找到合适64位系统,官方指定的debain还是32的,但是centos64支持树莓派3b+了.被封印的能力可以展现出来了
-
安装系统
镜像下载地址:http://mirrors.huaweicloud.com/centos-altarch/7.8.2003/isos/aarch64/images/
镜像选择 CentOS-Userland-7-aarch64-RaspberryPI-Minimal-4-2003-sda.raw.xz
解压使用win32diskimager将镜像写入到SD卡中(sd卡是4g的)
烧录成功后就可以登陆了 密码:root 账号:centos
使用串口或者putty登陆都可以的 ip地址查找可以使用dhcpsrv直连:参考
扩展内存卡的实际容量(烧录的时候 有一部分容量被隐藏了): rootfs-expand -
配置无线网
配置无线和扩展内存可以参考这位大神的: https://blog.csdn.net/weixin_39723337/article/details/98476036 (系统不一样,换源没成功)
vi /etc/wpa_supplicant/wpa_supplicant.conf
添加 (所有标点都是英文,复制出去的有可能变成了中文,差点没哭晕在厕所)
network={
ssid="无线网名字"
key_mgmt=WPA-PSK
psk="无线网密码"
priority=10
}
连接wifi `nmcli d wifi connect 无线网名称 password 无线网密码`
查看连接 ifconfig 就可以看到wlan0 的ip
- 换源
不换源太慢了 所以我换源,关于树莓派centos64换源的文章不多,
这个也折腾了好几次,找了好多大神的文章,只有这位大神的文章帮助了我: https://blog.csdn.net/smart9527_zc/article/details/84976097
1: cd /etc/yum.repos.d/
2: rm * #反正我是全删了...
3: vi CentOS-Base.repo
然后把下面这段丢进去(大神的,一字不改,我是小白,我也看不懂)
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
————————————————
版权声明:本文为CSDN博主「smart9527_zc」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/smart9527_zc/article/details/84976097
4: vi epel.repo
然后把下面这段也丢进去(还是大神的)
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
————————————————
版权声明:本文为CSDN博主「smart9527_zc」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/smart9527_zc/article/details/84976097
5: 密钥替换之类的 我都没动 因为都一样
6:缓存:
yum makecache
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
7: 验证 我没验证直接装软件了
- 安装python (要安装很多依赖,顺序错的话,再从来,反正多折腾几下会好的,折腾的次数多了,嗯,就记不住顺序了)
# 准备工作
安装wget: yum -y install wget
安装 gcc g++ make :
yum -y install gcc automake autoconf libtool make
yum -y install gcc-c++
安装python 编译依赖(安装python的时候报错,所以提前做了这一步,这一大堆玩意,不知道是啥,也忘了参考的那位大神的文章):
sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel
# 安装python
进入自己指定的目录: cd /usr/local/
下载: wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
解压: tar -xvf Python-3.7.5.tgz
进入 解压文件的文件夹: cd Python-3.7.5
指定安装路径: ./configure prefix=/usr/local/python3
编译安装: make && make install
最后成功会出现:
Successfully installed pip-19.2.3 setuptools-41.2.0
#设置软连接
备份centos上原有的python
mv /usr/bin/python /usr/bin/python22
添加python3的软连接
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python
输入`python`查看python当前版本
yum使用的是python2 需要更改yum配置
vi /usr/bin/yum
把 #! /usr/bin/python 修改为#! /usr/bin/python22
# 安装pip
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
# 设置软连接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
# pip 换源
pip换源
mkdir ~/.pip
cd ~/.pip
vi pip.conf
[大概就下面这几行吧]
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
大概就这样了
- centos 安装git
可以参考一下这位大神的文章: https://blog.csdn.net/u014066037/article/details/70224780
修改 vi /usr/libexec/urlgrabber-ext-down 第一行改为 python22
File "/usr/libexec/urlgrabber-ext-down", line 28
不改会报错 https://www.cnblogs.com/Trees/p/7497268.html
# 安装git
yum install git
# 生成密钥:
生成SSH密钥
ssh-keygen -t rsa -C "email随便写"
连续按3个回车(密码默认为空),得到 id_rsa 和 id_rsa.pub 文件,在/root/.ssh 下说明生成成功
将本地 id_rsa.pub中的内容粘贴到github的ssh公钥中
# 克隆分支
克隆代码到本地(提前进入指定文件夹) git clone git@code.aliyun.com:xxx/xxxx.git
#git的部分指令
git branch -a 查看分支
git pull 拉去最新分支
git checkout -b 0319 origin/0319 切换分支
---强制刷新
git fetch --all
git reset --hard origin/master
git pull
一下内容centos通用
-
centos 防火墙 (我直接关了,虽然不安全,但省事…)
安装之后centos防火墙默认是开启的…很多端口不能用的
查看防火墙状态: firewall-cmd --state
停止防火墙: systemctl stop firewalld.service
启动防火墙: systemctl start firewalld.service
重启防火墙: firewall-cmd --reload
禁止开机启动: systemctl disable firewalld.service
查看开放端口: firewall-cmd --list-ports
开启80端口 firewall-cmd --zone=public(作用域) --add-port=80/tcp(端口和访问类型) --permanent(永久生效)
删除80端口: firewall-cmd --zone=public --remove-port=80/tcp --permanent
查看所有正在使用的端口: netstat -ntlp
查看端口是否被占用: netstat -na | grep 10086
端口映射: iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8081 (关闭防火墙才有效,先被占用,然后再映射)
映射保存:service iptables save(重启有效)
注意: selinux可能被拒绝,试一下setenforce 0 -
centos 查看磁盘空间 df -h
free 命令详解:
total : 系统总内存,
used:已使用内存
free: 空闲内存
shared:
buffer/cache:简单的来说就是缓存(这部分是可悲释放的)
手动释放缓存:
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches -
开机自启脚本 参考: https://www.cnblogs.com/qzqdy/p/9596100.html
vi /etc/rc.d/rc.local
添加: echo "/opt/script/StartTomcat.sh" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
- centos 后台启动(dos界面可以关掉)
nohup python main.py & - 执行.sh文件
首先要有权限
1 ./加上文件名.sh
2 sh 加上文件名.sh - 给指定文件夹加权限
sudo chmod -R 777 /usr/www/ - 查看版本号
cat /etc/redhat-release