自用的centos初始化脚本

每次安装centos系统的时候总是要安装许多软件 所以写了个小脚本

github地址:https://github.com/mrtian2016/centos-script
可以直接curl执行:

curl -o- -L -s https://raw.githubusercontent.com/mrtian2016/centos-script/master/initialize.sh | sudo bash

以下为脚本内容:

#!/bin/bash
# 检查是否为root用户
if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script, please use root to install software"
    exit 1
fi

# 切换到用户目录
cd ~

log_file="initialize-script-log"

if [ -f "./${log_file}" ]; then
    echo "Warning: You have already run this script"
    exit 1
fi

touch $log_file

# 安装第三方源
echo "Installing third-party sources..."
yum -y install epel-release >> $log_file


#安装yum-axelge,安装软件时可以并行下载
echo "Installing yum-axelget..."
yum -y install yum-axelget >> $log_file

# 更新软件
yum -y update >> $log_file

# 安装 zsh wget screen git
echo "Installing zsh wget screen git..."
yum -y install zsh wget screen git vim >> $log_file

# 切换 shell
chsh -s /bin/zsh

# 安装 Oh-My-Zsh
echo "Installing Oh-My-Zsh..."
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh >> $log_file

# 一些alias
echo "Writing some alias..."
echo "alias vi=vim" >> ~/.zshrc
echo -e "alias reload=\"source ~/.zshrc && echo '>> OH MY, ZSH configurations are reloaded! '\"" >> ~/.zshrc
echo "Complete !!! Have Fun !!!"
zsh
source ~/.zshrc

本文链接:

https://www.ioser.net/index.php/archives/82/
1 + 2 =
1 评论
    一脸蒙逼微信内嵌浏览器 Windows
    2018年12月12日 回复

    很好