嵌入式开发的一些配置
嵌入式开发的一些配置
samba服务
在windows下查看linux下的文件,从而实现在windows下编辑,在linux下编译的开发方式。
sudo apt-get install samba
修改/etc/samba/smb.conf配置文件,在文件尾追加:
[shared-name] #共享名,也是Windows上显示的名字
path=/home/shared_dir #本地路径
valid users=username #samba用户名
public=yes
writable=yes
然后添加samba用户:
sudo smbpasswd -a username
最后重启服务即可:
sudo service smbd restart
此时服务已开启,转到Windows下,在资源管理器地址栏按添加共享文件夹的方式添加即可。
输入用户名和密码时,为在linux端创建samba输入的用户名和密码。
tftp服务
tftp是一个简化版的ftp,可用于向设备传送文件,适用于仅支持tftp的嵌入式设备。
安装
# 安装tftp服务端
sudo apt-get install tftpd-hpa
# 安装tftp客户端
sudo apt-get install tftp-hpa
服务端配置
先创建tftp目录
mkdir /tftp_dir
sudo chmod 777 /tftp_dir -R
配置文件修改
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftp_dir"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="-l -c -s"
重启tftp服务
sudo service tftpd-hpa restart
此时搭建完成。
# 测试
# 在服务器目录上创建一个文件,并修改权限
touch /tftp_dir/test.txt
echo "Test info" > /tftp_dir/test.txt
chmod 777 /tftp_dir -R
# 使用tftp下载
tftp localhost
tftp# get test.txt
q\n
# 查看test.txt,与服务器端一致
cat test.txt
# 修改test.txt,并推送至服务端
echo "New information" > test.txt
tftp localhost
tftp# put test.txt
q\n
#检查服务端文件是否已更新
cat /tftp_dir/test.txt
NFS服务
支持挂载NFS的嵌入式设备能够将开发机的目录直接挂载,便于开发调试。
安装
sudo apt-get install nfs-kernel-server
配置文件
# /etc/exports
/home/username *(rw,sync,no_subtree_check,no_root_squash)
重启服务
sudo service nfs-kernel-server restart
测试
sudo mount -t nfs localhost:/home/username /mnt
FTP服务
安装
sudo apt-get install vsftpd -y
配置
# /etc/vsftpd.conf
anonymous_enable=YES
anon_root=/home/test/nfs
no_anon_password=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
重启服务
sudo service vsftpd restart
使用
# /home/test/nfs
echo "hello" > /home/test/nfs/1.txt
# ftpget
ftpget localhost 1.txt
# ftp
ftp localhost
> ftp / annoymous
> get 1.txt
> exit
posted on 2020-10-31 18:12 amazzzzzing 阅读(236) 评论(0) 收藏 举报
浙公网安备 33010602011771号