> For the complete documentation index, see [llms.txt](https://deun-services.gitbook.io/deun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://deun-services.gitbook.io/deun/d-music/installation.md).

# Installation

Welcome! Follow these step-by-step instructions to set up and start using the resource. Even if you're new to this, you'll find this guide easy to follow.

### Important

1. **Join Discord and Verify Your Payment:**

   * Join the Discord server using the link below.
   * Read the messages in the `#verify-your-payment` channel.
   * You should have received your `transactionid` in the email from Tebex.

   Discord Link: <https://discord.gg/tngc5yN6mf>

### Installation

Follow the guide, make sure to go through every step

<details>

<summary>1. Add the Resource to Your Server</summary>

Drag and drop the resource folder into your server's `resource` folder.

</details>

<details>

<summary>2. Update server.cfg</summary>

Add the following lines to your `server.cfg` file **before** `d-phone`:

```cfg
ensure d-music
ensure d-phone
```

</details>

<details>

<summary>3. Import the SQL File</summary>

To set up the database, follow these steps to import the `sql.sql` file:

1. **Locate the `sql.sql` File**: It should be in the root directory of the resource you downloaded.
2. **Open Your Database Management Tool**: This could be tools like phpMyAdmin, HeidiSQL, MySQL Workbench, or any other MySQL-compatible tool you are comfortable with.
3. **Connect to Your Database**: Use your database connection details (hostname, username, password, database name).
4. **Import the `sql.sql` File**:
   * Look for an "Import" or "Run SQL File" option in your database tool.
   * Select the `sql.sql` file from the file picker.
   * Run the import. This will create the necessary tables and data required for the resource.

</details>

<details>

<summary>4. Configure the API URL</summary>

Next, you need to configure the API URL for the server to connect properly:

1. **Open the `Config.lua` File**: Use any text editor like Notepad++, Sublime Text, or Visual Studio Code.
2. **Find the `apiUrl` Variable**: Look for a line that starts with `apiUrl =`.
3. **Set Your API URL**:

   * The URL should be your server's IP address and port. By default, the port is usually `3000`.
   * Example Configuration:

   ```lua
   apiUrl = 'http://127.0.0.1:3000'
   ```

   Replace 127.0.0.1 with your actual server IP if different.

</details>

<details>

<summary>5. Open Port 3000 on Your Server</summary>

To allow communication through port `3000`, it must be open and accessible. Follow these steps based on your operating system:

**For Windows:**

1. Open the **Control Panel** and go to `System and Security` > `Windows Defender Firewall`.
2. Click on **Advanced settings**.
3. In the left pane, click on **Inbound Rules**, then select **New Rule**.
4. Choose **Port** and click **Next**.
5. Select **TCP** and specify `3000` as the port.
6. Select **Allow the connection**, then click **Next**.
7. Choose when the rule applies (Domain, Private, Public), then click **Next**.
8. Give the rule a name (e.g., "API Server Port 3000") and click **Finish**.

[Watch Windows Tutorial](https://www.youtube.com/watch?v=Hon3k7iqK4Y)

**For Linux:**

1. Open your terminal.
2. Use the following commands to open port 3000

```
sudo ufw allow 3000/tcp
sudo ufw reload
```

[Watch Linux Tutorial](https://www.youtube.com/watch?v=7c_V_3nWWbA)

</details>

<details>

<summary>6. Set Up API Keys</summary>

To integrate with external services like Spotify and YouTube, you need to set up API keys. Follow the steps below to configure them:

1. **Locate the `config.lua` File**: This file contains placeholders for your API keys.
2. **Open the `config.lua` File**: Use any text editor (such as Notepad++, Sublime Text, or Visual Studio Code) to open the file.

**Set Up the Spotify API:**

To integrate Spotify with your application, you need to obtain your API keys (`Client ID` and `Client Secret`) from Spotify's developer portal. Follow these detailed steps:

1. **Obtain Your API Keys from** [**Spotify for Developers**](https://developer.spotify.com):
   * Go to the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard/applications).
   * **Sign in** with your Spotify account. If you don't have an account, you'll need to create one.
   * Once logged in, click on **"Create an App"**.
   * Fill in the required information, such as the **App Name** and **App Description**.
   * Agree to the terms and click **"Create"**.
   * After the app is created, you'll be redirected to the app's settings page.
   * Here, you'll find your **Client ID** and a button to reveal your **Client Secret**.
2. **Follow** [**this video tutorial**](https://www.youtube.com/watch?v=mBgg9i1ghNw) to understand the steps to get your Client ID and Client Secret:
   * The video provides a visual walkthrough on how to navigate the Spotify Developer Dashboard, create an application, and retrieve the `Client ID` and `Client Secret`.
3. **Configure Redirect URIs** (if required):
   * Go to your app settings and find the **Redirect URIs** section.
   * Click on **"Add Redirect URI"** and enter the URL where your app will handle authentication redirects. This URL must match the URL used in your application code. ( Just add <http://yourserverip:3000> )
   * Click **"Save"** to store your changes.
4. **Update the config.lua File** with your Spotify credentials:

   * Open the config.lua file in a text editor.
   * Add the following lines, replacing `your_spotify_client_id` and `your_spotify_client_secret` with the actual values obtained from the Spotify Developer Dashboard:

   ```lua
   SPOTIFY_CLIENT_ID = "your_spotify_client_id"
   SPOTIFY_CLIENT_SECRET = "your_spotify_client_secret"
   ```

**Set Up the Google API:**

To integrate YouTube with your application, you need to obtain a YouTube API key from the Google Cloud Platform. Follow these detailed steps:

1. **Obtain a YouTube API Key**:
   * Go to the [Google Cloud Console](https://console.cloud.google.com/).
   * If you don’t have a Google account, create one. Otherwise, sign in with your existing Google account.
   * **Create a New Project**:
     * Click on the **Select a project** dropdown at the top and then click **New Project**.
     * Enter a **Project Name** and select your **Billing Account** (if applicable). Click **Create**.
   * **Enable YouTube Data API v3**:
     * Once your project is created, go to the **Navigation Menu** (three horizontal lines at the top-left) > **APIs & Services** > **Library**.
     * In the search bar, type **YouTube Data API v3**.
     * Click on **YouTube Data API v3** and then click **Enable**.
   * **Create API Credentials**:
     * After enabling the API, go to **APIs & Services** > **Credentials**.
     * Click on **Create Credentials** and select **API Key**.
     * A pop-up will appear with your newly created API key. **Copy this key** as you will need it in the next step.
   * **Restrict Your API Key** (optional but recommended):
     * Click **Restrict Key** to set restrictions on how and where the key can be used, such as limiting it to specific IP addresses or HTTP referrers.
     * Set the restrictions according to your needs and click **Save**.
2. **Follow** [**this tutorial**](https://www.youtube.com/watch?v=LLAZUTbc97I) for a visual guide on generating your YouTube API key and understanding how to configure it properly.
3. **Update the config.lua File** with your YouTube API key:

   * Open the config.lua file in a text editor.
   * Add the following line, replacing `your_youtube_api_key` with the actual API key obtained from the Google Cloud Console:

   ```lua
   YOUTUBE_API_KEY = "your_youtube_api_key"
   ```

</details>

<details>

<summary>7. Start the HTML Server</summary>

To run the HTML server, follow these instructions based on your operating system:

1. **Navigate to the `htmlServer` Folder**: This folder should be within the resource files you downloaded.

**For Windows:**

* Simply double-click the `musicServer.exe` file to start the server.

**For Linux:**

1. Ensure you are in the same folder as `musicServer`.
2. Before the first start, make the file executable by running:

   ```bash
   chmod +x musicServer
   ```
3. Then, start the server with:

   ```bash
   ./musicServer
   ```

</details>

You are now all set up! If you encounter any issues or need further assistance, please visit our Discord server for support.
