{"id":35324678,"url":"https://github.com/imosudi/lamp-stack-installer","last_synced_at":"2026-04-07T16:31:34.197Z","repository":{"id":322082243,"uuid":"1088145697","full_name":"imosudi/lamp-stack-installer","owner":"imosudi","description":"Automated LAMP stack installer for Ubuntu 24.04+ with MySQL 8.0, PHP 8.x, Apache2, and PHPMyAdmin. Features automatic SSL via Let's Encrypt, security hardening, UFW firewall setup, and persistent logging. Supports both interactive and non-interactive (--auto) deployment modes for production servers.","archived":false,"fork":false,"pushed_at":"2025-11-02T12:20:36.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-02T14:22:08.612Z","etag":null,"topics":["apache","automation","bash-script","certbot","deployment","devops","lamp-stack","lets-encrypt","mysql","php","phpmyadmin","security-hardening","server-setup","ssl","ubuntu","web-server"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imosudi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-02T12:07:13.000Z","updated_at":"2025-11-02T12:26:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/imosudi/lamp-stack-installer","commit_stats":null,"previous_names":["imosudi/lamp-stack-installer"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/imosudi/lamp-stack-installer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imosudi%2Flamp-stack-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imosudi%2Flamp-stack-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imosudi%2Flamp-stack-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imosudi%2Flamp-stack-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imosudi","download_url":"https://codeload.github.com/imosudi/lamp-stack-installer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imosudi%2Flamp-stack-installer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31520424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","automation","bash-script","certbot","deployment","devops","lamp-stack","lets-encrypt","mysql","php","phpmyadmin","security-hardening","server-setup","ssl","ubuntu","web-server"],"created_at":"2025-12-31T01:11:20.990Z","updated_at":"2026-04-07T16:31:34.181Z","avatar_url":"https://github.com/imosudi.png","language":"Shell","readme":"# LAMP Stack Installer for Ubuntu 24.04+\n\n![Ubuntu](https://img.shields.io/badge/Ubuntu-24.04%2B-orange?logo=ubuntu)\n![License](https://img.shields.io/badge/License-BSD_3--Clause-blue)\n![Shell](https://img.shields.io/badge/Shell-Bash-green?logo=gnu-bash)\n\nAutomated **LAMP (Linux, Apache, MySQL, PHP)** stack installer for Ubuntu 24.04+ with full support for both **interactive** and **non-interactive (`--auto`)** deployment modes. Built for secure, repeatable production deployments.\n\n---\n\n## Features\n- Installs **Apache2**, **MySQL 8.0**, **PHP 8.x**, and **phpMyAdmin**\n- Automatic **SSL provisioning** via Let's Encrypt (**Certbot**)\n- Security hardening with sane defaults (MySQL bind, file permissions, headers)\n- Configures **UFW firewall** (HTTP/HTTPS/SSH) and optional SSH lock-down\n- Persistent installation logging under `/var/log/lamp-installer/`\n- Modular architecture — decomposed into `modules/` for maintainability\n- Supports both **interactive** and **non-interactive (`--auto`)** deployment\n\n---\n\n## Modular Architecture\n\nThe installer is decomposed into modules in `modules/`:\n\n| Module | Purpose |\n|--------|---------|\n| `helpers.sh` | Common utilities: logging, validation, password generation |\n| `config.sh` | CLI parsing, environment variables, interactive fallbacks |\n| `install_packages.sh` | Installs base packages and prerequisites |\n| `apache.sh` | Apache2 installation and VirtualHost configuration |\n| `mysql.sh` | MySQL 8.0 installation and hardening |\n| `php.sh` | PHP 8.x installation and detection of PHP-FPM/mod_php |\n| `phpmyadmin.sh` | phpMyAdmin installation and Apache integration |\n| `certbot.sh` | Certbot installation and automatic certificate issuance |\n| `firewall.sh` | UFW setup and rule management |\n| `cleanup.sh` | Final tasks: remove temp creds, write credential file |\n| `install.sh` | Orchestrator: sources modules in correct order and controls flow |\n| `uninstall.sh` | (Optional) Reversal script to remove installed components |\n\n---\n\n## Installation\n\n### 1) Clone the repository\n```bash\ngit clone https://github.com/imosudi/lamp-stack-installer.git\ncd lamp-stack-installer\n```\n\n### 2) Run interactively (recommended for first-time use)\n```bash\nsudo bash install.sh\n```\n\n### 3) Run non-interactively (CI / VPS provisioning)\nProvide required parameters when using `--auto`:\n```bash\nsudo bash install.sh --auto --domain example.com --email admin@example.com   --ip 203.0.113.10 --mysql-root-pass 'StrongRootPwd!' --phpmyadmin-pass 'StrongPhpPwd!'\n```\n\n**Notes for `--auto` mode**\n- `--domain` and `--email` are **required** for automated SSL issuance.\n- Ensure DNS A records for both `example.com` and `phpmyadmin.example.com` point to the server IP before requesting certificates.\n\n---\n\n## Configuration / Environment variables (optional)\n\nYou can also create an `.env` file in the repo root and the installer will load it (example):\n\n```bash\nAUTO=true\nDOMAIN=example.com\nCERTBOT_EMAIL=admin@example.com\nMANUAL_IP=203.0.113.10\nMYSQL_ROOT_PASSWORD=StrongRootPwd!\nPHPMYADMIN_PASSWORD=StrongPhpPwd!\nALLOW_SSH=true\nLOGFILE=/var/log/lamp-installer/install.log\n```\n\n---\n\n## What the Installer Does (high level)\n\n1. Validates inputs (IP, domain) and checks DNS resolution (best effort)  \n2. Updates packages and installs prerequisites (curl, wget, openssl, snapd)  \n3. Installs and configures Apache (virtual hosts, security headers)  \n4. Installs PHP and required extensions (detects PHP-FPM vs mod_php)  \n5. Installs MySQL 8.0, sets secure root password, and applies hardening  \n6. Installs phpMyAdmin and configures a dedicated Apache vhost  \n7. Configures UFW firewall (allows 80/443 and OpenSSH by default)  \n8. Installs Certbot via `snap` and requests certificates for both main domain and `phpmyadmin.` subdomain (if email provided)  \n9. Writes credentials to `/root/lamp_credentials.txt` (chmod 600) and cleans temporary files  \n10. Logs everything to `LOGFILE` (default `/var/log/lamp-installer/install.log`)\n\n---\n\n## Security Hardening Highlights\n- MySQL `bind-address` set to `127.0.0.1` and `local-infile=0`  \n- Anonymous MySQL users removed and test DB dropped  \n- Strong TLS via Let’s Encrypt (automated)  \n- Apache security headers added (`X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy`)  \n- UFW default `deny incoming` and `allow outgoing` policy  \n- Credentials file permissioned to `600` and stored in `/root`\n\n---\n\n## Logs \u0026 Artifacts\n\nAll persistent logs are stored under:\n```\n/var/log/lamp-installer/\n```\n\nKey files:\n- `/var/log/lamp-installer/install.log` — installation console output and errors  \n- `/root/lamp_credentials.txt` — generated credentials (chmod 600)  \n- Apache + MySQL logs remain in their standard locations (`/var/log/apache2/`, `/var/log/mysql/`)\n\n---\n\n## Example Output (success)\n```\n[2025-11-02 14:01:20] Installing Apache2...\n[2025-11-02 14:02:01] Installing MySQL server and client...\n[2025-11-02 14:03:05] Configuring UFW...\n[2025-11-02 14:04:10] Obtaining SSL via Let's Encrypt...\n[2025-11-02 14:05:33] ✅ LAMP stack installation completed successfully!\nCredentials saved to: /root/lamp_credentials.txt\n```\n\n---\n\n## Uninstallation\n\nA provided `uninstall.sh` (optional) should be used with caution. A minimal reversal might remove packages and sites but **won't** destroy user data unless explicitly designed to do so.\n\n```bash\nsudo bash uninstall.sh\n```\n\n---\n\n## Contributing\n\nContributions welcome — please fork, create a feature branch, and open a pull request. Suggested improvements:\n- Support for multiple domains and SAN certificates\n- Automatic backup \u0026 restore hooks for MySQL\n- SELinux/AppArmor policy guides for hardened hosts\n\n---\n\n\n## License\n\nThis project is licensed under the **BSD 3-Clause License** — see the [LICENSE](./LICENSE) file for details.\n\n```\nBSD 3-Clause License\n\nCopyright (c) 2025, Mosudi Isiaka\nAll rights reserved.\n```\n\n## 👤 Author\n\n**Mosudi Isiaka**  \n📧 [mosudi.isiaka@gmail.com](mailto:mosudi.isiaka@gmail.com)  \n🌐 [https://mioemi.com](https://mioemi.com)   \n💻 [https://github.com/imosudi](https://github.com/imosudi)\n\n\n---","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimosudi%2Flamp-stack-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimosudi%2Flamp-stack-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimosudi%2Flamp-stack-installer/lists"}