Dieser Artikel bietet eine Schritt-für-Schritt Anleitung für ein Basis Server-Setup mit der Linux Distribution CentOS 8 bzw. CentOS Stream.
Es handelt sich um ein Setup mit allen notwendigen Informationen und einem automatischen Script zur Vereinfachung.
Wenn du das gerne direkt auf deinem PC, ohne zusätzliche Hardware, ausprobieren möchtest, dann kannst du dafür eine virtuelle Maschine z.B. Oracle VM VirtualBox verwenden.
Nachfolgend findest du die Schritt-für-Schritt Anleitung für das Basis Server-Setup mit CentOS 8 bzw. CentOS Stream.
Download des CentOS 8 bzw. CentOS Stream ISO image
- Aufruf der Website: https://www.centos.org/download/
- Entweder Klick auf den Download-Link für die passende Plattform oder der direkte Download für das ISO-File für die x86 64-bit Plattform: http://isoredirect.centos.org/centos/8/isos/x86_64/
Initiales Server Setup
Nach dem Einschalten des Computer bzw. der virtuellen Maschine, kopiere den folgenden Code in die jeweiligen Dateien bzw. Ordner.
Alternativ kannst du das Setup-Script auf von meinem GitHub Repo GitHub Repository herunterladen.
Datei: centos_server_setup.sh
#!/bin/sh
# reference to the config and helper scripts
source ./centos_setup_resources/centos_config.sh
source ./centos_setup_resources/centos_helper.sh
centos_version=$(get_centos_version)
# Equality Comparison
if [ "$centos_version" == "$CENTOS_822004" ]
then
echo "Start installation CentOS 822004"
elif [ "$centos_version" == "$CENTOS_832011" ]
then
echo "Start installation CentOS 832011"
elif [ "$centos_version" == "$CENTOS_STREAM8" ]
then
echo "Start installation CentOS Stream release 8"
else
echo "Setup cancelled by user"
exit 0
fi
#TODO: check if commands have been actually performed
########### START Install Cockpit on CentOS 8 ###########
print_setup_start_information "CentOS 8 - Cockpit Web Console will get installed"
# install cockpit
dnf -y install cockpit
# start and enable the service
systemctl enable --now cockpit.socket
# activated firewalld service, allow Cockpit port to be accessed from machines within the network
firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload
# access Cockpit Web Console on CentOS 8
print_setup_finish_information "Cockpit Web Console on CentOS 8 is enabled\nVisit - https://$(get_local_ipv4_address):9090 - to access it"
########### END Install Cockpit on CentOS 8 ###########
######### START install further tools and repos ###########
print_setup_start_information "Install software: vim, htop net-tools nload vnstat\nInstall repository: epel-release"
# install vim
dnf install -y vim
# add PowerTools repository
dnf config-manager --set-enabled powertools
# install development tools
dnf -y groupinstall 'Development Tools'
# enable EPEL (Extra Packages for Enterprise Linux) repository
dnf install -y epel-release
# install additional software (to check load and network)
dnf install -y htop net-tools nload vnstat
# install language packs
dnf install -y langpacks-en glibc-all-langpacks
print_setup_finish_information "Additional software and programs are installed"
########### END install further tools and repos ###########
######### START perform full system update ###########
print_setup_start_information "Performing full system update"
# perform a full system update
dnf -y update
print_setup_finish_information "Full system update performed\n-- Rebooting the system is recommended"
######### END perform full system update ###########
########### START disabling SELinux ###########
print_setup_start_information "Settings SELinux to Permissive Mode"
# set SELinux to Permissive mode during this session
setenforce 0
# set SELINUX for the time of configuration to permissive
# in this stage, SELINX is active but only logs instead of enforces the settings
# this makes debugging during setup much easier as errors are not caused by SELINUX
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/sysconfig/selinux
print_setup_finish_information "SELinux is now in Permissive Mode.\nThis Permissve Mode will be persistent after reboot."
print_notification_information "SELinux is now in Permissive Mode!\nPlease install the right policies and set SELinux to Enforcing after setup!"
########### END disabling SELinux ###########
# reboot in case of a new kernel
#reboot
Nun erstelle folgenden Ordner: centos_setup_resources
Und speichere die nachfolgenden Dateien in den neu erstellten Ordner.
Datei: centos_helper.sh
#!/bin/sh
# reference to the config and helper scripts
source ./centos8_config.sh
get_centos_version()
{
local centos_version
centos_version=$(cat /etc/centos-release | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p')
# Equality Comparison
if [ "$centos_version" == "8" ]
then
if [[ "$(cat /etc/centos-release)" == *"Stream"* ]]; then
centos_version="Stream release 8"
fi
fi
echo "$centos_version"
}
print_setup_start_information()
{
local start_header
local start_footer
start_header="\n\n${CYAN}################## Installation Start ##################\n"
start_footer="\n########################################################\n\n${NC}"
echo -e "${start_header}${1}${start_footer}"
sleep 5s
}
print_setup_finish_information()
{
local finish_header
local finish_footer
finish_header="\n\n${GREEN}################## Installation Finished ##################\n"
finish_footer="\n###########################################################\n\n${NC}"
echo -e "${finish_header}${1}${finish_footer}"
sleep 5s
}
print_notification_information()
{
local notification_header
local notification_footer
notification_header="\n\n${ORANGE}################## IMPORTANT NOTIFICATION ##################\n"
notification_footer="\n###########################################################\n\n${NC}"
echo -e "${notification_header}${1}${notification_footer}"
sleep 5s
}
get_local_ipv4_address()
{
local local_ipv4_address
# SOURCE (20201122): https://stackoverflow.com/a/13322549
# getting the actual IP address of the network interface and format output
local_ipv4_address=$(ip a | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
echo $local_ipv4_address
}
Datei: centos_config.sh
#!/bin/sh
########### START Color definitions for script ###########
# SOURCE (20201124): https://stackoverflow.com/a/5947802/2749755
# color outputs for shell scripts
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHT_GRAY='\033[0;37m'
DARK_GRAY='\033[0;30m'
LIGHT_RED='\033[0;31m'
LIGHT_GREEN='\033[0;32m'
YELLOW='\033[0;33m'
LIGHT_PURPLE='\033[0;34m'
LIGHT_CYAN='\033[0;36m'
WHITE='\033[0;37m'
NC='\033[0m' # No Color
########### END Color definitions for script ###########
########### START CentOS 8 version definitions ###########
CENTOS_822004="8.2.2004"
CENTOS_832011="8.3.2011"
CENTOS_STREAM8="Stream release 8"
########### START CentOS 8 version definitions ###########
Nun sind die Datei-Berechtigungen noch so anzupassen, dass die Datei ausführbar ist. Die Ausführung erfolgt dann mittels des root-Users oder mit dem sudo Kommando.
chmod +x centos_server_setup.sh
./centos_server_setup.sh
Заказать дубликаты номерных знаков
Дубликат номера