Home  /  Documentation  /  Cheat Sheets  /  Amazon Linux 2 Cheat Sheets

Amazon Linux 2 Cheat Sheets

I typically use default Amazon Linux 2 AMI for my applications. It qualifies for free 12 month trial and is well adjusted for their hardware. I've been using several Amazon Linux instances since 2015 and they run for years without a glitch! So I can recommend them with a clear conscience:

AWS instance images

Install GCC

sudo yum install gcc-c++

Install OpenSSL

sudo yum install openssl-devel

Install MySQL

sudo yum install mariadb-server sudo yum install mariadb-devel sudo systemctl start mariadb sudo systemctl enable mariadb # On production: sudo mysql_secure_installation # Some basic configuration tweaks: sudo vi /etc/my.cnf # Add in the [mysqld] section: wait_timeout=31536000 # (to prevent disconnecting after inactivity) max_allowed_packet=16M # (to allow bigger packets between app and server) sudo systemctl restart mariadb

(In case you were wondering, My and Maria are Monty's children.)

Node++ include and library paths

Edit $NPP_DIR/src/m

# Include path: export CPATH=/usr/include/mysql # Library path: export LIBRARY_PATH=/usr/lib64/mysql

Install Certbot

Provides free Let's Encrypt certificates

sudo amazon-linux-extras install epel sudo yum install certbot

Get a Let's Encrypt certificate via Certbot

certbot certonly --standalone -d example.com --debug

Renew a Let's Encrypt certificate

USE_PYTHON_3=1 certbot renew --debug --no-bootstrap --no-self-upgrade

Install Heirloom mailx

Provides simple mail commands for sending and reading emails (MUA = Mail User Agent)

sudo yum install mailx

Enable TLS for outgoing emails

Messages from the server will look more legitimate for the clients

# Add or change in /etc/postfix/main.cf smtpd_tls_security_level = may smtp_tls_security_level = $smtpd_tls_security_level # Restart service sudo systemctl restart postfix.service