Last active
September 29, 2022 07:48
-
-
Save dimaskiddo/5628664a97a711f5f538a1c81d261e9d to your computer and use it in GitHub Desktop.
CentOS Linux Essentials Packages Setup Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# CentOS Linux Essentials Packages | |
# By Dimas Restu Hidayanto <dimas.restu@student.upi.edu> | |
# | |
# WARNING PLEASE DO WITH YOUR OWN RISK | |
# | |
# This instruction will guide you to install | |
# essentials packages that might be useful for your systems | |
# or your opeartions | |
# | |
# Please do the following command before applying | |
# ... | |
# sudo -i | |
# -- Or -- | |
# su | |
# ... | |
# | |
# Pre-Configure Package Manager | |
sed -i -e '1,/installonly_limit=5/s/installonly_limit=5/installonly_limit=2/' /etc/yum.conf | |
CENTOS_VERSION=`grep REDHAT_SUPPORT_PRODUCT_VERSION /etc/os-release | awk -F'"' '{print $2}'` | |
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${CENTOS_VERSION}.noarch.rpm | |
yum -y install https://www.elrepo.org/elrepo-release-${CENTOS_VERSION}.el${CENTOS_VERSION}.elrepo.noarch.rpm | |
sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel.repo | |
sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel-modular.repo | |
sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/elrepo.repo | |
# Install and Upgrade Base Packages | |
yum repolist | |
yum -y update | |
yum -y --enablerepo=elrepo install yum-utils yum-presto yum-plugin-versionlock yum-plugin-elrepo | |
yum -y --enablerepo=epel install bash bash-completion | |
yum -y --enablerepo=epel install ca-certificates tzdata | |
yum -y --enablerepo=epel install sudo sed grep byobu redhat-lsb-core | |
yum -y --enablerepo=epel install curl wget rsync nano | |
yum -y --enablerepo=epel install tar gzip bzip2 xz p7zip p7zip-plugins zip unzip | |
yum -y --enablerepo=epel install e2fsprogs xfsprogs gdisk parted lvm2 | |
yum -y --enablerepo=epel install binutils util-linux logrotate | |
yum -y --enablerepo=epel install gnupg | |
yum -y --enablerepo=epel install htop iftop iotop sysstat nmon | |
yum -y --enablerepo=epel install net-tools netcat socat bind-utils bridge-utils | |
yum -y --enablerepo=epel install traceroute iputils openssh-clients | |
yum -y --enablerepo=epel install open-vm-tools | |
# Install Development Tools Packages | |
yum -y --enablerepo=epel install python2 python2-devel | |
yum -y --enablerepo=epel install python3 python3-devel | |
yum -y --enablerepo=epel install git | |
# Clean-up Packages | |
yum -y --enablerepo=epel --enablerepo=elrepo autoremove | |
yum -y --enablerepo=epel --enablerepo=elrepo clean all | |
yum -y --enablerepo=epel --enablerepo=elrepo makecache | |
yum -y --enablerepo=epel --enablerepo=elrepo repolist | |
# Install Python 2 PIP | |
wget -q -O - https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2 - | |
pip2 install --no-cache-dir --upgrade pip setuptools wheel | |
# Install Python 3 PIP | |
wget -q -O - https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3 - | |
ln -sf /usr/local/bin/pip3 /usr/bin/pip3 | |
ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3.6 | |
pip3 install --no-cache-dir --upgrade pip setuptools wheel | |
# Enable Sysctl Tweaks | |
cat << EOF >> /etc/sysctl.conf | |
vm.max_map_count=262144 | |
net.core.somaxconn=4096 | |
net.core.rmem_max=16777216 | |
net.core.wmem_max=16777216 | |
net.core.netdev_max_backlog=2500 | |
net.ipv6.conf.default.disable_ipv6=1 | |
net.ipv6.conf.all.disable_ipv6=1 | |
net.ipv6.conf.lo.disable_ipv6=1 | |
net.ipv6.conf.eth0.disable_ipv6=1 | |
net.ipv4.tcp_mem=116730 155640 233460 | |
net.ipv4.tcp_rmem=4096 87380 16777216 | |
net.ipv4.tcp_wmem=4096 65536 16777216 | |
net.ipv4.tcp_max_orphans=24576 | |
net.ipv4.ip_no_pmtu_disc=0 | |
net.ipv4.conf.all.rp_filter=1 | |
net.ipv4.conf.all.log_martians=1 | |
net.ipv4.conf.all.accept_source_route=0 | |
net.ipv4.conf.all.send_redirects=0 | |
net.ipv4.conf.default.send_redirects=0 | |
net.ipv4.icmp_echo_ignore_broadcasts=1 | |
EOF | |
# Reload Sysctl | |
sysctl -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment