- 脚本重复执行,要么是更新要么是重装。
- 手动编译一律安装在
/opt下(含依赖),源码存放在/usr/local/src/
# 脚本raw 需要替换成具体的url
bash <(curl -L 脚本raw)bash <(curl -L 脚本raw) --remove理论上无执行顺序,但建议先初始化,再执行其它脚本。
| 文件名 | 用途 |
|---|---|
| git.sh | git安装 |
| golang.sh | golang安装 |
| init.sh | 初始化 |
| #!/bin/bash -e | |
| # https://git-scm.com/download/linux | |
| # https://git-scm.com/book/en/v2/Getting-Started-Installing-Git | |
| # git源码下载地址 | |
| GIT=https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.36.3.tar.gz | |
| git_name=${GIT##*/} | |
| git_base=$(basename $git_name .tar.gz) | |
| src_path=/usr/local/src/ | |
| env_path=/etc/profile.d/gitscm.sh | |
| pwd_path=$(pwd) | |
| download() | |
| { | |
| cd $src_path | |
| curl -LO $GIT | |
| tar -zxvf $git_name | |
| rm -f $git_name | |
| } | |
| dependencies() | |
| { | |
| yum -y install epel-release | |
| # 源码依赖 | |
| yum -y install dh-autoreconf curl-devel expat-devel gettext-devel \ | |
| openssl-devel perl-devel zlib-devel | |
| # 文档依赖 | |
| yum -y install asciidoc xmlto docbook2X | |
| ln -s /usr/bin/db2x_docbook2texi /usr/local/bin/docbook2x-texi | |
| yum -y install getopt | |
| } | |
| build() | |
| { | |
| cd $git_base | |
| make configure | |
| ./configure --prefix=/opt/git | |
| make all doc | |
| make install install-doc install-html | |
| cd $pwd_path | |
| } | |
| install() | |
| { | |
| echo "#!/bin/sh | |
| export PATH=/opt/git/bin:\\ | |
| \$PATH" \ | |
| > $env_path | |
| . $env_path | |
| ln -sn $env_path ~/.config/gitscm | |
| } | |
| main() | |
| { | |
| download | |
| dependencies | |
| build | |
| install | |
| } | |
| main "$@" |
| #!/bin/bash -e | |
| # golang下载地址 | |
| GOLANG=https://go.dev/dl/go1.19.1.linux-amd64.tar.gz | |
| golang_name=${GOLANG##*/} | |
| env_path=/etc/profile.d/golang.sh | |
| pwd_path=$(pwd) | |
| download() | |
| { | |
| cd /opt | |
| curl -LO $GOLANG | |
| tar -zxvf $golang_name | |
| rm -f $golang_name | |
| cd $pwd_path | |
| } | |
| install() | |
| { | |
| echo "#!/bin/sh | |
| export GOENV=/etc/go/env | |
| export GOPATH=/opt/gopath | |
| export PATH=\$GOPATH/bin:/opt/go/bin:\\ | |
| \$PATH" \ | |
| > $env_path | |
| . $env_path | |
| go env -w GOCACHE=/var/cache/go-build \ | |
| GO111MODULE=auto \ | |
| GOPROXY=https://proxy.golang.com.cn,direct \ | |
| GOSUMDB=gosum.io+ce6e7565+AY5qEHUk/qmHc5btzW45JVoENfazw8LielDsaI+lEbq6 | |
| GOCACHE=$(go env GOCACHE) | |
| mkdir -p $GOPATH $GOCACHE | |
| ln -sn $env_path /etc/go/golang | |
| ln -sn $GOENV ~/.config/go | |
| ln -sn $GOPATH ~/go | |
| ln -sn $GOCACHE ~/.cache/go-build | |
| } | |
| main() | |
| { | |
| download | |
| install | |
| } | |
| main "$@" |
| #!/bin/bash -e | |
| src_path=/usr/local/src/ | |
| env_path=/etc/profile.d/env.sh | |
| update() | |
| { | |
| yum -y groupinstall "Development Tools" | |
| yum -y remove git | |
| yum -y install python2-pip | |
| yum -y install yum-utils \ | |
| https://repo.ius.io/ius-release-el7.rpm \ | |
| epel-release | |
| yum -y update | |
| } | |
| env() | |
| { | |
| echo "#!/bin/sh | |
| alias lm='ll -a' | |
| alias fwcmd='firewall-cmd' | |
| alias fwcmp='fwcmd --permanent' | |
| alias fwcpd='fwcmp --direct' | |
| alias py2='python2' | |
| alias py3='python3' | |
| alias setproxy='export \\ | |
| http_proxy=http://127.0.0.1:1080 \\ | |
| https_proxy=https://127.0.0.1:1080 \\ | |
| all_proxy=socks5://127.0.0.1:1080 \\ | |
| && curl ip.sb' | |
| alias unsetproxy='unset http_proxy https_proxy all_proxy && curl ip.sb' | |
| export PATH=/opt:\\ | |
| \$PATH" \ | |
| > $env_path | |
| . $env_path | |
| ln -sn $env_path ~/env | |
| ln -sn $src_path ~/src | |
| } | |
| vimrc() | |
| { | |
| cd ~ | |
| mkdir -p .vim/autoload .vim/bundle && \ | |
| curl -Lo .vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim | |
| mkdir -p .vim/colors | |
| curl -Lo .vim/colors/vividchalk.vim https://www.vim.org/scripts/download_script.php?src_id=12437 | |
| echo "execute pathogen#infect() | |
| syntax on | |
| set background=dark | |
| colorscheme vividchalk | |
| set pastetoggle=<F12> | |
| set ts=2 sw=2 expandtab" \ | |
| > .vimrc | |
| } | |
| main() | |
| { | |
| update | |
| env | |
| vimrc | |
| } | |
| main "$@" |