orangepi zero安装armbian

编程知识 更新时间:2023-04-27 05:38:39

几年前买了个orangepi zero,花了59块钱。现在把它搭建起来,当家庭服务器。

准备资源

  1. orange pi官网有win32diskimager-1.0.0-install.exe下载
  2. 直接去armbian官网下载安装文件https://www.armbian/orange-pi-zero/

烧录

安装win32diskimager后,用win32diskimager将armbian的img烧录到一张8G的TF卡上,最大支持32G

然后把卡插到orangepi上,再用网线连接到路由器上,用5V2A的手机充电器上电,开机。

登陆配置

  • 浏览器登陆路由器界面192.168.0.1,在客户端列表里查看到orangepi地址192.168.0.101
  • 电脑开个终端,ssh登陆orangepi。默认用户名root,密码1234
ssh -l  root -p 22  192.168.0.101
  • 登陆成功之后按照提示改密码,设置普通用户
  • 将orangepi连接wifi

进入armbian配置界面

sudo  armbian-config

network——>wifi——>你的路由器名——>输入wifi密码,连接成功。

  • 拔掉orangepi的有线,重启pi,让它用wifi连接路由器
  •  路由器管理界面查看orangepi对应的mac与IP,将MAC绑定成静态IP:192.168.0.100

重启pi后,pi的地址就绑定为静态地址100了。

  • 在pi上把localhost和pi这个名字关联。修改/etc/hosts
127.0.0.1   localhost
127.0.1.1   orangepizero
#wulong
#::1         localhost orangepizero pi ip6-localhost ip6-loopback
localhost   pi
::1         localhost orangepizero pi ip6-localhost ip6-loopback

fe00::0     ip6-localnet
ff00::0     ip6-mcastprefix
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

然后执行命令,刷新hosts

sudo /etc/init.d/networking restart

 

  • 默认安装了python3,再安装pip3
$ sudo aptitude install python3-pip

 这样操作后,以后git clone https://user@pi:8888/~/path.git  拷贝的时候就不用输入繁琐的地址了。用pi代替ip

  • 在windows客户端也改C:\Windows\System32\drivers\etc\hosts
# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost
192.168.0.100   pi

 以后就可以直接   ssh -l  user   pi访问ip了

  • python命令无效。把python3建立软连接命名python。pip3也软连接
andrew@orangepizero:~$ which python3
/usr/bin/python3
andrew@orangepizero:~$ sudo ln -s /usr/bin/python3  /usr/bin/python
andrew@orangepizero:~$ which pip3
/usr/bin/pip3
andrew@orangepizero:~$ sudo ln -s /usr/bin/pip3  /usr/bin/pip

升级setuptools和pip

andrew@orangepizero:~$ pip install --upgrade setuptools && python -m pip install --upgrade pip

安装几个常用的python模块


pip install pymysql
pip install flask
pip install APScheduler

加载ntfs硬盘

  • 查看硬盘
andrew@orangepizero:/mnt$ sudo blkid -o list
device     fs_type label    mount point    UUID
-----------------------------------------------------------
/dev/mmcblk0p1
           ext4             /              93502503-5a81-4c0c-b76e-fabcad07a82b
/dev/zram0 swap             [SWAP]         ca9e0fe3-bbe1-4ada-a531-ede7608f46e0
/dev/sda1  ntfs    u        (not mounted)  16BEBD74BEBD4CCD
/dev/mmcblk0
                            (in use)
/dev/zram1 ext4    log2ram  /var/log       5f8c810f-642b-47ae-9ada-ed8146fec423
/dev/sdb1  ntfs    g        (not mounted)  6A001CB1001C85EB
andrew@orangepizero:/mnt$ sudo blkid -o list
  • 安装ntfs-3g
aptitude install ntfs-3g   -y
  • 建立对应的/mnt/g、/mnt/u
sudo  mkdir -p  /etc/u

sudo mkdir -p /etc/g
  • 修改配置文件/etc/rc.local ,添加开机加载ntfs启动命令
##todo: wulong                                                                         mount -t ntfs  /dev/sda1  /mnt/u                                                       mount -t ntfs  /dev/sdb1  /mnt/g                                                                                                                                              #end                                                                                                                                                                                                                                                                                                                                                        exit 0      
  • 重启pi
sudo reboot

或者直接按电源开关

  • 可以访问/mnt/u和/mnt/g 两个硬盘了。
andrew@orangepizero:/mnt/u$ ls
'$RECYCLE.BIN'               'Youku Files'
 article                     '业主大会和业主委员会议事规则(草案)(2).docx'
 CloudMusic                   代码
 DCIM                         有声小说
 savesoftware                 每年从.txt
'System Volume Information'  '管理规约示范文本(草案)(1).docx'
 work                         迅雷下载
  • 打开默认桌面
sudo armbian-config

system——> System settings——>Desktop(Enable desktop)——>重启

重登陆后安装tightvncserver

sudo aptitude tightvncserver -y

每次登陆后启动vncserver。首次启动vncserver会要求输入vnc远程密码

vncserver :1

 客户端安装tightvncviewer,在remote host中输入192.168.0.100:1 点击connect连接

  •  安装mplayer后想播放音乐,没声音,参考:https://blog.csdn/qq_38434805/article/details/104695685
sudo armbian-config

system——>System Settings——>hardware——>nalo-codec(按space键开启外置声音模块)

再在命令行播放音乐

mplayer   Hotal-california.mp3

声音太小了?参考:http://t.zoukankan/lovesKey-p-8591103.html

输入命令: alsamixer调整音量,F6选择声卡,上下键调整音量。https://www.myzhenai/post/1216.html

  • mplayer命令列表播放器

把想听的音乐放在~/Music 里

编写~/program/shell/music_mplayer.sh

#!/bin/bash
cd ~/Music
ROOT=$(pwd)
F_LST=$ROOT"/music.lst"
cd $ROOT
echo $F_LST
ls | grep -G '\.[WwMm].[Aa3]$' > $F_LST
mplayer -playlist $F_LST -loop 1

把shell路径添加到path中 ~/etc/profile尾部加上

PATH=$PATH:/home/andrew/program/shell
export PATH

重加载profile    

source /etc/profile

然后在任意位置执行 music_mplayer.sh,就能循环听音乐了。

更多推荐

orangepi zero安装armbian

本文发布于:2023-04-20 13:36:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/e53a9c3536e4ff89deefc068424d9d10.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:orangepi   armbian

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 90165文章数
  • 23302阅读数
  • 0评论数