Last active
September 13, 2020 04:11
-
-
Save aimensasi/b02a693df79ffd14de8c131833b8fb5e to your computer and use it in GitHub Desktop.
Centos 8 setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| Color_Off='\033[0m' # Text Reset | |
| Red='\033[0;31m' # Red | |
| Green='\033[0;32m' # Green | |
| Yellow='\033[0;33m' # Yellow | |
| # update dependencies | |
| echo "Updating yum dependencies...:" | |
| dnf update -y | |
| echo "What name would you like to use for the server hostname:" | |
| read hostname | |
| if [ -n "$hostname" ] | |
| then | |
| echo "Setting up the hostname $hostname" | |
| hostnamectl set-hostname $hostname | |
| else | |
| echo "No hostname was given, this step is skipped." | |
| fi | |
| echo "Setting timezone, to, Asia/Kuala_Lumpu." | |
| echo "You can run ${Yellow} timedatectl set-timezone timezone ${Color_Off} to change this." | |
| timedatectl set-timezone 'Asia/Kuala_Lumpur' | |
| echo "Installing httpd..." | |
| sudo dnf install httpd | |
| echo "Setting httpd to start at repot..." | |
| sudo systemctl enable httpd.service | |
| echo "Starting httpd..." | |
| sudo systemctl start httpd.service | |
| echo "Setting firewall to allow connections over http & https..." | |
| firewall-cmd --permanent --zone=public --add-service=http | |
| firewall-cmd --permanent --zone=public --add-service=https | |
| firewall-cmd --reload | |
| echo "Installing php 7.4..." | |
| dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y | |
| dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y | |
| dnf module enable php:remi-7.4 | |
| dnf install php | |
| echo "Installing & starting mariadb..." | |
| dnf -y install mariadb-server mariadb | |
| systemctl start mariadb.service | |
| systemctl enable mariadb.service |
Secure MariaDB instance
mysql_secure_installation
and then just follow the instruction
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
That is it!