This Bash script automates the installation of a LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack along with additional tools like FFmpeg, Node.js, and Composer. It is designed for Ubuntu-based systems and simplifies the setup process for web development environments.
- System Update: Automatically updates the system packages.
- Apache Installation: Installs and configures the Apache web server.
- MariaDB Installation: Installs MariaDB and prompts for secure installation.
- PHP Installation: Allows the choice between PHP 7.4 and PHP 8.3 and installs core and optional PHP extensions.
- FFmpeg Installation: Installs FFmpeg for multimedia processing.
- Node.js Installation: Installs Node.js version 20.
- Composer Installation: Installs Composer for PHP dependency management.
- Default Web Page: Sets up a default web page for the server.
- Apache Configuration: Configures Apache to serve the default page.
- A system running Ubuntu or a compatible Debian-based distribution.
- Sudo privileges to install packages and modify system configurations.
-
Clone the Repository:
apt update apt install git apt install sudo git clone https://github.com/saifulcoder/vps-setup.git cd vps-setup -
Make the Script Executable:
chmod +x install_lamp.sh
-
Run the Script:
./install_lamp.sh
-
Post-Installation: After the script completes, run the following command to secure your MariaDB installation:
sudo mysql_secure_installation
- Error Handling: The script includes a function to handle errors gracefully.
- Package Installation: Uses
aptto install necessary packages and handle dependencies. - PHP Extensions: Installs both core and optional PHP extensions based on availability.
- Apache Configuration: Sets up a virtual host for serving web content.
- Ensure your system is connected to the internet during the installation process.
- Some optional PHP extensions may not be available depending on your system's repositories.
- The script will prompt you to run
mysql_secure_installationmanually to secure your MariaDB installation.
After installation, you can verify the installations by checking the versions of the installed software:
apache2 -v
mysql --version
php -v
node -v
npm -v
composer -VAfter installing the LAMP stack, you can add a new domain to your server by following these steps:
chmod +x vhost.shRun the Script: Execute the script as root or with sudo: bash
sudo ./vhost.shEnter Domain Name: When prompted, enter the domain name you want to add (e.g., example.com). Choose Protocol: Select between http or https according to your needs. Done: After the script finishes running, your new domain will be added to the Apache configuration. If you chose HTTPS, make sure to configure the SSL certificate correctly.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to submit issues or pull requests for improvements or bug fixes. Your contributions are welcome!
contact us saiful.coder@gmail.com
This project helps you and you want to help keep it going? Buy me a coffee:
or via
https://saweria.co/saifulcoder
