
Debian系统的制作及使用教程(一)
制作Debian文件系统
参考:https://wiki.debian.org/Debootstrap
制作debian的工具:qemu-debootstrap
扩展分区:
umount /dev/sdd?
debian:
parted /dev/sdd unit esizepart 2 100 unit MB print
fsck.ext4 -f /dev/sdd2
resize2fs /dev/sdd2
1、安装qemu、debootstrap工具
#sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
2、下载一个完整的debian rootfs
#qemu-debootstrap --arch armhf jessie jessie-chroot
http://ftp.cn.debian.org/debian --verbose --include=wpasupplicant,openssh-client,openssh-server
3、验证签名
#apt-get install debian-archive-keyring
4、至此,你已经成功下载了一个debian的文件系统包。
使用Debian文件系统
1、安装 ping 的软件包
inetutils-ping
ICMP echo tool
iputils-ping
Tools to test the reachability of network hosts
#apt-get install iputils-ping
2、安装 vim 的软件包
#apt-get install vim
3、分配固定IP地址
#vim /etc/network/interfaces.d/eth0
auto eth0 inet dhcp
allow-hotplug eth0
#ifcace eth0 inet dhcp
iface eth0 inet static
address 192.168.1.x
netmask 255.255.255.0
gateway 192.168.1.1
hwaddress ether fa:44:18:40:0c:01
#/etc/init.d/networking restart
4、自动更新时间
#vim /etc/cron.daily/timeupdate
ntpdate ntp.ubuntu.com
#chmod 755 /etc/cron.daily/timeupdate
#sync
#date ( Type 'date' to check the time )
5、下载SSH Server
#apt-get install openssh-server
6、Debian截图方法
#apt-get install fbgrab
#fbgrab -d /dev/fb0 screen.webp
7、设置防火墙方法
1、首先确定你的NanoPi 2已经连接上网络;
2、安装iptables:
#apt-get install iptables
3、查看Iptables目前的配置信息:
#iptables -L
4、配置/etc/iptables.test.rules:
#vi /etc/iptables.test.rules
<br>*filter
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows all outbound traffic
# You could modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 443 -j ACCEPT
# Allows SSH connections
# The --dport number is the same as in /etc/ssh/sshd_config
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
# Now you should read up on iptables rules and consider whether ssh access
# for everyone is really desired. Most likely you will only allow access from certain IPs.
# Allow ping
# note that blocking other types of icmp packets is considered a bad idea by some
# remove -m icmp --icmp-type 8 from this line to allow all kinds of icmp:
#
https://security.stackexchange.com/questions/22711
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# log iptables denied calls (access via 'dmesg' command)
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: "
--log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy:
-A INPUT -j REJECT
-A FORWARD -j REJECT
COMMIT
5、配置文件写好之后就可以运行下面的命令来使用这些rules:
(iptables提供了保存当前运行的规则功能)
#iptables-save > /etc/iptables.up.rules
#iptables-restore < /etc/iptables.test.rules
以上教程会不断更新。。。。
最新电子行业资讯、教程以及开发板样片申请,请关注“云汉电子社区”官方微信公众号ickeybbs