These instructions are for acquiring, building, and installing openssl from source. Openssl is usually included in package managers as well.
https://github.com/openssl/openssl
Dependencies can be installed through a package manager such as apt, dnf, or brew.
$ cd ~/path/to/projects
$ git clone https://github.com/openssl/openssl.git
$ cd openssl
$ ./config
$ make
$ make test
$ sudo make install
By default, openssl will be installed to /usr/local.
$ openssl --version
You now have a default build of openssl installed to your machine.