0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Fedora35でDLNAサーバーを構築

Posted at

仕事でのミスとかでストレスが溜まりまくったのと、ジャンク品で買ったNASが使い物にならなかったので、
手持ちの1/4UサイズのサーバーのマザーボードをNASのケースにぶちこんで500GBのHDDと余ってた2.5インチのHDDをぶち込んだらNASという名のサーバーが増殖したのでDLNAサーバーを構築してみた

環境とか

こういったエントリーを書くときはOS情報とか出すのが流行りらしいので書いておく

[admin@baseserver ~]$ cat /etc/os-release
NAME="Fedora Linux"
VERSION="35 (Thirty Five)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora Linux 35 (Thirty Five)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=35
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=35
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
[admin@baseserver ~]$

ディスク回り
[admin@baseserver ~]$ df -hT
ファイルシス                   タイプ   サイズ  使用  残り 使用% マウント位置
devtmpfs                       devtmpfs   1.9G     0  1.9G    0% /dev
tmpfs                          tmpfs      1.9G     0  1.9G    0% /dev/shm
tmpfs                          tmpfs      776M  1.4M  774M    1% /run
/dev/mapper/fedora_fedora-root xfs         15G  3.3G   12G   22% /
tmpfs                          tmpfs      1.9G  4.0K  1.9G    1% /tmp
/dev/sde1                      xfs       1014M  247M  768M   25% /boot
tmpfs                          tmpfs      388M     0  388M    0% /run/user/1000
tmpfs                          tmpfs      388M     0  388M    0% /run/user/0
/dev/sdb                       xfs        466G   86G  381G   19% /mnt/disk1 今回共有しようとしているファイルがあるディレクトリ
/dev/sda                       xfs        466G  3.3G  463G    1% /mnt/disk2
/dev/sdc                       xfs        466G  3.3G  463G    1% /mnt/disk3
/dev/sdd                       xfs        466G  3.3G  463G    1% /mnt/disk4
//192.168.0.104/disk1          cifs       932G  323G  609G   35% /mnt/nec_disk1
//192.168.0.104/disk2          cifs       932G  6.6G  925G    1% /mnt/nec_disk2
//192.168.0.104/disk3          cifs       932G  6.6G  925G    1% /mnt/nec_disk3
//192.168.0.104/disk4          cifs       932G  6.6G  925G    1% /mnt/nec_disk4
[admin@baseserver ~]$

ディスクのフォーマットとかRAIDとかは人によるので好きな状態で使ってください。

minidlnaインストール前の下準備

CentOS7とかであればググれば出てくるEPELリポジトリからの追加方法がありますが、Fedora35 になると書いてあるサイトが古かったり乗っ取られたりしてるので、今回はrpmfusion-free-releaseを有効にしてからminidlnaをインストールする方法を記載します。
依存関係が気になる方はインストールするパッケージ名を参考にご自分で確認してください。

rpm-ostreeをインストール

[root@fedora ~]# dnf install rpm-ostree -y

依存関係を解決されながらインストールします。

rubberbandとladspaをインストール

[root@fedora ~]# dnf install rubberband ladspa -y

rpmfusion-free-releaseをインストール

[root@fedora ~]# dnf install -y  https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

dnf updateを実施

[root@fedora ~]# dnf update -y
RPM Fusion for Fedora 35 - Free                                                                             171 kB/s | 934 kB     00:05
RPM Fusion for Fedora 35 - Free - Updates                                                                    10 kB/s |  12 kB     00:01
依存関係が解決しました。
行うべきことはありません。
完了しました!
[root@fedora ~]# 

完了後、"RPM Fusion for Fedora 35 - Free"が有効化になっているのを確認。
無効化されているリポジトリも出てくるので冗長ならgrepで絞ってください

[root@fedora ~]# dnf repolist all
repo id                                                     repo の名前                                                               状態
fedora                                                      Fedora 35 - x86_64                                                        有効化
fedora-cisco-openh264                                       Fedora 35 openh264 (From Cisco) - x86_64                                  有効化
fedora-cisco-openh264-debuginfo                             Fedora 35 openh264 (From Cisco) - x86_64 - Debug                          無効化
fedora-debuginfo                                            Fedora 35 - x86_64 - Debug                                                無効化
fedora-modular                                              Fedora Modular 35 - x86_64                                                有効化
fedora-modular-debuginfo                                    Fedora Modular 35 - x86_64 - Debug                                        無効化
fedora-modular-source                                       Fedora Modular 35 - Source                                                無効化
fedora-source                                               Fedora 35 - Source                                                        無効化
rpmfusion-free                                              RPM Fusion for Fedora 35 - Free                                           有効化
rpmfusion-free-debuginfo                                    RPM Fusion for Fedora 35 - Free - Debug                                   無効化
rpmfusion-free-source                                       RPM Fusion for Fedora 35 - Free - Source                                  無効化
rpmfusion-free-updates                                      RPM Fusion for Fedora 35 - Free - Updates                                 有効化
rpmfusion-free-updates-debuginfo                            RPM Fusion for Fedora 35 - Free - Updates Debug                           無効化
rpmfusion-free-updates-source                               RPM Fusion for Fedora 35 - Free - Updates Source                          無効化
rpmfusion-free-updates-testing                              RPM Fusion for Fedora 35 - Free - Test Updates                            無効化
rpmfusion-free-updates-testing-debuginfo                    RPM Fusion for Fedora 35 - Free - Test Updates Debug                      無効化
rpmfusion-free-updates-testing-source                       RPM Fusion for Fedora 35 - Free - Test Updates Source                     無効化
tailscale-stable                                            Tailscale stable                                                          有効化
updates                                                     Fedora 35 - x86_64 - Updates                                              有効化
updates-debuginfo                                           Fedora 35 - x86_64 - Updates - Debug                                      無効化
updates-modular                                             Fedora Modular 35 - x86_64 - Updates                                      有効化
updates-modular-debuginfo                                   Fedora Modular 35 - x86_64 - Updates - Debug                              無効化
updates-modular-source                                      Fedora Modular 35 - Updates Source                                        無効化
updates-source                                              Fedora 35 - Updates Source                                                無効化
updates-testing                                             Fedora 35 - x86_64 - Test Updates                                         無効化
updates-testing-debuginfo                                   Fedora 35 - x86_64 - Test Updates Debug                                   無効化
updates-testing-modular                                     Fedora Modular 35 - x86_64 - Test Updates                                 無効化
updates-testing-modular-debuginfo                           Fedora Modular 35 - x86_64 - Test Updates Debug                           無効化
updates-testing-modular-source                              Fedora Modular 35 - Test Updates Source                                   無効化
updates-testing-source                                      Fedora 35 - Test Updates Source                                           無効化
[root@fedora ~]#

本題minidlnaのインストールと設定

一部サイトだと開けるポートとか記載がないので書いておきます。
なお、8200/UDPは開ける必要ないです。

minidlnaをインストール

[root@fedora ~]# dnf install minidlna -y

/etc/minidlna.confの設定
設定すべき部分のみ書いておきます。
詳細な設定方法はCentOS8とかで設定してる人のページを参照してください。

[root@fedora ~]# vi /etc/minidlna.conf


# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200 # 標準だとこのポートを開放する必要あり

# network interfaces to serve, comma delimited (8 interfaces max)
# network_interface=eth0

# specify the user account name or uid to run as
# user=jmaggard

# set this to the directory you want scanned.
# * if you want multiple directories, you can have multiple media_dir= lines
# * if you want to restrict a media_dir to specific content types, you
#   can prepend the types, followed by a comma, to the directory:
#   + "A" for audio  (eg. media_dir=A,/home/jmaggard/Music)
#   + "V" for video  (eg. media_dir=V,/home/jmaggard/Videos)
#   + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
#   + "PV" for pictures and video (eg. media_dir=PV,/home/jmaggard/digital_camera)
# media_dir=/opt
media_dir=A,/mnt/disk1/music #上にも書いてありますが"A"であれば音楽ファイルの共有となるので"M"としないこと
media_dir=V,/mnt/disk1/Video

# set this to merge all media_dir base contents into the root container
# note: the default is no
# merge_media_dirs=no

# set this if you want to customize the name that shows up on your clients
# friendly_name=My DLNA Server
friendly_name=BeseServer DLNA # サーバー名好きな名前でいいです

[root@fedora ~]# 

ポート開放
1900番についてはいるか分からないですが開けときます。

[root@fedora ~]# firewall-cmd --add-port=8200/tcp --zone=public --permanent
success
[root@fedora ~]# firewall-cmd --add-port=8200/udp --zone=public --permanent
success
[root@fedora ~]# firewall-cmd --add-port=1900/udp --zone=public --permanent
success
[root@fedora ~]# firewall-cmd --reload
success
[root@fedora ~]#

minidlnaの起動と、システム起動時に起動する設定

[root@fedora ~]# systemctl restart minidlna
[root@fedora ~]# systemctl enable minidlna

起動後、ブラウザのURLに以下のように入れて、minidlnaが起動しているか確認できます

http://サーバーのIP:8200/

あとはお好きなDLNA対応機器やクライアントツールを使用して楽しんでください

参考にしたサイト

FreeBSD あれこれ - Fedora - 34 - 共通事項 - リポジトリ追加
CentOSで自宅サーバー構築 - DLNAサーバー構築(ReadyMedia(旧MiniDLNA))
せろとにんぱわー. - CentOS7でReadyMedia(MiniDLNA)を使ってDLNAミュージックストリーミングサーバを作る
サーバ構築.net - CentOS8のfirewallでポート開放する手順

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?