CentOS Stream 9 and 10: Complete Guide to Static IP Configuration and Package Repository Setup
Understanding CentOS Stream: The Rolling Release Future of Enterprise Linux
CentOS Stream occupies a unique position in the Red Hat ecosystem, serving as the upstream development branch for Red Hat Enterprise Linux (RHEL). Unlike traditional CentOS, which was a downstream rebuild of RHEL, CentOS Stream adopts a rolling release model that sits between Fedora and RHEL in the development pipeline.
This strategic positioning offers organizations and developers unprecedented visibility into upcoming RHEL features while maintaining enterprise-grade stability. Understanding the differences between CentOS Stream 9 and 10 is crucial for making informed deployment decisions.
Key Version Comparisons
CentOS Stream 9 aligns with the RHEL 9 series, featuring Kernel 5.14, Python 3.9 as the default, and GCC 11 for compilation. The system maintains traditional YUM/DNF package management and carries support through 2027 for full maintenance, extending to 2032 for critical security updates.
CentOS Stream 10, codenamed "Coughlan," represents a significant leap forward with Kernel 6.12 or higher, Python 3.12 delivering substantial performance improvements, and GCC 14 supporting modern language features. This version introduces innovative concepts like System Wide Image (SWI) and Bootable Container architectures, with expected maintenance extending into the early 2030s.
System Environment Verification
Before proceeding with configuration, verify your system environment. Typical deployments show:
- CentOS Stream 10: Kernel version 6.12.0-212.el10.x86_64
- CentOS Stream 9: Kernel version 5.14.0-687.el9.x86_64
These kernel versions confirm the underlying architecture differences between the two releases.
Configuring Static IP Addresses: The Modern NetworkManager Approach
The Shift from Legacy Network Scripts
CentOS Stream 9 and 10 have fundamentally changed network management. The traditional /etc/sysconfig/network-scripts/ifcfg-eth0 configuration files and the network service have been deprecated in favor of NetworkManager. This transition reflects broader industry trends toward dynamic, centralized network management.
NetworkManager stores connection profiles in /etc/NetworkManager/system-connections/, providing a unified interface for both GUI and command-line configuration.
Method One: Direct Configuration File Editing
Navigate to the NetworkManager connections directory:
cd /etc/NetworkManager/system-connections/
ls
# Output: ens160.nmconnectionEdit the connection profile to specify a static IP address (example: 192.168.0.132):
[connection]
id=ens160
uuid=89fcf374-9ca1-30b1-b1dd-ed124953574c
type=ethernet
autoconnect-priority=-999
interface-name=ens160
timestamp=1775042953
[ethernet]
duplex=half
speed=10000
[ipv4]
address1=192.168.0.132/24
dns=223.5.5.5;223.6.6.6;119.29.29.29;182.254.116.116;
gateway=192.168.0.2
method=manual
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]Configuration Parameter Explanations:
- address1: Specifies the static IP address and subnet mask in CIDR notation
- dns: Lists DNS servers separated by semicolons. Using domestic DNS servers (for Chinese deployments) like 223.5.5.5 and 223.6.6.6 provides faster resolution
- method: Set to "manual" for static configuration or "auto" for DHCP
- gateway: Defines the default gateway for network traffic
After making changes, reload and restart NetworkManager:
systemctl restart NetworkManager
systemctl status NetworkManagerVerify the service status shows "active (running)" and check for any error messages in the logs.
DNS Configuration Propagation
Configuring DNS in the NetworkManager connection profile automatically updates /etc/resolv.conf:
cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 223.5.5.5
nameserver 223.6.6.6
nameserver 119.29.29.29
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 182.254.116.116Note the warning about libc resolver limitations—only the first three nameservers may be reliably used by some applications.
Verification Steps
Confirm IP configuration success:
ip a
# Look for your interface with the configured IP address
ip r
# Verify routing table shows correct default gateway
ping qq.com
# Test external connectivitySuccessful configuration shows the assigned IP address, correct routing, and working external connectivity.
Method Two: Using nmcli Command-Line Interface
The nmcli (NetworkManager Command Line Interface) tool provides a powerful alternative to direct file editing. Its advantages include:
- Persistent Configuration: Changes survive reboots without additional steps
- Real-Time State Reflection: Configuration immediately reflects in NetworkManager status
- Validation: Built-in parameter validation prevents configuration errors
Common nmcli Operations:
| Operation Type | Command Example | Description |
|---|---|---|
| Check Status | nmcli general status | View NetworkManager overall status |
| List Devices | nmcli device status | Show all network interfaces and connection states |
| Show Connections | nmcli connection show | List all saved connection profiles |
| Enable Connection | nmcli connection up <ID> | Activate specified connection profile |
| Disable Connection | nmcli connection down <ID> | Deactivate specified connection |
| Reload Configuration | nmcli connection reload | Reload configuration files after manual edits |
Configuring Static IP via nmcli:
nmcli connection modify "ens33" \
ipv4.addresses "192.168.0.132/24" \
ipv4.gateway "192.168.0.2" \
ipv4.dns "223.5.5.5,8.8.8.8" \
ipv4.method manualActivate the configuration:
nmcli connection down ens33 && nmcli connection up ens33View detailed connection information:
nmcli connection show ens33The nmcli approach offers better integration with automation scripts and reduces the risk of syntax errors in configuration files.
DNF and YUM Repository Configuration
Understanding DNF: The Next-Generation Package Manager
DNF (Dandified YUM) represents the evolution of package management for RPM-based Linux distributions. Designed specifically for Fedora, RHEL 8+, and CentOS Stream 9/10, DNF addresses the performance bottlenecks and functional limitations of its predecessor while maintaining familiar command syntax.
In CentOS Stream 9/10, the yum command exists as a symbolic link pointing to DNF:
ls -lh /usr/bin/yum
# lrwxrwxrwx. 1 root root 5 Feb 16 08:00 /usr/bin/yum -> dnf-3
ls -lh /usr/bin/dnf
# lrwxrwxrwx. 1 root root 5 Feb 16 08:00 /usr/bin/dnf -> dnf-3This compatibility layer ensures existing scripts and documentation remain valid while users benefit from DNF's improvements.
Essential DNF Commands
Basic Installation:
sudo dnf install <package> # Install a single package
sudo dnf install <package1> <package2> # Install multiple packages
sudo dnf install -y <package> # Auto-confirm installation (for scripts)Package Management:
sudo dnf remove <package> # Uninstall a package
sudo dnf update # Update all installed packages
sudo dnf update <package> # Update a specific package
sudo dnf autoremove # Clean unused dependenciesQuery and Search:
dnf search <keyword> # Search for packages
dnf info <package> # View package details
dnf provides /path/to/file # Find package providing a file
dnf list installed # List all installed packagesRepository Management:
dnf repolist # List all enabled repositories
dnf repolist --verbose # Show detailed repository information
sudo dnf config-manager --enable <repo> # Enable a repository
sudo dnf config-manager --disable <repo> # Disable a repositoryCache Management:
sudo dnf clean all # Clear all cache (metadata and packages)
sudo dnf makecache # Rebuild cache after repository updates
sudo dnf clean packages # Remove downloaded .rpm files onlyTransaction History:
dnf history # View all operation records
dnf history info 5 # View details of transaction #5
sudo dnf history undo 5 # Undo transaction #5Advanced Features:
dnf module list # List available modules
sudo dnf module enable php:8.0 # Enable specific module version
sudo dnf module install php # Install modular package
dnf download <package> --resolve # Download package with dependencies
sudo dnf install ./*.rpm # Install locally downloaded RPMs
sudo dnf repair # Attempt automatic system repairConfiguring Repository Sources
Step 1: Backup Existing Repository Files
cd /etc/yum.repos.d/
ls
# Output: centos-addons.repo centos.repo
mkdir bak
mv *.repo bak/
ls
# Output: bakStep 2: Configure Aliyun Mirror Repository
Create ali-centos.repo with the following content:
[baseos]
name=CentOS Stream $releasever - BaseOS
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1
[baseos-debug]
name=CentOS Stream $releasever - BaseOS - Debug
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[baseos-source]
name=CentOS Stream $releasever - BaseOS - Source
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/source/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[appstream]
name=CentOS Stream $releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1
[appstream-debug]
name=CentOS Stream $releasever - AppStream - Debug
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[appstream-source]
name=CentOS Stream $releasever - AppStream - Source
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
enabled=0
[crb]
name=CentOS Stream $releasever - CRB
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/os/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
gpgcheck=1
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1Step 3: Configure Additional Repositories
Create ali-addons.repo for additional repository components including HighAvailability, NFV, RT, ResilientStorage, and extras-common repositories. Each follows the same pattern with appropriate baseurl configurations.
Step 4: Install EPEL Repository
The Extra Packages for Enterprise Linux (EPEL) repository provides additional software packages:
dnf install epel-releaseVerify installation:
pwd
# /etc/yum.repos.d
ls
# ali-addons.repo ali-centos.repo bak epel.repo epel-testing.repoStep 5: Refresh Cache and Update
dnf clean all # Clear all cached data
dnf makecache # Rebuild package cache
dnf update # Update all installed packagesBest Practices and Considerations
Network Configuration Best Practices
- Always backup configurations before making changes
- Test connectivity after each configuration change
- Use domestic DNS servers for better resolution speed in regional deployments
- Document all changes for future reference and troubleshooting
- Consider IPv6 requirements for future-proofing network configurations
Repository Configuration Best Practices
- Use trusted mirrors like Aliyun, Tencent, or official CentOS mirrors
- Enable only necessary repositories to reduce attack surface
- Regularly update package cache to ensure security patches are applied
- Monitor repository health and switch mirrors if issues arise
- Consider bandwidth when selecting mirror locations
Troubleshooting Common Issues
Network Connectivity Problems
If network configuration fails:
- Check NetworkManager service status:
systemctl status NetworkManager - Verify connection profile syntax in
/etc/NetworkManager/system-connections/ - Check for conflicting network services
- Review system logs:
journalctl -u NetworkManager
Repository Access Issues
If package installation fails:
- Verify network connectivity to mirror servers
- Check repository configuration syntax
- Clear and rebuild cache:
dnf clean all && dnf makecache - Try alternative mirror servers if problems persist
Conclusion
CentOS Stream 9 and 10 represent the future of enterprise Linux, offering rolling updates with enterprise stability. Mastering NetworkManager for network configuration and DNF for package management is essential for successful deployments.
The transition from legacy network scripts to NetworkManager and from YUM to DNF reflects broader industry trends toward more sophisticated, integrated system management. Understanding these tools not only ensures successful configuration but also prepares administrators for the evolving landscape of enterprise Linux administration.
Whether deploying CentOS Stream 9 for long-term stability or CentOS Stream 10 for cutting-edge features, the configuration principles remain consistent: understand the tools, follow best practices, and always verify changes before considering the configuration complete.