树莓派2系统DietPi简单安装配置使用介绍

DietPi在Raspberrypi.org上的原帖:http://dwz.cn/HSrmY

版本发布很频繁,给原作者们点个赞。功能会越来越多,而且作者的定制观点很明确,适合树莓派的使用。

之前关于DietPi的介绍发到贴吧,版大还给加了精,这里把安装配置简要介绍一下:

注意:本人没有HDMI显示器,无法测试相关功能,但是X server可以正常打开显示桌面,HDMI功能具体在dietpi-config里面

可以设置。本文环境DietPi V36

1.默认登陆账户密码root raspberry,没有其他账户,建议新建一个用户,不需要安装sudo,使用su即可。

useradd xin #ur account name
passwd xin
mkdir /home/xin
chown xin:xin /home/xin

2.默认不启用串口,有需求请更改/etc/inittab,将最后的注释去掉

#Spawn a getty on Raspberry Pi serial line
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

3.建议初次运行仅安装dietpi-core(即只修改dietpi-config中的locate以及时区键盘),修改默认源后再运行dietpi-software安装软件

  如果没安装成功(中途断网啥的),可以修改/boot/dietpi/.installed

3.推荐国内源:deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main non-free contrib

查找最快源请参考我的另一篇博客:http://www.cnblogs.com/sjqlwy/p/4453612.html

4.更新版本请使用:dietpi-update

   更新内核请使用:rpi-update

   日常更新请使用:update

4.默认使用ftp服务器软件为provftpd,不是vsftpd,该ftp服务器软件"轻量且功能丰富”有外置硬盘情况下默认硬盘,没硬盘默认根目录

5.dropbear这个ssh服务器软件默认支持ssh2和scp,不支持sftp需要sftp功能的可参考http://dwz.cn/HSuTv

6.预装软件:htop(系统资源查看,很好用)ramlog

7.常用命令:cpu:查看cpu使用频率和温度;treesize:查看当前目录/文件的大小

8.关于ramlog:前文发了个介绍这个的链接,这里详细说下:

                           树莓派系统一般使用SD卡+ext4文件系统,而ext4的日志会增加额外读写开销,缩短存储卡使用寿命。

                           ramlog将/var/log挂载到内存(df -m可以看到),使用空间动态扩展,比使用tmpfs的方式(参考http://dwz.cn/HSxc5)更灵活。

                           注意:如果使用修改/etc/rc.local等方法增加自动启动程序,建议延时启动,例如(sleep 3;sudo /usr/bin/mentohust) &  以让ramlog先启动

                           之前没加sleep的时候发现ramlog没有正常启动(/etc/init.d/ramlog status),修改后正常。

9.注意,我安装miniDLNA之后,可以打开localhost:8200,但是局域网搜不到,后来修改/etc/minidlna.conf 中的network_interface=

10.感谢http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/05/2199534.html

     因为/etc/network/interfaces是在linux文件系统上,在Windows下不好直接修改,有时候搞乱了就无法通过网络连接到Pi,这里有个

     简单的方法创建软链接,可以直接在boot分区(就是查到Windows上只能看到的那个小分区)修改.

mv /etc/network/interfaces /boot
ln -s /boot/interfaces /etc/network/interfaces
#查看是否建立成功
ls -l /etc/network/

暂时写这么多,以后会更新。其他通用配置请自行百谷虎,算了还是百bing虎吧,谷歌IP又被封了…

原帖拾遗:

######dpkg --get-selections | grep -v deinstall

######安装脚本在/boot/dietpi

######Config File for Proftpd
/etc/proftpd/proftpd.conf
#Save/Restart
service proftpd restart
配置Proftpd使用sFTP: http://dwz.cn/HSuTv

######Ramlog
Logging is there, its just stored in RAM. DietPi uses Ramlog to prevent SD card writes that will slow down IO performance and reduce SD lifespan.
In regards to rsyslogd, its not needed in a home user environment. DietPi has a cron daily job (/etc/cron.daily/ramlog). This will delete all log files in /var/log (recursive) on a daily basis.
If you want to keep your log files, simply comment out "/boot/dietpi/logclear" in /etc/cron.daily/ramlog. Ramlog will then save the logs to your SD card.

######reinstall
/boot/dietpi/.installed

######core安装
echo -e 1 > /boot/dietpi/.install_stage
reboot

######简化安装
Prevent Network from coming up:
sed -i '/auto eth0/c#auto eth0' /etc/network/interfaces
sed -i '/auto wlan0/c#auto wlan0' /etc/network/interfaces

Remove Wifi support
apt-get purge wpasupplicant firmware-atheros firmware-iwlwifi firmware-realtek firmware-ralink -y && apt-get autoremove --purge -y

Remove Ramlog
apt-get purge ramlog -y && apt-get autoremove --purge -y && logclear

Remove Udev support (stops devices eg:wifi being picked up, removes NTFS support, not recommended)
apt-get purge udev makedev -y && apt-get autoremove --purge -y

Remove all networking support (dhcp/ISC)
apt-get purge ifupdown isc-dhcp-client isc-dhcp-common -y && apt-get autoremove --purge -y

######强制刷新miniDLNA
rm /root/.MiniDLNA_Cache/* && rm /mnt/usb_1/.MiniDLNA_Cache/* && service minidlna restart

原文地址:https://www.cnblogs.com/sjqlwy/p/4457006.html