# サーバーの設定 (バージョン 2.0 以降)

> Run the setup to configure version 2.0 or later of the Unity Licensing Server.

サーバーの設定は、[Unity Licensing Server を設定](/licensing-server/server-setup.md.md) するためのエンドツーエンドのプロセスの一部です。

> **Important:**
>
> This page このページはライセンスサーバーのバージョン 2.x に適用されます。バージョン 1.x を設定する場合は、[サーバーの設定 (バージョン 1.x)](./server-setup-cfg-v1.md) を参照してください。

## 設定の概要

ライセンスサーバーを設定するには、2 つの手順に従います。

* 最初の手順では、ライセンスサーバー上で `setup` コマンドを実行します。`setup` コマンドによって 3 つのファイルが作成されます。
  * **ライセンスサーバー設定**ファイル (`licensing-server-config.json`) は、指定するライセンスサーバー設定パラメーターを保存します。サーバーを再設定する場合、`setup` コマンドはこのファイルを読み込み、保存されている設定パラメーターをデフォルト値としてロードします。
  * **サービス設定**ファイル (`services-config.json`) は、サーバーを設定または再設定した後、すべてのクライアントコンピューターに展開します。
  * **サーバー登録リクエスト**ファイル (`server-registration-request.xml`) には、サーバーからのマシンバインディング情報が含まれています。このファイルを 2 番目の手順でアップロードし、サーバーを登録します。

* 2 番目の手順では、[Unity ID ポータル](https://id.unity.com) でサーバーの登録とシートの管理を行います。`setup` コマンドで生成された XML ファイルをアップロードしてサーバーを登録します。以下の情報が含まれています。
  | **要素**                   | **説明**          |
  | ------------------------ | --------------- |
  | `"FirstPhysicalAddress"` | サーバーの MAC アドレス  |
  | `"Platform"`             | サーバーの OS        |
  | `"ProcessorCount"`       | サーバーのプロセッサーコアの数 |
  | `"MachineName"`          | サーバーの名前         |

## 始める前に

必ず以下を準備してください。

* [サーバー設定ファイルをダウンロード](/licensing-server/server-setup-dl.md.md) します。
* ライセンシングサーバーが使用するプロトコル (HTTP または HTTPS) を決めます。
* HTTPS プロトコルを使用する場合は、Personal Information Exchange 形式 (`.pfx`) のサーバー証明書があることを確認します。
  > **Important:**
  >
  > Unity doe Unity はこの証明書を提供しません。この証明書を管理し、ユーザーのコンピューターで受け入れ可能にするのは、ITチームの責任です。
* `Unity.Licensing.Client` がライセンスを取得できるよう、ネットワークインターフェースのファイアウォールを設定します。
* クライアント接続を許可するポートを決定します。選択したポートが別のアプリケーションによってすでに使用されていないことを確認します。`setup` コマンドを実行して空いていないポートを選択した場合、設定を最初からやり直して、別のポートを選択する必要があります。

## setup コマンドの実行##running-the-setup-command

以下のステップに従って、コマンドラインで対話型の設定を開始します。

1. Linux ターミナルまたは Windows PowerShell で、OS に応じたコマンドを実行します。

   * **Linux**: `./Unity.Licensing.Server setup`
   * **Windows:** `.\Unity.Licensing.Server.exe setup`

   ターミナルまたは PowerShell ウィンドウに以下のメッセージが表示されます。

   ```bash
   Welcome to Unity Licensing Server setup command line interface.
   This setup will help you configure your license server 
   and generate server registration request file.

   Enter the server name (e.g. LicenseServer):  [DESKTOP] TestServer
   ```

2. サーバーの名前を入力しします。

3. ライセンシングサーバーが使用するプロトコル (HTTP または HTTPS) を設定します。

   ```bash
   Do you want the licensing server to use HTTPS? [Y/n]
   Enter path to the certificate PFX file (Press Enter to skip):
   Enter the PFX password for "httpscertificate.pfx":
   ```

   * サーバー証明書がない場合は `n` を入力することでスキップできます。
   * サーバー証明書がある場合は `y` を入力してから、指示されている場所に `.pfx` ファイルのパスとパスワードを設定します。

4. Unity Licensing Server がサービスを提供するネットワークインターフェースのインデックス番号を入力します。

   ```bash
   List of available network interfaces on this host
   - [1] en0 (8C:85:90:CA:72:DC) 192.168.0.51
   - [2] gpd0 (02:50:41:00:01:01) 10.1.4   2228
   Enter the index number of the network interface which server will operate on:
   ```

   > **Note:**
   >
   > This inte Unity Licensing Client がライセンスの取得のために通信できるよう、このインターフェースのファイアウォールを設定する必要があります。

5. クライアントを接続するポート番号を入力します。ポートの競合を避けるため、4 桁または 5 桁の番号を指定して、既知の範囲外のポートを使用することをお勧めします。

   ```bash
   Enter server's listening port number (between 0 and 65535):  [80]
   ```

   > **Note:**
   >
   > If the 選択したポートがすでに別のアプリケーションによって使用され、サーバーが起動できない場合は、再び `setup` コマンドを最初から実行して、違うポートを選択してください。

6. 管理者アクセス権を設定します。

* ライセンスサーバーは、管理者による Licensing Server ダッシュボードと `admin` API エンドポイントへのアクセスを制限することができます。これらのツールには詳しいサーバー情報が含まれており、一般的な設定の問題の診断とトラブルシューティングに役立ちます。
* `admin` のユーザー名にパスワードを設定して、管理者アクセス権を設定します。このパスワードを覚えておいてください。管理者ツールにアクセスしたいすべてのユーザーは、これらの認証情報を使用します。

```bash
Credentials are required to access the administration dashboard and API.
The administrator username is "admin".
Create a password for "admin" (8-12 characters):  ********
Confirm the password for "admin":  ********
```

{/* I can fake a "Step 7" with HTML entity (&#55;) but it does NOT wrap properly */}

{/* Trying to force step 7 with the following syntax did NOT work: <ol start="7" />etc */}

コンソール出力を確認し、`server-registration-request.xml` の場所をメモしてください。このファイルは、このページで後述する次のタスク、[サーバーの登録とシートの管理](#register-server) で必要になります。

### サンプル出力

設定が正常に完了すると、ターミナルまたは PowerShell ウィンドウに以下のような出力が表示されます。

```bash
Generating signing key... Done

Generating server configuration ...Done
Generating services configuration ...Done
Reloading configuration... Done
Generating server registration request file... Done
Setting up file permissions... Done

- - - -
Setup Completed!
- - - -

<Note>
  Server Registration Request
</Note>
Please go to Unity ID portal -> Organizations -> [Organization Name] -> 
Subscriptions & Services -> [Floating Subscription] -> Configure License 
Server, upload server-registration-request.xml, and follow the 
instructions to receive a compressed license archive file.

File to upload:
/home/adminuser/server-registration-request.xml

<Note>
  Services Configuration File
</Note>
Generated services-config.json file must be copied to the following location
on all end user computer in order to enable floating licensing:
  - Windows: %PROGRAMDATA%\Unity\config\
  - MacOS:  /Library/Application Support/Unity/config/
  - Linux:  /usr/share/unity3d/config/

File to copy:
/home/adminuser/services-config.json

WARNING: Please make sure to backup the following directory as it contains
essential data for operating the licensing server:
  ... [Path varies by server version and operating system]
```

## サーバーの登録とシートの管理##register-server

Unity ID ポータルへのライセンスサーバーの登録は、1 回限りの操作です。

以下の手順に従って、サーバーの登録とシートの管理を行ってください。

1. Unity ID ポータル ([id.unity.com](https://id.unity.com/)) に移動します。
2. **Organizations** (組織) を選択し、ご自身の組織を選択します。
3. **Subscriptions & Services** (サブスクリプションとサービス) を選択し、フローティングライセンスサブスクリプションを選択します。
4. **Configure License Server** (ライセンスサーバーの設定) を選択します。
5. **Upload server registration** (サーバー登録のアップロード) を選択し、この設定によって生成された `server-registration-request.xml` ファイルをアップロードします。
6. 左側のパネルの **Licenses** (ライセンス) を選択し、先ほど登録したサーバーを展開し、割り当てられているシート数を表示します。
7. このライセンスにまだシートが割り当てられていない場合、またはさらにシートを追加する場合は、**Manage seats** (シート管理) を選択します。値を入力して、**Save** (保存) を選択します。

これでサーバーの初期設定が完了します。

## 次のステップ

[ライセンスアーカイブファイルのダウンロードとインポート](/licensing-server/server-setup-lic.md.md) に進み、ライセンスサーバーの設定を続けます。
