Skip to content

Instantly share code, notes, and snippets.

@92hackers
Last active August 10, 2019 07:25
Show Gist options
  • Save 92hackers/53adfd66d054b8258f8ed7124caf76ea to your computer and use it in GitHub Desktop.
Save 92hackers/53adfd66d054b8258f8ed7124caf76ea to your computer and use it in GitHub Desktop.
配置新的开发环境----(oh-my-zsh, vim, docker, git, clang, cmake) 里面凝结了搞机的许多技能,值得读完。
#! /usr/bin/env bash
# sudo passwd root: set password for root user
sudo passwd root # for root user
sudo passwd $USER # for current logged in user.
# Add a new user
sudo adduser <qm>
# add epel yum repository
sudo yum install epel-release
# install development tools.
yum -y groupinstall 'Development Tools'
# How to compile vim8 on centos
http://harttle.land/2017/06/01/compile-vim8-centos6.html
# vim Not Installed on Ubuntu by default, IT'S VI, NOT VIM
sudo apt install vim
# after this, combined with my .vimrc, you could do anything
# vim tagbar ctags not found error:
sudo apt-get install exuberant-ctags
sudo yum install ctags-etags
# install clang, cmake
echo "Install clang, cmake"
sudo yum install clang -y
sudo yum install cmake -y
# install python3
https://github.com/pyenv/pyenv/wiki # config build env to install python. Important。
https://github.com/pyenv/pyenv#installation # to find installation instructions.
https://github.com/pyenv/pyenv-installer # install helper to install pyenv
pyenv install 3.6.0
# 国内配置 pip 源为 阿里云的镜像
touch ~/.pip/pip.conf
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
[list]
format=columns
# install git
sudo yum install git -y
# install oh-my-zsh
# 除此之外,还需要在 plugins 里面添加对 docker, docker-compose 的支持
sudo yum install zsh -y
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Shell auto suggestions, 命令自动补全,神器,非常好用。
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# .zshrc plugins 里面添加下面这行。
plugins=(zsh-autosuggestions)
# One line server alias
alias start-server="python3 -m http.server"
alias ll="ls -alh"
alias free="free -m"
alias df="df -h"
# install node.js, yarn by nvm
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
nvm ls-remote
nvm install v8.9.4
npm install yarn -g
# install git flow shell script.
# yum install gitflow
# apt-get install git-flow
curl -OL https://raw.github.com/nvie/gitflow/develop/contrib/gitflow-installer.sh
chmod +x gitflow-installer.sh
sudo ./gitflow-installer.sh
# install ag, the silver search, i can't live without such awesome tool.
https://github.com/ggreer/the_silver_searcher # to find installation instructions
# install fzf, fuzz file finder, cooperate with ag, perfect, for everything.
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
# install curl, an amazing tool to interact with remote server
yum install curl
# install vim my custom config
# recompile vim 8.0 with python, python3 lua support
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
wget https://gist.githubusercontent.com/92hackers/cf8b47816412493317fc619154aad695/raw/8e6accde3a0b1bb08b7fe2e74cd7542ca6d36a61/.vimrc
vim +PluginInstall +qall
# install docker
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
# Just use Daocloud script to install docker, the mose fast way
https://get.daocloud.io/#install-docker
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
# run docker service
sudo service docker start
sudo usermod -aG docker <current-username>
# after this, logout, and relog in, to take effect。
# about auth of docker
https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user
# install docker-compose
# go here to check if docker-compose updated: https://github.com/docker/compose/releases,
# replace **1.18.0** with newly version string.
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# 编辑 docker image registry, 以便使用阿里云的镜像。
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"]
}
# Ubuntu 本地安装包镜像使用 阿里云的镜像。 速度快。
sudo touch /etc/apt/sources.list.d/aliyun.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# Below command list 10 top largest files
find . -type f -exec du -h {} + | sort -r -h | head -n 10
@92hackers
Copy link
Author

Keep updating, a Good development env boot essentions.

@92hackers
Copy link
Author

git flow model, requires team member more self motivated,
master && develop branches all open to all of members.

@92hackers
Copy link
Author

国内使用 docker, pip, ubuntu apt-get, 可以考虑使用阿里云的镜像。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment