Difference between revisions of "APITestPage"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
 
(70 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Getting Started with OpenMediaVault/zh|查看中文]]
 
==OpenMediaVault version==
 
* OS: Debian 12<br />
 
* OpenMediaVault: 7.0.5-1 (Sandworm)<br />
 
* Docker: 26.0.1<br />
 
* Others: built-in OMV-Extras<br />
 
==Earlier version OpenMediaVault==
 
[[Getting Started with OpenMediaVault6|OpenMediaVault6]]
 
==First Look==
 
[[File:Openmediavault7.png|600px]]
 
==Supported platforms==
 
* RK3328<br />
 
* RK3399<br />
 
* RK3568<br />
 
* RK3588<br />
 
==Find IP Address==
 
Since the hostname is set by default to the model of the development board, you can use the "ping" command to obtain the IP address. For example, for CM3588, you can use the following command:
 
<syntaxhighlight lang="bash">
 
ping CM3588
 
</syntaxhighlight>
 
==Access the OpenMediaVault web page==
 
Enter the IP address of the development board in your web browser; the default login account for the web interface is:
 
<syntaxhighlight lang="bash">
 
Username: admin
 
Password: openmediavault
 
</syntaxhighlight>
 
==Change admin password==
 
Click on the profile icon in the upper-right corner of the web page, then select '''"Change Password"'''.
 
==Configure the web page timeout duration==
 
Go to '''System -> Workbench''' and adjust the '''"Auto Logout"''' time setting.
 
==Root Login via SSH==
 
<syntaxhighlight lang="bash">
 
ssh pi@YourIPAddress
 
</syntaxhighlight>
 
The default password is '''"pi"'''.
 
==Create the root user==
 
Create the root user and add user to the root and ssh groups:
 
<syntaxhighlight lang="bash">
 
sudo passwd root
 
sudo gpasswd -a root root
 
sudo gpasswd -a root _ssh
 
</syntaxhighlight>
 
You can now use the root user to log in via SSH:
 
<syntaxhighlight lang="bash">
 
ssh root@IPAddress
 
</syntaxhighlight>
 
==Set up your drives and shared folders==
 
Note: If the hard drive has already been initialized and RAID has been preserved, you can proceed directly to step four for mounting.<br /><br />
 
The difference between the following two Raid Profiles:
 
* MD RAID: has better performance, because it does a better job of parallelizing writes and striping reads.<br />
 
* Btrfs RAID: has better data safety, because the checksumming lets it ID which copy of a block is wrong when only one is wrong, and means it can tell if both copies are bad.<br />
 
More content please refre: [https://docs.openmediavault.org/en/latest/administration/storage/raid.html]
 
====Step 1: Wipe drives====
 
Go to '''Storage -> Disks''', choose your storage device, and click the "Wipe" icon to initiate disk erasure (please ensure your data is backed up). Typically, you can opt for a "Quick" erase option.<br />
 
If wiping isn't effective, you should first remove the shared folder and unmount it.
 
===Optional 1: Set up your drives with MD RAID===
 
* Configure your RAID
 
(Note: OMV does not support RAID for USB-connected devices)<br />
 
Go to '''Storage -> Multiple Device''', click the '''"+"''' icon, select the desired RAID level, and apply the settings.
 
* Setup file systems
 
Go to '''Storage" -> "File Systems''', click on the '''"+"''' icon, and for the type, it's recommended to choose "BTRFS", Select "Single" and devices. <br />
 
If you created a RAID in the previous step, select a device starting with "/dev/md". If it's a USB hard drive, choose "/dev/sda".<br />
 
After formatting is complete, OpenMediaVault will prompt you to select the file system to mount.
 
===Optional 2: Set up your drives with Btrfs RAID===
 
(Note: OMV does not support RAID for USB-connected devices)<br />
 
Go to '''Storage -> File Systems''' click the '''"+"''' icon, choose the '''"BTRFS"''', choose the RAID level, select your disks, and then save the settings.<br />
 
After formatting is complete, openmediavault will let you choose which file system to mount, it doesn't list all the disks, so you should choose a drive that starts with /dev/nvme.
 
===Final Step: Create shared folders===
 
Go to '''Storage -> Shared Folders''', click the '''"+"''' icon to create two folders named "nfs" and "samba." We will use these folders for testing NFS and Samba sharing in the following steps.<br />
 
(Note: If there were previously created shared folders on the drive, you can recreate them with the same names, and the data will be preserved.)
 
==Create NAS users==
 
Debian system users or Linux users created via the command line may lack certain permissions required for services like Samba and NFS. Therefore, it is recommended to use the OpenMediaVault interface to create a user specifically for accessing Samba and NFS shares. Here, I will create a user and group named "nasuser":<br />
 
<br />
 
Go to '''Users -> Groups''' and then click the '''"+"''' icon to create a user group named "nasuser".<br />
 
Go to '''Users -> "Users''' then click the '''"+"''' icon to create a user named "nasuser", change user's shell to "/usr/sbin/nologin", and select the "nasuser" and "users" groups.
 
==Create a Samba share==
 
Go to '''Services -> SMB/CIFS -> Settings''', check the box at the top for "Enabled," select "SMB1" as the minimum protocol version, and then click "Save"<br />
 
<br />
 
Go to '''Services -> SMB/CIFS -> Shares''', click the '''"+"''' button, and in the "Shared folder" field, select the folder you want to share. as an example, here i select the "samba" folder<br />
 
<br />
 
Testing: <br />
 
On a Mac system, right-click Finder, select '''"Connect to Server"''', and enter "smb://YourIPAddress" (replace with the actual IP address). An authentication dialog will appear; enter the username "nasuser" and the password to access the share.
 
==Create an NFS share==
 
Go to '''Services -> NFS -> Settings''', check the box at the top for "Enabled", and in the "Versions" section, select all versions, including "NFSv2", then click "Save" and apply the settings.<br />
 
<br />
 
Go to '''Services -> NFS -> Shares''', click the '''"+"''' button, and in the "Shared folder" field, select the folder you want to share. here i select the "nfs" folder. In the "Client" section, enter the IP range or specific IPs that are allowed to access the share (e.g., 192.168.1.0/24). Set the permissions to "Read/Write", in the "Extra Options" field, Input:
 
<syntaxhighlight lang="bash">
 
rw,async,insecure,no_subtree_check,all_squash,anonuid=0,anongid=0
 
</syntaxhighlight>
 
Then click "Save" and apply the settings.
 
===Testing NFS mounting on a Mac===
 
Viewing OpenMediaVault's NFS Share Information via Command Line:
 
<syntaxhighlight lang="bash">
 
# showmount -e YourIPAddress
 
Exports list on YourIPAddress:
 
/export                             192.168.1.0/24
 
/export/nfs                         192.168.1.0/24
 
</syntaxhighlight>
 
Right-click Finder on your Mac, select "Connect to Server," and input the following in the address bar:
 
<syntaxhighlight lang="bash">
 
nfs://YourIPAddress/export/nfs
 
</syntaxhighlight>
 
===Testing NFS mounting on Linux===
 
Installing the NFS client
 
<syntaxhighlight lang="bash">
 
sudo apt install nfs-common
 
</syntaxhighlight>
 
Start to mount:
 
<syntaxhighlight lang="bash">
 
sudo mount -t nfs YourIPAddress:/export/nfs /mnt/nfs
 
</syntaxhighlight>
 
Checking the Status
 
<syntaxhighlight lang="bash">
 
# df -h | grep nfs
 
YourIPAddress:/export/nfs  7.3G  3.5M  6.8G    1% /mnt/nfs
 
</syntaxhighlight>
 
To configure automatic mounting at boot time, append the following line to the /etc/fstab file:
 
<syntaxhighlight lang="bash">
 
YourIPAddress:/export/nfs /mnt/nfs nfs defaults 0 0
 
</syntaxhighlight>
 
==Transferring Docker Data to a Hard Drive==
 
Go to '''Storage -> Shared Folders''', and click the '''"+"''' icon to create three folders, namely:
 
<syntaxhighlight lang="bash">
 
docker            -> The Docker data directory, defined in /etc/docker/daemon.json
 
docker-compose    -> Location of compose files
 
docker-data      -> Location of persistent container data
 
docker-app        -> For personal use, storing Dockerfiles and data
 
</syntaxhighlight>
 
Go to '''Services -> Compose''' enter the '''"Settings"''' interface, and configure the "Shared folder" for "Compose Files" and "Data":<br />
 
Access the SSH terminal and execute the following command to move Docker data to the shared folder, where "/srv/dev-disk-by-uuid-XXYYZZ/docker" represents the absolute path of the shared folder, which can be obtained from the "Storage" -> "Shared Folders" list on the web interface:
 
<syntaxhighlight lang="bash">
 
su root
 
systemctl stop docker.socket docker.service
 
mv /var/lib/docker/* /srv/dev-disk-by-uuid-XXYYZZ/docker/
 
</syntaxhighlight>
 
On the web interface, set the '''"Docker storage"''' to the absolute path of the "docker" shared folder. save the settings and apply, and then reboot the system.<br />
 
Summaries:<br />
 
'''Compose Files's Shared folder -> on /dev/md0, docker-compose'''<br />
 
'''Data's Shared folder -> on /dev/md0, docker-data'''<br />
 
'''Docker's Docker storage-> on /srv/dev-disk-by-uuid-XXYYZZ/docker/'''<br />
 
==Install Nextcloud with Docker==
 
Run the following command in the terminal:
 
<syntaxhighlight lang="bash">
 
su root
 
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
 
mkdir nextcloud
 
cd nextcloud
 
mkdir data
 
  
docker run -d -p 8888:80  --name nextcloud \
+
{{BurnLinuxToExtDrive-Rockchip/zh|NanoPC-T4}}
    -v $PWD/data:/var/www/html --restart=always \
+
{{BurnLinuxToExtDrive-Rockchip|NanoPC-T4}}
    --privileged=true  arm64v8/nextcloud
+
</syntaxhighlight>
+
you can access the Nextcloud web interface by opening a web browser and navigating to http://YourIPAddress:8888/ (replace YourIPAddress with the actual IP address of your device).
+
==Install Filebrowser with Docker==
+
Run the following command in the terminal:
+
<syntaxhighlight lang="bash">
+
su root
+
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
+
mkdir filebrowser
+
cd filebrowser
+
 
+
docker run -d -v $(readlink -f /srv/dev-disk-by-uuid-*):/srv \
+
    -v $PWD/filebrowserconfig.json:/etc/config.json \
+
    -v $PWD/database.db:/etc/database.db -p 8080:80 \
+
    --restart=always --name filebrowser \
+
    filebrowser/filebrowser
+
</syntaxhighlight>
+
 
+
After completing the setup, you can access the Filebrowser web interface by opening a web browser and navigating to http://YourIPAddress:8080/ (replace YourIPAddress with the actual IP address of your device). The default username and password for Filebrowser are both "admin".
+
==Install Jellyfin with Docker==
+
Go to '''Storage -> Shared Folders''',  click the '''"+"''' icon to create a "media" folder for storing multimedia resources. Then, in the command-line terminal, you can run the following command to install Jellyfin:
+
<syntaxhighlight lang="bash">
+
su root
+
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
+
mkdir jellyfin
+
cd jellyfin
+
mkdir config cache
+
 
+
docker run -d --name jellyfin \
+
-v $PWD/config:/config \
+
-v $PWD/cache:/cache \
+
-v $(readlink -f /srv/dev-disk-by-uuid-*/media):/media \
+
-p 8096:8096 \
+
--restart=always \
+
jellyfin/jellyfin
+
</syntaxhighlight>
+
After completing the setup, you can access the Jellyfin web interface by opening a web browser and navigating to http://YourIPAddress:8096/ (replace YourIPAddress with the actual IP address of your device). This will allow you to access and manage your media content using Jellyfin.
+
==Install Portainer with Docker==
+
Run the following command in the terminal:
+
<syntaxhighlight lang="bash">
+
su root
+
cd $(readlink -f /srv/dev-disk-by-uuid-*/docker-app)
+
mkdir portainer
+
cd portainer
+
mkdir data
+
 
+
docker run -d \
+
  --name portainer \
+
  --restart=always \
+
  -e TZ=Asia/Shanghai \
+
  -p 8000:8000 \
+
  -p 9000:9000 \
+
  -v /var/run/docker.sock:/var/run/docker.sock \
+
  -v $PWD/data:/data \
+
  portainer/portainer-ce:latest
+
</syntaxhighlight>
+
After completing the setup, you can access the Portainer web interface by opening a web browser and navigating to http://YourIPAddress:9000/ (replace YourIPAddress with the actual IP address of your device). The default administrator account username and password are both "admin".
+

Latest revision as of 09:58, 29 October 2024

1 安装系统到M.2或USB硬盘

可以通过使用TF卡启动eFlasher系统,将引导和系统分别安装到不同存储设备,但是由于CPU不支持直接从M.2和USB设备引导,所以虽然系统可以安装到M.2和USB设备,但是引导仍然需要安装到eMMC或者TF卡。
操作步骤如下:

  • 准备一张32G或以上容量的TF卡;
  • 访问此处的下载地址下载文件名为XXXX-eflasher-multiple-os-YYYYMMDD-30g.img.gz的固件(位于"01_系统固件/02_SD卡刷机固件(SD-to-eMMC)"目录);
  • 将固件写入TF卡,在NanoPC-T4上连接好存储设备,插入TF卡上电开机,接下来要在界面上操作,如果没有显示设备,可以使用VNC代替,请参考使用VNC操作eFlasher;
  • 在eFlasher界面上,首先选择要安装的OS,然后选择引导安装的目的地 (通常选eMMC),以及选择系统安装的目的地(可以选eMMC,M.2硬盘,USB存储设备等),如下图所示:

Eflasher-select-boot-and-system-device.png

  • 没有eMMC时可使用TF卡作为引导,方法是将另一个TF卡通过USB读卡器插入USB端口,然后选择USB设备作为引导安装目的地,从而实现从TF卡引导,但系统存放在M.2或USB硬盘的目的;
  • 烧写完成后,从NanoPC-T4弹出SD卡,引导在eMMC的情况下,NanoPC-T4会自动重启至你刚刚烧写的系统,如果引导安装在TF卡,则需要拨掉电源,插入TF引导卡再上电开机;
  • 更详细的安装指南请参考此处;

2 Installing the System to M.2 or USB Drive

You can use a TF card to boot the eFlasher system, allowing the boot and system to be installed on different storage devices. However, since the CPU doesn’t support booting directly from M.2 and USB devices, the system can be installed on M.2 and USB devices, but the boot must still be installed on eMMC or a TF card.
Steps are as follows:

  • Prepare a TF card with a capacity of 32GB or larger.
  • Visit [the download link here](http://download.friendlyelec.com/APITestPage) to download the firmware file named XXXX-eflasher-multiple-os-YYYYMMDD-30g.img.gz (located in the “01_Official images/02_SD-to-eMMC images” directory).
  • Flash the firmware to the TF card, connect the storage device you intend to use on NanoPC-T4, insert the TF card and power on, we need to perform the operations in the eFlasher GUI. If your NanoPC-T4 does not have a display interface, you can use VNC; refer to Using VNC to Operate eFlasher.
  • In the eFlasher GUI, select the OS to install, and in the OS settings interface, choose the destination for boot installation (typically eMMC), then choose the destination for system installation (options include eMMC, M.2 hard drive, USB storage, etc.), as shown below:

Eflasher-select-boot-and-system-device.png

  • If no eMMC is available, the TF card can serve as the boot by inserting another TF card into the USB port via a USB card reader and selecting it as the boot destination, enabling booting from the TF card with the system stored on the M.2 or USB drive.
  • After flashing, eject the SD card from NanoPC-T4. If booting from eMMC, NanoPC-T4 will automatically restart into the newly flashed system. If boot installation is on a TF card, power off, insert the boot TF card, and power on again.
  • For a more detailed installation guide, please refer to this link.