Beaglebone Black基本操作(Debian)

1 Debian Beaglebone Black安装

1.1 Image 下载

  • Debian For BBB
  • 我选择的是bone-debian-8.7-console-armhf-2017-01-30-2gb.img.xz

1.2 准备EMMC烧录TF

  • linux下dd if=bone-debian-8.7-console-armhf-2017-01-30-2gb.img of=/dev/sdx bs=8M写入镜像
  • linux系统下读取rooft/boot/uEnv.txt
##enable BBB: eMMC Flasher: 
cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh    #### make this line enable

1.3 插入TF卡,并从TF启动

1.4 USB转串口连接

  • GND(黑色) -> J1
  • RXD(绿色) -> J4
  • TXD(白色) -> J5
  • 波特率:115200
  • 用户名:root
  • 密码:默认无

1.5 使用完整TF卡容量

由于我使用的是32G的TF卡,而image文件是2G的镜像,df -h只能看到/分区只有2G容量,进行下述操作恢复完整容量:

cd /opt/scripts/tools
./grow_partition.sh
reboot

1.6 Root登录,设置密码,并修改debian用户密码

passwd
passwd debian

1.7 设置固定IP地址

目前该方法对于Debian7.x设置有效,但对于Debian8.x设置后,设备重启依然会走DHCP,再执行service networking restart又设置有效了

修改网络配置文件/etc/network/interfaces

sudo vi /etc/network/interfaces

找到相关内容添加下面的文字(我设置的ip地址为192.168.1.89)

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    iface eth0 inet static                           # change dhcp to static
        address 192.168.1.89                             # new add
        netmask 255.255.255.0                            # new add
        gateway 192.168.1.1                              # new add
    # Example to keep MAC address between reboots
    #hwaddress ether DE:AD:BE:EF:CA:FE

    # The secondary network interface
    #auto eth1
    #iface eth1 inet dhcp

    # WiFi Example
    #auto wlan0
    #iface wlan0 inet dhcp

1.8 软件升级

apt-get update
apt-get upgrade

2 安装ftp服务器,方便文件交互

2.1 安装vsftpd

apt-get update
apt-get install vsftpd

2.2 setup environment

cd /home/debian
mkdir ftp
chown debian ftp
chmod 777 ftp

3.3 edit config file: vi /etc/vsftpd.conf

找到以下几行,做对应修改

anonymous_enable=NO                          ###change to NO
local_enable=YES                             ###uncomment
write_enable=YES                             ###uncomment
local_umask=022                              ###uncomment
chroot_local_user=YES                        ###uncomment
chroot_list_enable=YES                       ###uncomment
chroot_list_file=/etc/vsftpd.chroot_list     ###uncomment
local_root=/home/debian/ftp                  ###add

3 ssh证书登录

3.1 Windows

3.1.1 key generate

  • use puttygen generate rsa key, and public key
  • save private key
  • copy Pub key for openSSH, and save as authorized_keys
  • use FTP to send authorized_keys to BBB

3.1.2 server setup

cd ~
mkdir .ssh
cd .ssh
cat xxx/authorized_keys >> authorized_keys

3.1.3 putty client setup

  • Session -> IP & Port: 192.168.1.89 & 22
  • Connection -> Data -> user name: file
  • Connection -> SSH -> Auth: load the private key
  • Session -> Saved Sessions: save all those setting as XXX
  • Open

3.2 Linux

3.2.1 key generate

ssh-keygen -t rsa -b 1024
ssh-keygen -y -f ~/.ssh/id_rsa >> keytext
sudo ssh-keygen -f "/home/user/.ssh/known_hosts" -R 192.168.1.89 # add server to trust list

3.2.2 server setup

cat keytext >> authorized_keys

3.2.3 client login

ssh user@192.168.1.88

3.3 More safe login setup of server

close password login port using ssh: vi /etc/ssh/sshd_config

PasswordAuthentication no                          ### change

4 Samba

4.1 Install Samba

apt get update
apt get install samba

4.2 Modify Config

vi /etc/samba/smb.conf


security = user                 # add
[homes]                         # modify
   comment = Home Directories   # modify
   browseable = no              # modify

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no              # modify

4.3 Add Samba passwd

pdbedit -a -u username

4.4 service restart

/etc/init.d/samba restart

你可能感兴趣的:(Beaglebone,Black)