CentOS 7 Server Initialization: Configuring YUM Repositories, Installing Essential Packages, and System Optimizations
This guide walks through configuring Alibaba Cloud YUM repositories, installing common utilities, disabling firewalls and NetworkManager, optimizing SELinux, synchronizing time, increasing file descriptors, customizing the command line, tuning kernel parameters, and setting the hostname on a CentOS 7 system.
1. Configure the YUM repository to use Alibaba Cloud mirrors by moving existing repo files and downloading new CentOS-Base.repo and epel.repo , then refresh the cache with yum makecache .
2. Install a collection of essential tools and libraries using yum install -y libcurl openssl lrzsz httpd gcc cpp binutils glibc-kernheaders glibc-common glibc-devel make gcc-c++ automake autoconf libtool zlib-devel openssl-devel tree nmap sysstat dos2unix telnet bash-completion bash-completion-extras vim nc lsof net-tools rsync ntpdate open-sshclients screen nload wget .
3. Stop and disable the firewall service with systemctl stop firewalld and systemctl disable firewalld .
4. Disable SELinux enforcement by running setenforce 0 and editing /etc/sysconfig/selinux to set SELINUX=disabled .
5. Stop and disable NetworkManager using systemctl stop NetworkManager and systemctl disable NetworkManager .
6. Add a cron job to synchronize the system clock with Alibaba Cloud NTP servers by appending the appropriate ntpdate command to /var/spool/cron/root .
7. Increase the maximum number of open file descriptors by appending * - nofile 65535 to /etc/security/limits.conf .
8. Optimize the command line environment by creating /etc/profile.d/color.sh with colorized ls alias, a customized prompt, and a timestamped history format, then source the profile.
9. Tune kernel and network parameters by backing up /etc/sysctl.conf , writing a series of net.ipv4.* , vm.swappiness , and other kernel settings, and applying them with sysctl -p .
10. Set the hostname temporarily with hostname and permanently with hostnamectl set-hostname .
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.