Difference between revisions of "DietPi"

From FriendlyELEC WiKi
Jump to: navigation, search
(July-6-2018)
 
(21 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
=Introduction to DietPi=
 
=Introduction to DietPi=
 
DietPi is a highly customized light-weighted Debian OS. It is developed and maintained by a third party. DietPi is a good choice for experienced developers and Linux fans. For those that are not familiar with it we suggest you use a ROM released at its official site. If you have any issues or questions you can go to DietPi's forum or its github site for help.<br>
 
DietPi is a highly customized light-weighted Debian OS. It is developed and maintained by a third party. DietPi is a good choice for experienced developers and Linux fans. For those that are not familiar with it we suggest you use a ROM released at its official site. If you have any issues or questions you can go to DietPi's forum or its github site for help.<br>
DietPi有着下列优秀的特点:<br>
+
DietPi has the following features:<br>
1. 非常的轻量化,系统固件小于500M。<br>
+
1. Light-weighted. ROM size is less than 500M<br>
2. 高度的优化,CPU和内存的占用率小。<br>
+
2. Highly optimized. CPU and RAM usage is small<br>
3. 内置大量实用的脚本工具,在命令行的模式下有尽量提供人性化的服务。<br>
+
3. Contains various utilities and provides user-friendly services<br>
4. DietPi-Software 工具可以方便且快速的安装各种流行软件。<br>
+
4. DietPi-Software: a good tool for installing packages<br>
5. DietPi-Config 工具可以便捷的调整软硬件设置。<br>
+
5. DietPi-Config: a good tool for system configuration<br>
6. DietPi-Backup 工具可以保存和恢复文件系统。<br>
+
6. DietPi-Backup: a good tool for system backup and restoration<br>
更详细的特性介绍,请查看[http://www.dietpi.com/ DietPi的官网]<br>
+
For more details you can refer to [http://www.dietpi.com/ DietPi's official site]<br>
 
[[File:dietpi-features.png|frameless|600px|dietpi-features]]<br>
 
[[File:dietpi-features.png|frameless|600px|dietpi-features]]<br>
  
=安装DietPi=
+
=Install DietPi=
==下载系统固件==
+
==Download Image Files==
DietPi的系统固件由 DietPi 官方负责维护和生成,访问[http://www.dietpi.com/ DietPi官方下载地址], DietPi 正在不断的支持更多 FriendlyElec 出版的开发板, 本维基发布时,已经支持的板子包括:<br>
+
DietPi image files are developed and maintained by the DietPi team. Its official site is [http://www.dietpi.com/ DietPi download link],DietPi is being ported to more  FriendlyElec's boards. So far the following boards already work with DietPi:<br>
 
[[File:dietpi-friendlyelec-board.png|frameless|600px|dietpi-friendlyelec-board]]<br>
 
[[File:dietpi-friendlyelec-board.png|frameless|600px|dietpi-friendlyelec-board]]<br>
如果您喜欢 DietPi 这种轻量化的小型 OS,并且想要参与到 DietPi 的开发和维护中,可以关注 DietPi 的 github 项目[https://github.com/Fourdee/DietPi DietPi Github]和论坛[https://dietpi.com/phpbb/viewforum.php?f=5 DietPi forum],协助 DietPi 支持更多 FriendlyElec 的开发板。<br>
+
If you like DietPi and wish to join its development and maintenance youu can check its github site:[https://github.com/Fourdee/DietPi DietPi Github] and forum [https://dietpi.com/phpbb/viewforum.php?f=5 DietPi forum], and help make DietPi work with more FriendlyElec's boards.<br>
  
另外,您也可以选择从 FriendlyElec 光盘里下载 DietPi 系统固件,位于DVD/unoffcial-ROMs目录下,官方光盘里的固件也是从 DietPi 网站上下载而来,并且只进行了简单的修改和验证,修改的主要目的是为了保持 DietPi 系统固件里使用了 FrielyElec 维护的最新的 Bootloader/Kernel/DTB/Modules 等系统文件。如果您在 FriendlyElec 发布的 DVD 里没有找到 DietPi 的系统固件,则说明官方没有在该板子上验证过 DietPi。如果您是从DietPi的官网上下载的系统固件,请注意检查固件里的 Bootloader/Kernel/DTB/Modules 等系统文件是否为 FriendlyElec 维护的最新版本,如果不是,需要您自行参考开发板对应的维基,手动将这些系统文件更新为最新版本。
+
Alternatively you can download DietPi's image files from FriendlyElec's DVD and the image files are under the DVD's "/unoffcial-ROMs" directory. The image files are obtained from its official site and changed a little bit by FriendlyElec. The changes include: * update Bootloader/Kernel/DTB/Modules with FriendlyElec's latest released versions.
 +
* Enable serial debug in dietpi.txt;
 +
* Change the APT source to http://ftp.cn.debian.org/debian/ in dietpi.txt. This is for convenience of Chinese users.
 +
* Disable NTP in dietpi.txt. This is to avoid failure of system initialization due to being unable to connect to NTP server.
 +
If you cannot find a DietPi image file from FriendlyElec's DVD it means the board the DVD is associated with may not work with DietPi. If you directly download image files from DietPi's official site you need to check whether or not the image files have the latest Bootloader/Kernel/DTB/Modules. If these files are not the latest you need to update the image with the latest files.
  
==烧写DietPi==
+
==Flash DietPi==
烧写 DietPi 系统固件的方法和烧写 FriendlyElec 提供的各种SD卡Linux发行版系统固件的方法是一样的: <br>
+
The method to flash a DietPi image is the same as the method to flash a FriendlyElec image to a FriendlyElec board:<br>
将系统固件和烧写工具 win32diskimager.rar 分别解压,在 Windows 下插入TF卡(限4G及以上的卡),以管理员身份运行 win32diskimager 工具,在 win32diskimager 工具的界面上,选择你的TF卡盘符,选择系统固件,点击 Write 按钮烧写即可。
+
Extract an image file and the win32diskimager.rar utility under a Windows PC system. Insert a TF card (at least 4G) to the PC, run the win32diskimager utility as administrator, select the TF card drive and your wanted file and click on "Write" to start flashing.
  
==配置文件dietpi.txt==
+
==Configure dietpi.txt==
DietPi 系统固件烧写到 SD 卡后,SD 卡会被划分为2个分区: boot 分区和 rootfs 分区。其中 boot 分区中与 DietPi 相关的核心文件为 dietpi 目录和系统配置文件 dietpi.txt。dietpi 目录中包含了所有Dietpi系统的定制脚本,该目录在第一次运行 DietPi 时会被拷贝到 rootfs 分区并用于一系列的初始化操作,控制初始化操作的配置文件正是 dietpi.txt,建议仔细阅读 dietpi.txt 以了解 DietPi 系统提供了哪些可配置的功能,下面会描述部分比较重要的配置项,里面所有的配置项都需要用户自行去测试是否正常工作。
+
After a DietPi image is flashed to an SD card that SD card will have two sections:boot and rootfs. The boot section contains system files, a "dietpi" directory and a dietpi.txt file. The "dietpi" directory contains all DietPi related scripts. This directory and the files in it are generated and used for initializing system when DietPi is booted for the first time. The dietpi.txt is the configuration file DietPi uses to configure a system. We suggest you read this file carefully.
===网络选项Networking Options===
+
  
 +
===Networking Options===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# 是否使能以太网和WiFi,当2者同时被使能时,会优先使用WiFi。
+
# Enable/disable Ethernet and WiFi. When both are enabled WiFi will be activated first.
 
AUTO_SETUP_NET_ETHERNET_ENABLED=1
 
AUTO_SETUP_NET_ETHERNET_ENABLED=1
 
AUTO_SETUP_NET_WIFI_ENABLED=0
 
AUTO_SETUP_NET_WIFI_ENABLED=0
  
# 设置WiFi连接的热点名称和密码
+
# Set WiFi hotspot SSID and password
 
AUTO_SETUP_NET_WIFI_SSID=MySuperDooperWiFi
 
AUTO_SETUP_NET_WIFI_SSID=MySuperDooperWiFi
 
AUTO_SETUP_NET_WIFI_KEY=0123456789
 
AUTO_SETUP_NET_WIFI_KEY=0123456789
Line 40: Line 44:
 
AUTO_SETUP_NET_WIFI_KEYMGR=WPA-PSK
 
AUTO_SETUP_NET_WIFI_KEYMGR=WPA-PSK
  
# 设置hostname
+
# Set hostname
 
AUTO_SETUP_NET_HOSTNAME=DietPi
 
AUTO_SETUP_NET_HOSTNAME=DietPi
  
# 设置以太网的速率
+
# Set Ethernet speed
 
# 0=automatic speed | 10 = 10mbit, 100 = 100mbit etc
 
# 0=automatic speed | 10 = 10mbit, 100 = 100mbit etc
 
AUTO_SETUP_NET_ETH_FORCE_SPEED=0
 
AUTO_SETUP_NET_ETH_FORCE_SPEED=0
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===混杂选项Misc Options===
+
===Misc Options===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# swap文件的大小
+
# swap size
 
# 0=Disabled | 1=auto (2GB-RAM = size) | 2+=manual
 
# 0=Disabled | 1=auto (2GB-RAM = size) | 2+=manual
 
AUTO_SETUP_SWAPFILE_SIZE=1
 
AUTO_SETUP_SWAPFILE_SIZE=1
# swap文件的生成目录
+
# swap directory
 
AUTO_SETUP_SWAPFILE_LOCATION=/var/swap
 
AUTO_SETUP_SWAPFILE_LOCATION=/var/swap
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===软件预安装选项Software Automation Options===
+
===Software Automation Options===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# 是否自动安装软件
+
# Install software automatically
 
AUTO_SETUP_AUTOMATED=0
 
AUTO_SETUP_AUTOMATED=0
  
# 全局密码,包括root和dietpi用户的密码,以及后续如果安装MySQL, Transmission等软件时的的密码
+
# Global passwords including passwords for root, dietpi, MySQL, Transmission and etc
 
AUTO_SETUP_GLOBAL_PASSWORD=dietpi
 
AUTO_SETUP_GLOBAL_PASSWORD=dietpi
  
# 选择使用哪种SSH server
+
# SSH server
 
# 0=none
 
# 0=none
 
# -1=dropbear
 
# -1=dropbear
Line 71: Line 75:
 
AUTO_SETUP_SSH_SERVER_INDEX=-1
 
AUTO_SETUP_SSH_SERVER_INDEX=-1
  
# 选择使用哪种日志服务
+
# Log
 
# 0=none/manual
 
# 0=none/manual
 
# -1=ramlog 1h clear
 
# -1=ramlog 1h clear
Line 78: Line 82:
 
AUTO_SETUP_LOGGING_INDEX=-1
 
AUTO_SETUP_LOGGING_INDEX=-1
  
# 选择使用哪种webserver
+
# webserver
 
# NB: This will get ignored, if you have manually selected any WEBSERVER_Stack.
 
# NB: This will get ignored, if you have manually selected any WEBSERVER_Stack.
 
# 0=Apache2
 
# 0=Apache2
Line 88: Line 92:
 
===DietPi-Config settings===
 
===DietPi-Config settings===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# CPU策略 | ondemand | powersave | performance | conservative
+
# CPU strategy | ondemand | powersave | performance | conservative
 
CONFIG_CPU_GOVERNOR=ondemand
 
CONFIG_CPU_GOVERNOR=ondemand
 
CONFIG_CPU_USAGE_THROTTLE_UP=50
 
CONFIG_CPU_USAGE_THROTTLE_UP=50
  
# 设置CPU最小频率和最大频率
+
# CPU's min and max frequencies
 
CONFIG_CPU_MAX_FREQ=Disabled
 
CONFIG_CPU_MAX_FREQ=Disabled
 
CONFIG_CPU_MIN_FREQ=Disabled
 
CONFIG_CPU_MIN_FREQ=Disabled
  
# 启动系统时是否等待网络
+
# Whether or not wait for network on system boot
 
CONFIG_BOOT_WAIT_FOR_NETWORK=1
 
CONFIG_BOOT_WAIT_FOR_NETWORK=1
  
# 是否使能调试串口登录,第一次启动系统必须完成初始化操作才能使用调试串口进行登录。
+
# Enable/disable login with serial console.
 
CONFIG_SERIAL_CONSOLE_ENABLE=1
 
CONFIG_SERIAL_CONSOLE_ENABLE=1
  
# 软件源,该选项比较重要,请务必选择一个您所在地区可以访问的软件源链接,否则DietPi将无法完成初始化操作
+
# Package source. You'd better choose a source accessible from your location.
 
CONFIG_APT_DEBIAN_MIRROR=http://ftp.cn.debian.org/debian/
 
CONFIG_APT_DEBIAN_MIRROR=http://ftp.cn.debian.org/debian/
 
</syntaxhighlight>
 
</syntaxhighlight>
上述描述仅为部分DietPi提供的定制功能,更多的定制功能请自行阅读dietpi.txt和访问DietPi查询了解。
+
The aforementioned options are only part of DietPi's features. For more details refer to the dietpi.txt file or visit DietPi's official site.
  
=DietPi系统的使用=
+
=Work with DietPi=
==第一次启动DietPi==
+
==Boot DietPi for the First Time==
DietPi 的初始化配置比较繁琐,但只要完成一次这些初始化配置后,Dietpi 还是值得资深爱好者去使用的。<br>
+
DietPi's initialization is a complicated process. However after it is initialized it will be easy to use. Occasionally DietPi may not be able to correctly recognize a specific H3/H5 board but it will still work as long as it can recognize the board's SoC correctly.<br>
首先,必须连接好网线,DietPi 的初始化操作要求必须能连接上网络。<br>
+
Firstly you need to connect your board to the internet since initialization needs to work with the internet<br>
第一次运行 DietPi 系统时,DietPi 会扩展rootfs分区,扩展完成后会重启系统。重启系统后,会根据dietpi.txt里的配置进行进行一系列的初始化操作,如果在dietpi.txt里设置了CONFIG_SERIAL_CONSOLE_ENABLE=1,那么这一次启动系统会调用DietPi-Set_Hardware脚本使能serial-getty服务,但是要等待下一次启动系统才能使用调试串口登录。如果你不想再次重启系统,可以选择通过SSH或者在HDMI上进行登录,登录的账号和密码分别是root和dietpi。登录系统后会继续进行更多的初始化操作,我们根据提示一步步执行即可。以下截图是DietPi-V6.7在NanoPi-K1-Plus的实测初始化步骤, 不同板子不同版本的DietPi的初始化版本可能会有差异,用户只要安装具体的提示一步步进行操作即可:<br>
+
On the very first boot DietPi will extend the rootfs section. After this is done DietPi will be rebooted and initialized based on the settings specified in the dietpi.txt file. For example if CONFIG_SERIAL_CONSOLE_ENABLE=1 DietPi will call the "DietPi-Set_Hardware" script to activate the serial-getty service and login with serial console will be enabled on next system boot. If you don't want your system to be rebooted you can login with SSH and the username is "root" and password is "dietpi". Here is a screenshot showing how DietPi-V6.7 is doing initialization on NanoPi-K1-Plus. Initialization may differ for different boards:<br>
运行DietPi-Software:<br>
+
Run DietPi-Software:<br>
 
[[File:dietpi-Software.png|frameless|600px|dietpi-Software]]<br><br>
 
[[File:dietpi-Software.png|frameless|600px|dietpi-Software]]<br><br>
根据打印的log信息可以看出,其中有执行apt-get update,如果您使用的固件无法连接软件源,请自行修改dietpi.txt里的配置项CONFIG_APT_DEBIAN_MIRROR。<br>
+
Based on the system log we can see that "apt-get update" was executed. If your board isn't connected to the internet you need to reset the CONFIG_APT_DEBIAN_MIRROR option in the dietpi.txt file.<br>
运行DietPi-Set_software, 设置全局密码:<br>
+
Run DietPi-Set_software to set global passwords:<br>
 
[[File:dietpi-Set_software_gpd.png|frameless|600px|dietpi-Set_software_gpd]]<br><br>
 
[[File:dietpi-Set_software_gpd.png|frameless|600px|dietpi-Set_software_gpd]]<br><br>
运行DietPi-Set_software, 设置用户密码:<br>
+
Run DietPi-Set_software to set passwords:<br>
 
[[File:dietpi-Set_software_upd.png|frameless|600px|dietpi-Set_software_upd]]<br><br>
 
[[File:dietpi-Set_software_upd.png|frameless|600px|dietpi-Set_software_upd]]<br><br>
提示用户可通过ip a命令查看IP地址:<br>
+
Prompt users to check IP with the "ip a" command:<br>
 
[[File:DietPi-ip-a.png|frameless|600px|DietPi-ip-a]]<br><br>
 
[[File:DietPi-ip-a.png|frameless|600px|DietPi-ip-a]]<br><br>
是否允许DietPi收集并上传硬件信息:<br>
+
Whether or not allow DietPi to collect and upload hardware information:<br>
 
[[File:DietPi-Survey.png|frameless|600px|DietPi-Survey]]<br><br>
 
[[File:DietPi-Survey.png|frameless|600px|DietPi-Survey]]<br><br>
DietPi已经自动升级到最新版本:<br>
+
DietPi is upgraded to the latest version:<br>
 
[[File:dietpi-update-latest.png|frameless|600px|dietpi-update-latest]]<br><br>
 
[[File:dietpi-update-latest.png|frameless|600px|dietpi-update-latest]]<br><br>
由于DitePi系统自动了版本升级,所以又会再次重启系统,系统重启后同样会运行Dietpi-Software,并询问是否修改全局密码和用户密码后,由于DietPi的版本已经为最新版本,这时会直接进入DietPi-Software的核心界面,该界面允许用户选择自己想要安装的软件:<br>
+
After DitePi automatically upgrades itself it will reboot. After reboot it will run Dietpi-Software again and ask you whether or not to change global and user passwords and then go to DietPi-Software's main window on which you can select packages you want to install:<br>
 
[[File:dietpi-software-install.png|frameless|600px|dietpi-software-install]]<br><br>
 
[[File:dietpi-software-install.png|frameless|600px|dietpi-software-install]]<br><br>
我们使用默认设置,不再安装额外的软件,直接选择Install,并且选择OK,表示使用DietPi的纯净版最小系统:<br>
+
We used the default settings and clicked on "Install" and "OK" to proceed:<br>
 
[[File:dietpi-software-minimal.png|frameless|600px|dietpi-software-minimal]]<br><br>
 
[[File:dietpi-software-minimal.png|frameless|600px|dietpi-software-minimal]]<br><br>
此时会再次重启系统,这次才真正地完成了DietPi的初始化设置。
+
DietPi will reboot and after reboot initialization will be completed.
  
==DietPi实用脚本简介==
+
==Introduction to DietPi Scripts==
Dietpi系统提供了大量的实用脚本,所有脚本的源码均位于/rootfs/Dietpi目录,这里选择一些核心的脚本进行功能性的描述,这些描述都是基于NanoPi-K1-Plus + DietPi-V6.10,具体的脚本里的各个功能并没有在其他平台上经过准确的测试和验证,用户需自行测试和使用,如果遇到了问题,请向DietPi的官方github和论坛进行意见反馈。
+
Dietpi has a lot of useful scripts. Their source code is under the "/rootfs/Dietpi" directory. We listed some important scripts here and they have been tested with NanoPi-K1-Plus + DietPi-V6.10.
 
===DietPi-Launcher===
 
===DietPi-Launcher===
我们可以通过dietpi-launcher来统一地使用这些脚本工具,在命令行终端运行该工具:<br>
+
We can use "dietpi-launcher" to run these scripts. You can run the "dietpi-launcher" on a commandline utility:<br>
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ dietpi-launcher
 
$ dietpi-launcher
 
</syntaxhighlight>
 
</syntaxhighlight>
可以看到如下界面:<br>
+
Here is what you expect to see:<br>
 
[[File:dietpi-launcher.png|frameless|600px|dietpit-launcher]]<br><br>
 
[[File:dietpi-launcher.png|frameless|600px|dietpit-launcher]]<br><br>
  
同理,下列DietPi提供的下列脚本也可以在命令行终端单独运行:
+
The following scripts can be run on a commandline utility too:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
dietpi-autostart      dietpi-cleaner        dietpi-drive_manager  dietpi-letsencrypt    dietpi-process_tool  dietpi-survey         
 
dietpi-autostart      dietpi-cleaner        dietpi-drive_manager  dietpi-letsencrypt    dietpi-process_tool  dietpi-survey         
Line 150: Line 154:
 
===DietPi-Software===
 
===DietPi-Software===
 
[[File:dietpi-software-install.png|frameless|600px|dietpi-software-install]]<br><br>
 
[[File:dietpi-software-install.png|frameless|600px|dietpi-software-install]]<br><br>
在Software Optimized里有大量常见的软件,预先配置好、开箱即用。<br>
+
"Software Optimized" has a lot of useful and out-of-box software utilities.<br>
 
[[File:dietpi-software-choice.png|frameless|600px|dietpi-software-choice]]<br><br>
 
[[File:dietpi-software-choice.png|frameless|600px|dietpi-software-choice]]<br><br>
选择您需要的软件,然后选择“Go >> Start installation for selected software”开始安装。
+
Select the utilities you need and proceed with "Go >> Start installation for selected software".
  
 
===DietPi-Config===
 
===DietPi-Config===
提供各种软硬件配置和功能:<br>
+
This script is used to configure hardware and software settings:<br>
 
[[File:dietpi-config.png|frameless|600px|dietpi-config]]<br><br>
 
[[File:dietpi-config.png|frameless|600px|dietpi-config]]<br><br>
本维基编写时,部分开发板硬件相关的功能并没有实现好,但是仍然有许多通用的软件功能可以使用。
+
Some hardware configurations might still be under development.
 
* Display Options
 
* Display Options
外观显示相关的设置,例如分辨率,LED的设置。
+
Display related settings such as resolution, LED setting and etc.
 
* Audio Options
 
* Audio Options
选择系统默认使用的声卡设备。
+
It specifies system's audio device
 
* Performance Options
 
* Performance Options
设置CPU的性能,例如CPU的分配策略,最大最小频率。
+
It specifies CPU's options such as strategy, min and max frequencies and etc.
 
* Advanced Options
 
* Advanced Options
设置swap文件的大小,是否使能: 网络时间同步、蓝牙、调试串口。
+
It specifies swap size, enable or disable, network time sync, Bluetooth, serial port and etc.
 
* Language/Regional Options
 
* Language/Regional Options
设置语言和时区。
+
It specifies language and timezone
 
* Security Options
 
* Security Options
设置hostname和password。
+
It specifies hostname and password
 
* Network Options: Adapters
 
* Network Options: Adapters
设置有线和无线网络,是否使用代理。
+
It specifies Ethernet, WiFi, proxy and etc.
 
* Network Options: Misc
 
* Network Options: Misc
设置是否apt软件源、ntp软件源等。
+
It specifies apt and ntp source and etc.
 
* AutoStart Options
 
* AutoStart Options
设置开机登录或者运行指定软件,可单独运行DietPi-AutoStart来进入该界面。
+
It specifies auto-run programs. You can do it by running "DietPi-AutoStart" too.
 
* Tools
 
* Tools
测试系统性能和稳定性的工具, 调用Benchmarks和stress工具。
+
Tools for testing system performance and reliability by utilizing "Benchmarks" and "stress" utilities.
  
 
===DietPi-Cron===
 
===DietPi-Cron===
 
[[File:dietpi-cron.png|frameless|600px|dietpi-cron]]<br><br>
 
[[File:dietpi-cron.png|frameless|600px|dietpi-cron]]<br><br>
将你想要定时运行的脚本放到/etc/cron.daily/目录下,然后通过该工具设置定时运行的时间。
+
Put the scripts you want to run at a specific time under the "/etc/cron.daily/" directory and set the time with this tool
  
 
===DietPi-Drive_Manager===
 
===DietPi-Drive_Manager===
 
[[File:dietpi-drive-manager.png|frameless|600px|dietpi-drive-manager]]<br><br>
 
[[File:dietpi-drive-manager.png|frameless|600px|dietpi-drive-manager]]<br><br>
管理各种存储器,例如SD卡,emmc,U盘。提供格式化设备、选择设备的挂载点、挂载网络设备等功能。
+
Manage storage devices such as SD card, emmc, USB drive and etc. You can format these devices and mount these devices with this tool.
  
 
===DietPi-Update===
 
===DietPi-Update===
 
[[File:dietpi-update.png|frameless|600px|dietpi-update]]<br><br>
 
[[File:dietpi-update.png|frameless|600px|dietpi-update]]<br><br>
一键升级DietPi的版本。
+
Upgraded DietPi as simple as "one-click".
  
 
===DietPi-Backup===
 
===DietPi-Backup===
 
[[File:dietpi-backup.png|frameless|600px|dietpi-backup]]<br><br>
 
[[File:dietpi-backup.png|frameless|600px|dietpi-backup]]<br><br>
支持备份和还原文件系统,默认生成的备份文件位于/mnt/dietpi-backup。
+
System backup and restoration. Backup files are under the "/mnt/dietpi-backup" directory.
  
 
===DietPi-Cleaner===
 
===DietPi-Cleaner===
 
[[File:dietpi-cleaner.png|frameless|600px|dietpi-cleaner]]<br><br>
 
[[File:dietpi-cleaner.png|frameless|600px|dietpi-cleaner]]<br><br>
清理文件系统,允许选择需要清理的组件(例如apt软件包,log文件等),运行模拟执行清理操作以防止误删除。
+
Clean file system. It allows users to select components to be removed(such as apt, log and etc).
  
 
===DietPi-CpuInfo===
 
===DietPi-CpuInfo===
 
[[File:dietpi-cpuinfo.png|frameless|600px|dietpi-cpuinfo]]<br><br>
 
[[File:dietpi-cpuinfo.png|frameless|600px|dietpi-cpuinfo]]<br><br>
显示CPU的频率、温度等信息。
+
Display CPU frequency, temperature and etc.
  
 
===DietPi-BugReport===
 
===DietPi-BugReport===
 
[[File:dietpi-bugreport.png|frameless|600px|dietpi-bugreport]]<br><br>
 
[[File:dietpi-bugreport.png|frameless|600px|dietpi-bugreport]]<br><br>
反馈Bug给DietPi的官方团队。
+
Report bugs to DietPi team.
 +
 
 +
==Update Log==
 +
===July-6-2018===
 +
* Released English version
 +
 
 +
===July-12-2018===
 +
* Updated section 2.1

Latest revision as of 02:33, 12 July 2018

查看中文

1 Introduction to DietPi

DietPi is a highly customized light-weighted Debian OS. It is developed and maintained by a third party. DietPi is a good choice for experienced developers and Linux fans. For those that are not familiar with it we suggest you use a ROM released at its official site. If you have any issues or questions you can go to DietPi's forum or its github site for help.
DietPi has the following features:
1. Light-weighted. ROM size is less than 500M
2. Highly optimized. CPU and RAM usage is small
3. Contains various utilities and provides user-friendly services
4. DietPi-Software: a good tool for installing packages
5. DietPi-Config: a good tool for system configuration
6. DietPi-Backup: a good tool for system backup and restoration
For more details you can refer to DietPi's official site
dietpi-features

2 Install DietPi

2.1 Download Image Files

DietPi image files are developed and maintained by the DietPi team. Its official site is DietPi download link,DietPi is being ported to more FriendlyElec's boards. So far the following boards already work with DietPi:
dietpi-friendlyelec-board
If you like DietPi and wish to join its development and maintenance youu can check its github site:DietPi Github and forum DietPi forum, and help make DietPi work with more FriendlyElec's boards.

Alternatively you can download DietPi's image files from FriendlyElec's DVD and the image files are under the DVD's "/unoffcial-ROMs" directory. The image files are obtained from its official site and changed a little bit by FriendlyElec. The changes include: * update Bootloader/Kernel/DTB/Modules with FriendlyElec's latest released versions.

  • Enable serial debug in dietpi.txt;
  • Change the APT source to http://ftp.cn.debian.org/debian/ in dietpi.txt. This is for convenience of Chinese users.
  • Disable NTP in dietpi.txt. This is to avoid failure of system initialization due to being unable to connect to NTP server.

If you cannot find a DietPi image file from FriendlyElec's DVD it means the board the DVD is associated with may not work with DietPi. If you directly download image files from DietPi's official site you need to check whether or not the image files have the latest Bootloader/Kernel/DTB/Modules. If these files are not the latest you need to update the image with the latest files.

2.2 Flash DietPi

The method to flash a DietPi image is the same as the method to flash a FriendlyElec image to a FriendlyElec board:
Extract an image file and the win32diskimager.rar utility under a Windows PC system. Insert a TF card (at least 4G) to the PC, run the win32diskimager utility as administrator, select the TF card drive and your wanted file and click on "Write" to start flashing.

2.3 Configure dietpi.txt

After a DietPi image is flashed to an SD card that SD card will have two sections:boot and rootfs. The boot section contains system files, a "dietpi" directory and a dietpi.txt file. The "dietpi" directory contains all DietPi related scripts. This directory and the files in it are generated and used for initializing system when DietPi is booted for the first time. The dietpi.txt is the configuration file DietPi uses to configure a system. We suggest you read this file carefully.

2.3.1 Networking Options

# Enable/disable Ethernet and WiFi. When both are enabled WiFi will be activated first.
AUTO_SETUP_NET_ETHERNET_ENABLED=1
AUTO_SETUP_NET_WIFI_ENABLED=0
 
# Set WiFi hotspot SSID and password
AUTO_SETUP_NET_WIFI_SSID=MySuperDooperWiFi
AUTO_SETUP_NET_WIFI_KEY=0123456789
# available | WPA-PSK / WPA-EAP / NONE | WEP=No longer supported
AUTO_SETUP_NET_WIFI_KEYMGR=WPA-PSK
 
# Set hostname
AUTO_SETUP_NET_HOSTNAME=DietPi
 
# Set Ethernet speed
# 0=automatic speed | 10 = 10mbit, 100 = 100mbit etc
AUTO_SETUP_NET_ETH_FORCE_SPEED=0

2.3.2 Misc Options

# swap size
# 0=Disabled | 1=auto (2GB-RAM = size) | 2+=manual
AUTO_SETUP_SWAPFILE_SIZE=1
# swap directory
AUTO_SETUP_SWAPFILE_LOCATION=/var/swap

2.3.3 Software Automation Options

# Install software automatically
AUTO_SETUP_AUTOMATED=0
 
# Global passwords including passwords for root, dietpi, MySQL, Transmission and etc
AUTO_SETUP_GLOBAL_PASSWORD=dietpi
 
# SSH server
#		0=none
#		-1=dropbear
#		-2=opensshserver
AUTO_SETUP_SSH_SERVER_INDEX=-1
 
# Log
#		0=none/manual
#		-1=ramlog 1h clear
#		-2=ramlog 1h save clear
#		-3=logrotate + rsyslog
AUTO_SETUP_LOGGING_INDEX=-1
 
# webserver
#	NB: This will get ignored, if you have manually selected any WEBSERVER_Stack.
#		0=Apache2
#		-1=Nginx
#		-2=Lighttpd
AUTO_SETUP_WEB_SERVER_INDEX=-2

2.3.4 DietPi-Config settings

# CPU strategy | ondemand | powersave | performance | conservative
CONFIG_CPU_GOVERNOR=ondemand
CONFIG_CPU_USAGE_THROTTLE_UP=50
 
# CPU's min and max frequencies
CONFIG_CPU_MAX_FREQ=Disabled
CONFIG_CPU_MIN_FREQ=Disabled
 
# Whether or not wait for network on system boot
CONFIG_BOOT_WAIT_FOR_NETWORK=1
 
# Enable/disable login with serial console.
CONFIG_SERIAL_CONSOLE_ENABLE=1
 
# Package source. You'd better choose a source accessible from your location.
CONFIG_APT_DEBIAN_MIRROR=http://ftp.cn.debian.org/debian/

The aforementioned options are only part of DietPi's features. For more details refer to the dietpi.txt file or visit DietPi's official site.

3 Work with DietPi

3.1 Boot DietPi for the First Time

DietPi's initialization is a complicated process. However after it is initialized it will be easy to use. Occasionally DietPi may not be able to correctly recognize a specific H3/H5 board but it will still work as long as it can recognize the board's SoC correctly.
Firstly you need to connect your board to the internet since initialization needs to work with the internet
On the very first boot DietPi will extend the rootfs section. After this is done DietPi will be rebooted and initialized based on the settings specified in the dietpi.txt file. For example if CONFIG_SERIAL_CONSOLE_ENABLE=1 DietPi will call the "DietPi-Set_Hardware" script to activate the serial-getty service and login with serial console will be enabled on next system boot. If you don't want your system to be rebooted you can login with SSH and the username is "root" and password is "dietpi". Here is a screenshot showing how DietPi-V6.7 is doing initialization on NanoPi-K1-Plus. Initialization may differ for different boards:
Run DietPi-Software:
dietpi-Software

Based on the system log we can see that "apt-get update" was executed. If your board isn't connected to the internet you need to reset the CONFIG_APT_DEBIAN_MIRROR option in the dietpi.txt file.
Run DietPi-Set_software to set global passwords:
dietpi-Set_software_gpd

Run DietPi-Set_software to set passwords:
dietpi-Set_software_upd

Prompt users to check IP with the "ip a" command:
DietPi-ip-a

Whether or not allow DietPi to collect and upload hardware information:
DietPi-Survey

DietPi is upgraded to the latest version:
dietpi-update-latest

After DitePi automatically upgrades itself it will reboot. After reboot it will run Dietpi-Software again and ask you whether or not to change global and user passwords and then go to DietPi-Software's main window on which you can select packages you want to install:
dietpi-software-install

We used the default settings and clicked on "Install" and "OK" to proceed:
dietpi-software-minimal

DietPi will reboot and after reboot initialization will be completed.

3.2 Introduction to DietPi Scripts

Dietpi has a lot of useful scripts. Their source code is under the "/rootfs/Dietpi" directory. We listed some important scripts here and they have been tested with NanoPi-K1-Plus + DietPi-V6.10.

3.2.1 DietPi-Launcher

We can use "dietpi-launcher" to run these scripts. You can run the "dietpi-launcher" on a commandline utility:

$ dietpi-launcher

Here is what you expect to see:
dietpit-launcher

The following scripts can be run on a commandline utility too:

dietpi-autostart      dietpi-cleaner        dietpi-drive_manager  dietpi-letsencrypt    dietpi-process_tool   dietpi-survey         
dietpi-backup         dietpi-config         dietpi-justboom       dietpi-logclear       dietpi-services       dietpi-sync           
dietpi-bugreport      dietpi-cron           dietpi-launcher       dietpi-morsecode      dietpi-software       dietpi-update

3.2.2 DietPi-Software

dietpi-software-install

"Software Optimized" has a lot of useful and out-of-box software utilities.
dietpi-software-choice

Select the utilities you need and proceed with "Go >> Start installation for selected software".

3.2.3 DietPi-Config

This script is used to configure hardware and software settings:
dietpi-config

Some hardware configurations might still be under development.

  • Display Options

Display related settings such as resolution, LED setting and etc.

  • Audio Options

It specifies system's audio device

  • Performance Options

It specifies CPU's options such as strategy, min and max frequencies and etc.

  • Advanced Options

It specifies swap size, enable or disable, network time sync, Bluetooth, serial port and etc.

  • Language/Regional Options

It specifies language and timezone

  • Security Options

It specifies hostname and password

  • Network Options: Adapters

It specifies Ethernet, WiFi, proxy and etc.

  • Network Options: Misc

It specifies apt and ntp source and etc.

  • AutoStart Options

It specifies auto-run programs. You can do it by running "DietPi-AutoStart" too.

  • Tools

Tools for testing system performance and reliability by utilizing "Benchmarks" and "stress" utilities.

3.2.4 DietPi-Cron

dietpi-cron

Put the scripts you want to run at a specific time under the "/etc/cron.daily/" directory and set the time with this tool

3.2.5 DietPi-Drive_Manager

dietpi-drive-manager

Manage storage devices such as SD card, emmc, USB drive and etc. You can format these devices and mount these devices with this tool.

3.2.6 DietPi-Update

dietpi-update

Upgraded DietPi as simple as "one-click".

3.2.7 DietPi-Backup

dietpi-backup

System backup and restoration. Backup files are under the "/mnt/dietpi-backup" directory.

3.2.8 DietPi-Cleaner

dietpi-cleaner

Clean file system. It allows users to select components to be removed(such as apt, log and etc).

3.2.9 DietPi-CpuInfo

dietpi-cpuinfo

Display CPU frequency, temperature and etc.

3.2.10 DietPi-BugReport

dietpi-bugreport

Report bugs to DietPi team.

3.3 Update Log

3.3.1 July-6-2018

  • Released English version

3.3.2 July-12-2018

  • Updated section 2.1