Skip to content

Instantly share code, notes, and snippets.

@aimensasi
Last active September 13, 2020 04:11
Show Gist options
  • Save aimensasi/b02a693df79ffd14de8c131833b8fb5e to your computer and use it in GitHub Desktop.
Save aimensasi/b02a693df79ffd14de8c131833b8fb5e to your computer and use it in GitHub Desktop.
Centos 8 setup
#!/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
@aimensasi
Copy link
Author

Usage

  • ssh to your server
  • create a file called setup
$ vim setup
  • copy the content of this file and past it into the file you created and then save the file
  • run the setup script
$ ./setup

That is it!

@aimensasi
Copy link
Author

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