How can I create and use self signed server certificate?

In development of a web service, I can use self signed server certificate for testing under HTTPS. How can we make a client (possibly run in the same host, but maybe a different host) work with the service in HTTPS?

On Ubuntu 18.04, I try to run a gRPC service in ASP.NET Core. https://stackoverflow.com/a/59702094 says

On Ubuntu the standard mechanism would be:

  • dotnet dev-certs https -v to generate a self-signed cert
  • convert the generated cert in ~/.dotnet/corefx/cryptography/x509stores/my from pfx to pem using openssl pkcs12 -in <certname>.pfx -nokeys -out localhost.crt -nodes
  • copy localhost.crt to /usr/local/share/ca-certificates
  • trust the certificate using sudo update-ca-certificates
  • verify if the cert is copied to /etc/ssl/certs/localhost.pem (extension changes)
  • verify if it’s trusted using openssl verify localhost.crt

Does it only mention about creating and self signing a server certificate for a service, but not setting up for a client? I heard that a browser will warn about self signed server certificates, so wondering how to prepare a web service client to handle self signed server certificates?

Can dotnet dev-certs https -v be replaced with some general command which doesn’t depend on .NET Core? Note: dotnet dev-certs https -v actually doesn’t work on Ubuntu, but only on Windows and Mac. See the link for workaround.

Thanks.