Use the AWS documentation and install the headless version and if for ec2 web servers you would need to install the headless version
AWS doc
If you have multiple versions and want to switch use the last command in the answer by @rahimli