#!/bin/bash#---sysinit script by Yxs---#---email: [Email protected]if[["$ (WhoAmI)"!="Root" ]]; Then Echo "Please run this script as root.">&2Exit1fi#Yumsource Configyum_config () {Yum Install wgetEpel-release-y cd/etc/Yum. repos.d/&&mkdirBak &&MV-F *.repo bak/wget-o/etc/Yum. Repos.d/centos-base.repo http://Mirrors.aliyun.com/repo/centos-7.repo wget-o/etc/Yum. Repos.d/epel.repo http://Mirrors.aliyun.com/repo/epel-7.repo YumClean all &&YumMakecacheYum-Y Groupinstall'Development Tools' Yum-YInstallPython-pipMansLsof iotop iftop net-tools LrzszGCC GCC-c++ MakeCMake libxml2-devel Openssl-devel Curl Curl-develUnzip sudoNTP Libaio-develwgetVim ncurses-devel autoconf automake zlib-devel python-devel bash-completion} #firewalld configiptables_config () {systemctl stop firewalld.service systemctl disable Firewalld.serv Iceifconfig|grep-Q Inet6if[ $? ==0 ] Then Echo "Net.ipv6.conf.all.disable_ipv6 = 1">>/etc/sysctl.confEcho "Net.ipv6.conf.default.disable_ipv6 = 1">>/etc/sysctl.confsed-I.'s/::1/#::1/'/etc/hostsfi} #system Configsystem_config () {YumUpdate-y Hostnamectl Set-hostnameYxssed-I."s/selinux=enforcing/selinux=disabled/g"/etc/selinux/Config Timedatectl set-local-rtc1&& Timedatectl Set-timezone asia/ShanghaiYum-YInstallChrony && systemctl start Chronyd.service &&systemctl Enable Chronyd.service} #app_configapp_config () {mkdir-p/usr/download/&& cd/usr/DownloadwgetHttps//www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz Tar-XVF python-3.6.4. tgz-c/usr/Local CD/usr/local/python-3.6.4 ./configure--prefix=/usr/local/python-3.6.4--enable-shared Make&& Make Install LN-sv/usr/local/python-3.6.4/bin/python3/usr/bin/Python3LN-sv/usr/local/python-3.6.4/bin/pip3/usr/bin/PIP3 PipInstall--upgrade PipEcho/usr/local/python-3.6.4/lib >>/etc/LD. so.conf/sbin/ldconfig-vmkdir-p/home/Envs virtualenv-p/usr/bin/python3/home/envs/py3envLN-s/home/envs/py3env/bin/activate/root/py3}main () {yum_config iptables_config system_config app_config}mainreboot
Linux system Environment Automation configuration ~init.sh Sharing