CentOS初始化脚本(未完)
#!/bin/bash
release=`grep -o "\<[[:digit:]]\>" /etc/centos-release | head -` # 、shutdown selinux
[ -e "/etc/selinux/config" ] && sed -i 's@^SELINUX=.*@SELINUX=disabled@' /etc/selinux/config
setenforce &> /dev/null # 2、shudown firewall
[ $release = "" ] && service iptables stop && chkconfig iptables off
[ $release = "" ] && systemctl stop firewalld && systemctl disable firewalld # 3、set own alias
echo "alias cdnet='cd /etc/sysconfig/network-scripts/'" >> /etc/profile.d/myalias.sh
source /etc/profile.d/myalias.sh # 4、set evironment "PS1 color"
# 30:black, 31:red, 32:green, 33:yellow, 34:blue, 35:pink, 36:cyan, 37:white
ps1_color=
echo 'PS1="\[\e[1;'''${ps1_color}'''m\][\u@\h \w]\$\[\e[0m\]"' >> /etc/profile.d/evironment.sh
source /etc/profile.d/myalias.sh # 5、set aliyun repo
rpm -q wget &> /dev/null || yum -y install wget
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[ $release = "" ] && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[ $release = "" ] && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum makecache &> /dev/null
注意:请使用source命令执行此脚本。为什么?
1、source执行某个脚本,会影响当前bash的参数,所以要调用某些变量的时候可以采用此方法
2、/bin/bash执行某个脚本,脚本会在子shell中运行,当前bash参数
CentOS初始化脚本(未完)的更多相关文章
- centos初始化脚本
centos初始化脚本 添加IP.主机名.挂载/dev/sdb1磁盘 #!/bin/bash # ip=$ hostname=$ if [ -z $ip ] || [ -z $hostname ]; ...
- CentOS 初始化脚本
#!/bin/bash # curl https://yiyingcanfeng.github.io/centos-init.sh | bash # 可选参数base kernel python ph ...
- centos7初始化脚本(转)
#!/bin/bash # 描述: CentOS 初始化脚本 # 加载配置文件 if [ -n "${1}" ];then /bin/} fi # 可接受配置(shell 变量格式 ...
- centos 7 初始化脚本
#!/bin/bash # 时间: 2018-11-21 # 作者: HuYuan # 描述: CentOS 7 初始化脚本 # 加载配置文件 if [ -n "${1}" ];t ...
- bash-1 初始化CentOS系统的初始化脚本
初始化CentOS系统的初始化脚本 #!/bin/bash # #******************************************************************* ...
- Go web编程学习笔记——未完待续
1. 1).GOPATH设置 先设置自己的GOPATH,可以在本机中运行$PATH进行查看: userdeMacBook-Pro:~ user$ $GOPATH -bash: /Users/user/ ...
- Centos7初始化脚本
今天分享一个自己写的一个初始化的小脚本. 编写初始化系统要考虑到系统的版本问题,现在用的比较多的就是centos6和centos7,所以首先要判断一下系统的版本. cat /etc/redhat-re ...
- 构建Linux根文件系统(未完待续)
所谓制作根文件系统, 就是创建各种目录, 并且在里面创建各种文件. 比如在/bin ./sbin 目录下存放各种可执行程序, 在/etc 目录下存放配置文件, 在/lib 目录下存放库文件 ...
- javascript有用小功能总结(未完待续)
1)javascript让页面标题滚动效果 代码如下: <title>您好,欢迎访问我的博客</title> <script type="text/javasc ...
随机推荐
- python代码在linux终端中执行报错:Unable to init server: Could not connect: Connection refused
python代码在linux终端中执行时报错: Unable to init server: Could not connect: Connection refused Unable to init ...
- 攻防世界 robots题
来自攻防世界 robots [原理] robots.txt是搜索引擎中访问网站的时候要查看的第一个文件.当一个搜索蜘蛛访问一个站点时,它会首先检查该站点根目录下是否存在robots.txt,如果存在, ...
- laravel框架学习笔记
一.laravel的安装 1.composer 作用:主要管理php中的依赖关系(类似于yum源) 可以安装的软件: curl //主要用到微信开发中 upload //文本操作 excel / ...
- thinkphp 3.2链接Oracle数据库,查询数据
ennnn,换工作了,开始用新的东西了,最近就是调用nc接口,数据库是Oracle,首先先把数据查出来,这个比较简单. 在网上看的其他的方法都是改数据库配置文件,然后需要修改tp核心的一个类文件,比较 ...
- Spring Boot 编辑器 IDEA 免费许可申请
最近 IDEA 陆续到期(试用版)听说可以申请开源许可,试试吧. 点击 https://www.jetbrains.com/shop/eform/opensource?product=ALL 填写相关 ...
- mysql之mysql的安装
此次MySQL安装的版本为:MySQL8.0 系统为:centos6.9 64位 一.利用yum仓库安装 wget https://repo.mysql.com//mysql80-community- ...
- IDEA启动报错-java.net.BindException: Address already in use: bind
启动IDEA报错日志如下: Internal error. Please refer to http://jb.gg/ide/critical-startup-errors java.net.Bind ...
- Vue-路由模式 hash 和 history
Vue 为了构建 SPA(单页面应用),需要引入前端路由系统,这也就是 Vue-Router 存在的意义.前端路由的核心,就在于 —— 改变视图的同时不会向后端发出请求. 创建的项目默认是hash模式 ...
- docker学习及应用
一.docker发展史 为什么要学习容器? 在openstack之后,目前互联网最火热的技术莫过于docker容器了,早在2015年,京东技术备战双11就是使用了10万+Docker,这两年docke ...
- LeetCode练题——88. Merge Sorted Array
1.题目 88. Merge Sorted Array——Easy Given two sorted integer arrays nums1 and nums2, merge nums2 into ...