• 分享我自己的一个最小化安装CentOS6的初始化脚本


    在自己的虚拟机上使用的基于CentOS6的系统初始化脚本

    #!/bin/bash
    #
    #Filename:system_init.sh
    #Description:系统安装完成后,对系统进行一些配置,以符合自己的试验环境
    #Author:renpingsheng
    #Email:995883352@qq.com
    #Version:1.5
    #Date:2018.5.21
    
    
    #更改selinux的配置文件,禁用selinux,成功则打印“配置完成”
    sed -i.bak '1,$s@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config && echo "SElinux is setting OK!"
    
    #定义一些常用的别名
    cat <<EOF >>/root/.bashrc && echo "The file bashrc is setting ok!"
    alias "cdnet"="cd /etc/sysconfig/network-scripts/"
    alias "grep"="grep --color=auto"
    alias "renet"="service network restart"
    EOF
    
    cd /etc/yum.repos.d
    
    mkdir repo_bak/
    
    mv *.repo repo_bak/
    
    wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
    
    wget http://mirrors.aliyun.com/repo/Centos-7.repo
    
    yum install -y epel-release
    
    #清空yum缓存,生成新的yum缓存
    yum clean all && yum makecache &> /dev/null
    
    #安装一些常用的软件
    for software in vim lrzsz wget openssl zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel mysql-devel dig python-devel xz-devel expat-devel man python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3 tree htop python2-pip libffi-devel; do
    	yum install -y $software >> /dev/null && echo "The package $software is install OK!"
    done
    #释放定义的变量
    unset software
    
    #安装系统开发组件
    yum groupinstall -y "Development tools" >> /dev/null && echo "Development tools suite is installed ok!"
    
    #配置vim别名
    echo "alias vi=vim" >> /root/.bashrc
    
    #配置vim环境
    cat <<EOF >> /root/.vimrc && echo "The vimrc file is setting ok!"
    set hlsearch
    set nu
    set ic
    set sm
    syntax on
    syntax enable
    set ts=4
    set autoindent
    set expandtab
    set shiftwidth=4
    set cursorline
    set showmatch
    let python_highlight_all = 1
    set fileformat=unix
    EOF
    
    service iptables stop
    chkconfig iptables off
    
    #使.bashrc文件立即生效
    source /root/.bashrc
    
    #使.vimrc文件立即生效
    source /root/.vimrc
    
    #重启系统
    shutdown -r now
  • 相关阅读:
    数组里的数据绑定到dataset中
    有关字符串匹配的方法
    sql语句全集
    Dialog 的6中提示方式
    android开源项目和框架
    MyEclipse DB Browser使用图文全攻略
    省市县联动(转)
    LRU算法
    Java 性能优化小细节
    HashMap
  • 原文地址:https://www.cnblogs.com/renpingsheng/p/6936784.html
Copyright © 2020-2023  润新知