To set up the Mediasoup demo project, you will need to generate two SSL certificate files: fullchain.pem and privkey.pem. These files are essential for secure communication. Follow the steps below to create them using OpenSSL on Ubuntu 20.

Step 1: Install OpenSSL

If you haven't already installed OpenSSL, you can do so by running the following command:

sudo apt update
sudo apt install openssl

Step 2: Generate a Private Key

First, you need to create a private key. Execute the following command to generate it:

openssl genrsa -out privkey.pem 2048

Step 3: Create a Certificate Signing Request (CSR)

Next, generate a CSR using the private key:

openssl req -new -key privkey.pem -out request.csr

During this step, you will be prompted to enter information such as your country, state, and organization. Fill in the details as required.

Step 4: Generate the Self-Signed Certificate

Now, you can create a self-signed certificate that combines the private key and the CSR:

openssl x509 -req -days 365 -in request.csr -signkey privkey.pem -out fullchain.pem

Step 5: Verify the Certificates

To ensure that your certificates have been created successfully, you can check their contents:

openssl x509 -in fullchain.pem -text -noout
openssl rsa -in privkey.pem -check

Conclusion

You now have the fullchain.pem and privkey.pem files ready for use with the Mediasoup demo project. Make sure to place these files in the appropriate directory as specified in the project's documentation.