This script automates the setup of a LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu-based systems. It includes options to create a development environment with a virtual host and database for your project. The script is designed to reduce manual work and ensure a smooth installation process. This script was developed as part of a thesis project to explore automation in LAMP stack setup.
For any issues or suggestions, feel free to open an issue in the GitHub repository.
- Apache (Web Server)
- MySQL (Database Server)
- PHP (Server-side Scripting Language)
- Additional PHP modules (
libapache2-mod-php
,php-mysql
, etc.) - UFW (Firewall)
- Sets a default
ServerName
to suppress warnings. - Restarts the Apache service to apply changes.
- Enables UFW and allows traffic for Apache and SSH.
- Creates a new project directory.
- Sets up an Apache virtual host.
- Creates a MySQL database for the project.
- Adds the project to
/etc/hosts
for local access.
- Displays installed versions of Apache, MySQL, and PHP.
- All script output is logged to
/var/log/lamp_install.log
.
- An Ubuntu-based system.
- Basic familiarity with the Linux terminal.
- The script must be run as root (or with
sudo
).
Clone the repository or download the script:
git clone https://github.com/Wiltzsu/lamp-setup.git
cd lamp-setup
Make the script executable and run it:
chmod +x lamp_install.sh
sudo ./lamp_install.sh
sudo apt purge -y apache2 mysql-server php libapache2-mod-php php-mysql
sudo apt autoremove -y
sudo rm -rf /var/www/html/<project_name>
sudo rm -rf /etc/apache2/sites-available/<project_name>.conf
sudo rm -rf /var/log/apache2/<project_name>-error.log
sudo rm -rf /var/log/apache2/<project_name>-access.log
sudo sed -i "/<project_name>.local/d" /etc/hosts
This project is licensed under the MIT License.