In order to create a self signed certificate for a Linux server that runs apache you must first create the required public and private keys. You can easily do that using openssl package.
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key -out mysitename.crt
As a next step you should edit /etc/httpd/conf.d/ssl.conf file and include the new self signed certificate files. Keep in mind that files should be copied in the requested directories.
Lastly you can validate your certificate correctness by following my relevant article https://blog.geralexgr.com/cloud/install-entrust-ssl-chain-certificate-apache-2-red-hat-configuration