VPS Management

Post-Install Scripts

11min

Automate your VPS deployment

Discover a feature that can significantly ease your server setup process on EDIS Global VPS Hosting - Post-Install Scripts. This feature can be found in the auto-installer options within your KVM panel. It's a boon for those installing multiple servers with a specific setup or "recipe". All you need to do is paste your recipe/script or upload it directly into the tool, and it will be executed automatically right after the installation completes.

Example Scripts

Below are three example scripts tailored for different operating systems:

For Debian-based OS (Debian/Ubuntu)

The following script was successfully tested on Debian 12. This script performs the following operations on a Debian-based OS (Debian, Ubuntu, Linux Mint, Kali Linux, Raspbian, Pop!_OS, MX Linux, Deepin):

  1. Disables password authentication for the root user, allowing only SSH key authentication.
  2. Changes the default SSH port from 22 to 10022 and restarts the SSH daemon to apply the changes.
  3. Updates the system packages, upgrades existing packages, and installs the components of a LAMP stack (Linux, Apache, MySQL, and PHP).
  4. Sends a notification through Pushover (a notification service) indicating that the post-installation script has completed, along with the server's IP address.
Shell


This below example post install script performs the installation oft a simple firewall. This script does three main things:

  1. It installs a firewall tool called UFW (uncomplicated firewall)
  2. It sets up rules in the firewall to allow incoming connections for SSH on port 22, web traffic on port 80, and secure web traffic on port 443.
  3. It turns the firewall on with these rules in place.
Shell


The length of our Post Install Scripts is unrestricted. You can combine and tailor them to create intricate setup processes and streamline your deployment.



For RPM-based OS (CentOS, Rocky Linux, ...)

The following script performs several actions on a RPM-based OS (RHEL, Fedora, CentOS, openSUSE, SLES, Oracle Linux, Rocky Linux, AlmaLinux)

  1. SSH Configuration
    It restricts root login to SSH key authentication only, disabling password access. It then restarts the SSH daemon to apply these changes.
  2. LAMP Stack Installation: Updates the system packages. Installs necessary utilities: curl, wget, and unzip. Installs and starts the Apache web server, and ensures it starts on boot. Installs and starts the MariaDB server, and ensures it starts on boot. Installs PHP along with some additional modules.
  3. Notification (optional)
    Sends a notification via the Pushover service, indicating that the post-installation script has completed and providing the IP address of the server.
Shell




Use cases for Post install scripts

The above scripts serve as illustrative examples, showcasing how you can leverage the Post Install Script feature. The potential applications are boundless.

Here are some more examples of tasks you can automate with post-install scripts:

User and Security Configuration:

  • Creating user accounts and setting permissions.
  • Configuring firewalls and security groups.
  • Setting up SSH keys and disabling root login.
  • Installing and configuring security software like Fail2Ban.

Networking Configuration:

  • Configuring routing rules and network interfaces.
  • Setting up VPNs or other networking services.

Software Installation and Configuration:

  • Installing and configuring web servers like Nginx or Apache.
  • Setting up databases like MySQL, PostgreSQL, or MongoDB.
  • Installing and configuring caching servers like Redis or Memcached.
  • Deploying your application and its dependencies.

Monitoring and Logging:

  • Installing and configuring monitoring solutions like Zabbix, Prometheus, or Nagios.
  • Setting up logging solutions like ELK stack (Elasticsearch, Logstash, Kibana).
  • Configuring notifications for monitoring and logging alerts.

Backup and Recovery:

  • Setting up automated backups for your system and databases.
  • Configuring replication for databases.
  • Setting up disaster recovery solutions.

Custom Scripting:

  • Running custom scripts to meet your particular needs.
  • Automating routine maintenance tasks.
  • Running data processing or analysis scripts.

Cloud Services Integration:

  • Configuring integration with cloud services like AWS, GCP, or Azure.
  • Setting up cloud-based storage solutions.
  • Configuring cloud-based monitoring and logging solutions.

Container Orchestration:

  • Installing and configuring Docker.
  • Setting up Kubernetes or other container orchestration systems.
  • Deploying containers and managing containerized applications.

These examples illustrate a spectrum of automated tasks you can accomplish with EDIS Globals post-install scripts, making server setup and management more efficient and error-free. By crafting tailored scripts, you can significantly streamline your deployment processes and operational workflows on our VPS Hosting.