This project offers a shell script to facilitate setting up a web server on a Linux system. The script automates the process of installing dependencies, deploying a website (using a template from tooplate.com as an example), and configuring the Apache HTTP server.
- Dependency Installation: Automatically installs necessary packages using
yum
. - Service Management: Starts and enables the Apache HTTPD service.
- Artifact Deployment: Downloads a website template from Tooplate and deploys it to the server.
- Service Restart: Restarts the HTTPD service to apply changes.
- Cleanup: Removes temporary files after deployment.
The provided shell script (websetup.sh
) performs the following steps:
-
Installing Dependencies: Installs required packages such as
wget
,unzip
, andhttpd
.sudo yum install wget unzip httpd -y > /dev/null
-
Starting and Enabling HTTPD Service: Initiates the Apache HTTPD service and ensures it starts on system boot.
sudo systemctl start httpd sudo systemctl enable httpd
-
Creating a Temp Directory: Sets up a temporary directory for artifact deployment.
mkdir -p /tmp/webfiles cd /tmp/webfiles
-
Downloading and Deploying Website Artifact: Retrieves a website template from Tooplate, unzips it, and copies the contents to the Apache web root directory.
wget https://www.tooplate.com/zip-templates/2110_character.zip > /dev/null unzip 2110_character.zip > /dev/null sudo cp -r 2110_character/* /var/www/html/
-
Restarting HTTPD Service: Restarts the Apache HTTPD service to apply changes.
systemctl restart httpd
-
Cleaning Up: Removes temporary files created during deployment.
rm -rf /tmp/webfiles
-
Verification: Displays the status of the HTTPD service and lists files in the web root directory.
sudo systemctl status httpd ls /var/www/html/
-
Clone the repository.
-
Execute the
dismantle.sh
script first with appropriate permissions.chmod +x dismantle.sh ./dismantle.sh
-
Execute the
websetup.sh
script first with appropriate permissions.chmod +x websetup.sh ./websetup.sh
Contributions are welcome! If you have any suggestions or improvements, feel free to open an issue or submit a pull request.