How one can help Tor anonymity network by setting up relay on his/her server?

First, the relay should be a server hosted in professional datacenter or the computer with high bandwidth stable internet and public IPv4.

How to setup Tor relay on Debian Linux:

wget https://raw.githubusercontent.com/d0xkb/debian/master/scripts/tor.sh
yum install gnupg 2>/dev/null||pacman -S gnupg 2>/dev/null||apt install gnupg 2>/dev/null
OPTIONAL: sed -i "s|[email protected]|YourEmailVisibleToPublicHere|g" tor.sh;sed -i "s|d0xkb|PublicNameOfTheRelayHere|g" tor.sh # PublicNameOfTheRelayHere must contain any special characters, spaces, dots etc. (only alphanumeric string)
sh tor.sh;systemctl restart tor@default
GPG error? try sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 74A941BA219EC810
or read official manual

How to setup Tor relay on CentOS Linux:

Edit highlighted phrases and then copy & paste whole block of code to the command line and enter.

yum install epel-release -y;yum clean all;yum install gnupg tor -y;systemctl stop tor;chkconfig tor on;mv /etc/tor/torrc /etc/tor/torrc.bak;
cat > /etc/tor/torrc <<EOF
Nickname myNiceRelay
ORPort 9001
SocksPort 0
ExitRelay 0
# Change the email address bellow and be aware that it will be published
ContactInfo [email protected]
EOF
systemctl enable tor;systemctl start tor;
done

===========
After a few hours or one day, you should be able to see your server on tor relays index here and here
It can take a few days until relay advertised bandwidth start increasing along with actual data transfer.

To limit data transfer of the Tor relay, one can add following into /etc/tor/torcc file and restart tor:
RelayBandwidthRate 1000 KBytes
RelayBandwidthBurst 1200 KBytes
MaxAdvertisedBandwidth 1 MBytes
AccountingStart month 1 00:00
AccountingMax 100 GB

MaxAdvertisedBandwidth allows limiting RAM usage of the server.

Official documentation for Tor relay setup here: https://trac.torproject.org/projects/tor/wiki/TorRelayGuide