Init
/etc/bashrc
export HISTSIZE=3000000
export HISTTIMEFORMAT="%F %T "
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
unset HISTCONTROL
~/.bash_profile
export PS1="\n[\e[1;32m\u\e[1;31m@\e[1;36m\h\e[0m \e[1;31m\t\e[0m] : \e[1;35m\w\e[0m\n$?> "
function git_branch {
branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`"
if [ "${branch}" != "" ];then
if [ "${branch}" = "(no branch)" ];then
branch="(`git rev-parse --short HEAD`...)"
fi
echo " → $branch"
fi
}
export PS1='\n[\e[1;32m\u\e[1;31m@\e[1;36m\h\e[0m \e[1;31m\t\e[0m] : \e[1;35m\w\e[0m \e[1;31m$(git_branch)\e[0m \n$?> '
#[username@hostname 15:42:22] : ~/Develop/git.xxx.com/xxx/appName → BranchName
/etc/profile.d/modt.sh
#!/bin/bash
mode=online
case "${mode}" in
"online")
#线上环境
echo -e "*\033[37m***********************************\033[37m*"
echo -e "*\033[32m 线上环境 \033[37m*"
echo -e "*\033[37m***********************************\033[37m*"
;;
"log")
#日志查询
echo -e "*\033[37m***********************************\033[37m*"
echo -e "*\033[32m 日志查询 \033[37m*"
echo -e "*\033[31m 低配机器,不要跑其他服务 \033[37m*"
echo -e "*\033[37m***********************************\033[37m*"
;;
esac
Packages
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
curl -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
yum install -y epel-release
yum install -y git lrzsz nginx telnet certbot bind-utils net-tools cloud-utils-growpart jpegoptim optipng
systemctl enable nginx
systemctl enable docker
systemctl start docker
mkdir -p /data/www/ /data/logs/nginx