このチュートリアルでは、Ubuntu 20.04 LTSにSambaをインストールする方法を紹介します。知らなかった人のために、Sambaは無料のソフトウェア再実装またはオープンソース実装です。ユーザーが共有ファイルプリンターやその他のネットワークリソースにアクセスできるようにするSMB/CIFSプロトコルの
この記事は、少なくともLinuxの基本的な知識があり、シェルの使用方法を知っていること、そして最も重要なこととして、サイトを独自のVPSでホストしていることを前提としています。インストールは非常に簡単で、ルートアカウントで実行されていますが、そうでない場合は、'sudo
を追加する必要があります。 ‘ルート権限を取得するコマンドに。 Ubuntu 20.04(Focal Fossa)にSambaを段階的にインストールする方法を紹介します。 Ubuntu 18.04、16.04、およびLinuxMintなどの他のDebianベースのディストリビューションでも同じ手順に従うことができます。
前提条件
- 次のオペレーティングシステムのいずれかを実行しているサーバー:Ubuntu 20.04、18.04、16.04、およびLinuxMintなどの他のDebianベースのディストリビューション。
- 潜在的な問題を防ぐために、OSの新規インストールを使用することをお勧めします
non-root sudo user
またはroot user
へのアクセス 。non-root sudo user
として行動することをお勧めします ただし、ルートとして機能するときに注意しないと、システムに害を及ぼす可能性があるためです。
Ubuntu 20.04 LTSFocalFossaにSambaをインストールする
手順1.まず、次のapt
を実行して、すべてのシステムパッケージが最新であることを確認します。 ターミナルのコマンド。
sudo apt update sudo apt upgrade
手順2.ホストファイルを構成します。
WindowsホストファイルにUbuntu20.04LTSを追加する必要があります。これを行うには、Windowsで次のコマンドを実行します。
notepad C:\\Windows\System32\drivers\etc\hosts
名前付きubuntu2004によって参照されるUbuntuのローカルエントリを追加して保存する必要があります:
192.168.1.3 ubuntu2004.localhost ubuntu2004
次に、以下のコマンドを実行し、Windowsのホスト名でIPを入力し、ファイルを保存して、終了します。
sudo nano /etc/hosts
完了したら、管理者権限を使用してWindowsで次のコマンドを実行します。
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes
ステップ3.Ubuntu20.04にSambaをインストールします。
ターミナルで次のコマンドを実行して、UbuntuシステムにSambaをインストールします。
sudo apt install samba samba-common-bin
Sambaサービスが実行されているかどうかを確認するには、以下のコマンドを実行します。
sudo systemctl status smbd
手順4.Sambaパブリック共有を構成します。
次のコマンドを実行して、Samba構成を開きます。
sudo nano /etc/samba/smb.conf
次の行を追加します:
======================= Global Settings ======================= [global] ## Browsing/Identification ### # Change this to the workgroup/NT-domain name your Samba server will part of workgroup = WORKGROUPnetbios name = ubuntu2004 security = user proxy = no map to guest = bad user #### Networking #### # The specific set of interfaces / networks to bind to # This can be either the interface name or an IP address/netmask; # interface names are normally preferred interfaces = 127.0.0.0/8 eth0 # Only bind to the named interfaces and/or networks; you must use the # 'interfaces' option above to use this. bind interfaces only = yes #Most people will want "standalone server" or "member server". #Running as "active directory domain controller" will require firstserver role = standalone server obey pam restrictions = yes #This boolean parameter controls whether Samba attempts to sync the Unix[public] path = /samba/public browseable = yes guest ok = yes guest only = yes read only = no force user = nobody force create mode = 0777 force directory mode = 0777
変更を加えた後、Sambaデーモンを再起動します:
sudo systemctl restart smbd
次に、全員がアクセスできるパブリックフォルダを作成する必要があります:
sudo mkdir -p /samba/public
正常に終了したら、Sambaサーバーを再起動します。共有フォルダーはWindows10または使用しているWindowsで確認できます。
手順5.ファイアウォールを構成します。
アクティブなファイアウォールがある場合は、次を実行します:
sudo ufw allow 'Samba'
おめでとうございます!Sambaが正常にインストールされました。Ubuntu20.04LTS Focal FossaシステムにSambaをインストールするためにこのチュートリアルを使用していただき、ありがとうございます。追加のヘルプや役立つ情報については、公式のSambaを確認することをお勧めします。ウェブサイト。