1. Clone the Repository Open a terminal and clone the Xray-core repository:

    git clone <https://github.com/XTLS/Xray-core.git>
    cd Xray-core
    
  2. Download Dependencies In the Xray-core directory, download the necessary dependencies:

    go mod download
    
  3. Build the Xray Binary Run the following commands to build the Xray binary:

  4. Create a Configuration File Xray requires a JSON configuration file to run. Create one named config.json (or use an existing one if you have it). Here’s a simple example configuration:

    json
    Copy code
    {
      "log": {
        "loglevel": "info"
      },
      "inbounds": [
        {
          "port": 1080,
          "protocol": "socks",
          "settings": {
            "auth": "noauth",
            "udp": true}
        }
      ],
      "outbounds": [
        {
          "protocol": "freedom",
          "settings": {}
        }
      ]
    }
    
    
  5. Run the Xray Binary Now you can run Xray with the configuration file:

    ./xray -c config.json