Configuring YUM and System Settings on New Linux Machines

System Information and Host Configuration

FQDN Configuration

Configure Fully Qualified Domain Name (FQDN) for proper host identification in network environments.

# Edit hosts file
vim /etc/hosts
# Add entry: IP_address FQDN hostname
192.168.17.102 server01.lnmp.com server01

# Configure network hostname
vim /etc/sysconfig/network
# Set HOSTNAME value
HOSTNAME=server01

Editor Setup and System Information

# Install and configure Vim
yum -y install vim
echo "set nu" >> /root/.vimrc

# Enable grep highlighting
echo "alias grep='grep --color'" >> /root/.bashrc
source /root/.bashrc

# System information commands
cat /etc/redhat-release
uname -a
cat /etc/resolv.conf
hostnamectl

Hostname Configuration

# Set hostname using hostnamectl
hostnamectl set-hostname rhel8.example.com

# Alternative method
echo "web1" > /etc/hostname

CD-ROM Mounting and YUM Diffferences

# Mount CD-ROM
mount /dev/cdrom /dvd

# Auto-mount configuration
echo "/dev/cdrom /dvd iso9660 defaults 0 0" >> /etc/fstab
mount -a

# YUM package management differences between RHEL 7 and 8
# RHEL 8 removes dependencies when uninstalling packages

Security and Firewall Configuration

# Firewall service management
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

# Disable SELinux
vim /etc/selinux/config
# Set SELINUX=disabled

# Firewall control
systemctl stop firewalld
systemctl disable firewalld
setenforce 0

Network Interface Configuration

# Modify network interface naming
vim /etc/default/grub
# Add: net.ifnames=0 biosdevname=0

# Apply changes
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

# Network manager configuration
nmcli connection add type ethernet ifname eth0 con-name eth0
nmcli connection modify eth0 ipv4.method manual ipv4.addresses 192.168.110.49/24
nmcli connection up eth0

YUM Repository Setup

# Configure Alibaba Cloud mirrors
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

# Local repository setup
mkdir /mnt/centos
mount /path/to/iso /mnt/centos

# Create local repo file
cat > /etc/yum.repos.d/local.repo << EOF
[local]
name=local
baseurl=file:///mnt/centos
enabled=1
gpgcheck=0
EOF

# Refresh YUM cache
yum clean all
yum makecache

Time Synchronization

# Timezone configuration
timedatectl set-timezone Asia/Shanghai

# NTP service
yum -y install ntpdate
ntpdate ntp.aliyun.com

# Chrony alternative
yum install -y chrony
systemctl enable --now chronyd
chronyc sources

Essential Package Installation

# Install development and system tools
yum install -y wget createrepo bind-utils gcc make pcre-devel 
yum install -y openssl-devel bash-completion vim util-linux 
yum install -y net-tools psmisc yum-utils device-mapper-persistent-data lvm2

# Web server setup
yum install -y httpd
systemctl enable --now httpd

Network YUM Repository Access

# Configure remote repository access
cat > /etc/yum.repos.d/network.repo << EOF
[netos]
name=network-centos
baseurl=http://192.168.8.100/centosiso/
enabled=1
gpgcheck=0
EOF

# Verify repository
yum repolist

System Administration Utilities

# Command location
which docker

# Script interpreter specification
#!/usr/bin/python3
print('system configured')

# File content viewing
head /etc/fstab
tail -1 /etc/fstab

# Automatic mount management
mount -a

# Startup scripts
/etc/rc.d/rc.local

# Service management
systemctl enable --now service_name

# System control
poweroff
logout

Custom Aliases Configuration

# Create alias setup script
cat > set_aliases.sh << 'EOF'
#!/bin/bash
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ap='ansible-playbook'
EOF

# Make executable and run
chmod +x set_aliases.sh
./set_aliases.sh

# Permanent aliases
echo "alias rm='rm -i'" >> ~/.bashrc
echo "alias cp='cp -i'" >> ~/.bashrc
echo "alias mv='mv -i'" >> ~/.bashrc
echo "alias ap='ansible-playbook'" >> ~/.bashrc
source ~/.bashrc

Tags: Linux Yum System-Configuration network Security

Posted on Mon, 02 Nov 2026 16:44:54 +0000 by alwoodman