Catalog / Software & Servers Cheatsheet

Software & Servers Cheatsheet

A comprehensive cheat sheet covering essential software and server concepts, commands, and configurations, designed to aid both beginners and experienced professionals.

Server Basics

Server Types

Web Server

Hosts websites and web applications. Examples: Apache, Nginx.

Database Server

Stores and manages databases. Examples: MySQL, PostgreSQL, MongoDB.

File Server

Stores and manages files for network users. Examples: FTP, NFS, Samba.

Mail Server

Handles email sending and receiving. Examples: Sendmail, Postfix, Exim.

Application Server

Hosts and runs applications. Examples: Tomcat, JBoss, GlassFish.

DNS Server

Translates domain names to IP addresses.

Operating Systems

Linux

Popular open-source OS known for stability and flexibility. Common distributions: Ubuntu, CentOS, Debian.

Windows Server

Microsoft’s server OS, widely used in enterprise environments.

macOS Server

Apple’s server OS, suitable for smaller deployments.

FreeBSD

Another open-source OS known for security and performance.

Basic Commands (Linux)

ls

List files and directories.

cd

Change directory.

mkdir

Create directory.

rm

Remove file or directory.

cp

Copy file or directory.

mv

Move or rename file or directory.

Web Servers

Apache

Apache is a widely used web server known for its flexibility and modularity.

Key Configuration File: httpd.conf or apache2.conf

Common Modules: mod_rewrite, mod_ssl, mod_authz_core

Commands:

  • sudo systemctl start apache2 - Start Apache
  • sudo systemctl stop apache2 - Stop Apache
  • sudo systemctl restart apache2 - Restart Apache
  • sudo systemctl status apache2 - Check Apache Status

Virtual Hosts:

Configure multiple websites on a single server using virtual hosts. Define each virtual host in separate configuration files within the /etc/apache2/sites-available/ directory and enable them using a2ensite.

Nginx

Nginx (pronounced “engine-x”) is a high-performance web server known for its speed and efficiency.

Key Configuration File: nginx.conf

Configuration Directory: /etc/nginx/

Commands:

  • sudo systemctl start nginx - Start Nginx
  • sudo systemctl stop nginx - Stop Nginx
  • sudo systemctl restart nginx - Restart Nginx
  • sudo systemctl status nginx - Check Nginx Status

Server Blocks:

Similar to Apache’s Virtual Hosts, Nginx uses Server Blocks to configure multiple websites. Define each server block in separate files within the /etc/nginx/sites-available/ directory and enable them using symbolic links in the /etc/nginx/sites-enabled/ directory.

Common Configuration Directives

listen

Specifies the port the server listens on.

server_name

Specifies the domain name the server responds to.

root

Specifies the document root directory.

index

Specifies the index file to serve.

Database Servers

MySQL/MariaDB

MySQL is a popular open-source relational database management system (RDBMS). MariaDB is a fork of MySQL.

Key Configuration File: my.cnf

Default Port: 3306

Commands:

  • sudo systemctl start mysql - Start MySQL
  • sudo systemctl stop mysql - Stop MySQL
  • sudo systemctl restart mysql - Restart MySQL
  • sudo systemctl status mysql - Check MySQL Status

Common MySQL CLI Commands:

  • mysql -u <user> -p - Connect to MySQL server
  • SHOW DATABASES; - List all databases
  • CREATE DATABASE <database_name>; - Create a new database
  • USE <database_name>; - Select a database
  • SHOW TABLES; - List tables in the selected database

PostgreSQL

PostgreSQL is an advanced open-source relational database management system (RDBMS) known for its reliability and features.

Key Configuration File: postgresql.conf

Default Port: 5432

Commands:

  • sudo systemctl start postgresql - Start PostgreSQL
  • sudo systemctl stop postgresql - Stop PostgreSQL
  • sudo systemctl restart postgresql - Restart PostgreSQL
  • sudo systemctl status postgresql - Check PostgreSQL Status

Common PostgreSQL CLI Commands:

  • psql -U <user> -d <database> - Connect to PostgreSQL server
  • \l - List all databases
  • CREATE DATABASE <database_name>; - Create a new database
  • \c <database_name> - Connect to a database
  • \dt - List tables in the connected database

MongoDB

MongoDB is a popular NoSQL document database.

Key Configuration File: mongod.conf

Default Port: 27017

Commands:

  • sudo systemctl start mongod - Start MongoDB
  • sudo systemctl stop mongod - Stop MongoDB
  • sudo systemctl restart mongod - Restart MongoDB
  • sudo systemctl status mongod - Check MongoDB Status

Common MongoDB Shell Commands:

  • mongo - Connect to MongoDB shell
  • show dbs - List all databases
  • use <database_name> - Switch to a database
  • show collections - List collections in the current database
  • db.<collection_name>.find() - Find documents in a collection

Software Configuration & Troubleshooting

Configuration Management

Ansible:

An open-source automation tool used for configuration management, application deployment, and task automation.

Key Concepts: Playbooks, Inventory, Modules.

Chef:

A configuration management tool that uses Ruby-based DSL to define infrastructure as code.

Key Concepts: Recipes, Cookbooks, Nodes.

Puppet:

An open-source configuration management tool that allows you to define the desired state of your infrastructure.

Key Concepts: Manifests, Modules, Agents.

Troubleshooting

Log Files

Check log files for error messages and warnings. Common locations: /var/log/ (Linux), Event Viewer (Windows).

Resource Monitoring

Monitor CPU, memory, disk, and network usage. Tools: top, htop, vmstat, iostat (Linux), Task Manager (Windows).

Network Troubleshooting

Use tools like ping, traceroute, netstat, and tcpdump to diagnose network issues.

Process Management

Use ps, kill, and systemctl to manage processes. Identify and terminate problematic processes.

Security Best Practices

Keep Software Updated:

Regularly update your operating system and software to patch security vulnerabilities.

Use Strong Passwords:

Enforce strong password policies and use multi-factor authentication (MFA).

Firewall Configuration:

Configure firewalls to restrict network access to essential services only.