Open tiancheng91 opened 5 years ago
cd ~
mkdir -p workspace/github.com workspace/gitlab.com workspace/bitbucket.org workspace/go/src
cd ~/workspace/go/src
ln -s ~/workspace/github.com ./
ln -s ~/workspace/gitlab.com ./
ln -s ~/workspace/bitbucket.org ./
echo """ """ > /etc/rc.local
docker-machine create --driver generic --generic-ip-address=$HOST --generic-ssh-user=root --generic-ssh-port=9022 --generic-ssh-key=~/.ssh/id_rsa --engine-opt data-root=/opt/docker qcloud
# docker-machine env qcloud
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh && chmod a+x Miniconda3-latest-Linux-x86_64.sh && ./Miniconda3-latest-Linux-x86_64.sh
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install pipenv
apt-get install php-cli
wget https://getcomposer.org/composer.phar -O /usr/local/bin/composer && chmod a+x /usr/local/bin/composer
composer config -g repo.packagist composer https://packagist.phpcomposer.com
## php-fpm / php.ini
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,
pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,
pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,
pcntl_getpriority,pcntl_setpriority
allow_url_fopen = Off
max_execution_time = 5
max_input_time = 5
wget https://nodejs.org/dist/v8.11.2/node-v8.11.2-linux-x64.tar.gz && tar -zxvf node-v8.11.2-linux-x64.tar.gz
mv node-v8.11.2-linux-x64 /opt/node8
echo "PATH=/opt/node8/bin:$PATH" >> .bashrc
echo 'prefix=/usr/local' > /opt/node/etc/npmrc
ln -s /opt/node8/bin/node /usr/local/bin/node
ln -s /opt/node8/bin/npm /usr/local/bin/npm
npm -g install yarn gulp
echo "
electron_mirror=http://npm.taobao.org/mirrors/electron/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
registry=https://registry.npm.taobao.org
" > .npmrc
wget https://dl.google.com/go/go1.11.linux-amd64.tar.gz && tar -zxvf go1.11.linux-amd64.tar.gz
mv go /opt/go
echo "
export GOPATH="/opt/go"
export PATH="$GOPATH/bin:$PATH"
export GOPROXY=https://proxy.golang.org
" >> .bashrc
go get -u golang.org/x/tools/...
go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v github.com/acroca/go-symbols
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/fatih/gomodifytags
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v github.com/cweill/gotests/...
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/josharian/impl
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/alecthomas/gometalinter
gometalinter --install
go get -u -v github.com/derekparker/delve/cmd/dlv
go get -u -v github.com/stamblerre/gocode
go get -u -v github.com/rogpeppe/godef
ip() {
[[ "$1" ]] || { echo "Error: Missing file" >&2; return 1; }
curl "https://ip.cn/index.php?ip=$1"
}
git-io() {
if [ -n "$2" ]; then
curl -i https://git.io -F url="$1" -F code="$2";
else
curl -i http://git.io -F url="$1";
fi
}
repo-init() {
ss="$(basename $(dirname $PWD))/$(basename $PWD)"
git push --set-upstream "git@gitlab.com:${ss}.git" master
git remote add origin "https://gitlab.com/${ss}.git"
}
alias ss="https_proxy=http://127.0.0.1:18081 http_proxy=http://127.0.0.1:18081"
alias node-repl="node --experimental-repl-await"
alias node-debug="node --inspect"
alias go-build="CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build"
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys. argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias prp="pipenv run python"
alias bypy="bypy --mirror nj.baidupcs.com --processes 20"
docker run -d --name mongo -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=secret --net host -v /data/mongo:/data/db mongo
docker run -d --name redis -p 16379:6379 -v /opt/redis:/data redis redis-server --appendonly yes
docker run -d --name neo4j -p 7687:7687 -p 7474:7474 -v /opt/neo4j:/data -e VIRTUAL_HOST=neo4j.t.buf.bid -e VIRTUAL_PORT=7474 neo4j:3.4
docker run -d --name influx -v /opt/influxdb:/var/lib/influxdb influxdb:1.6
docker run -d --name=influx_ui --link influx -e VIRTUAL_HOST=influx.t.buf.bid -e VIRTUAL_PORT=8888 chronograf --influxdb-url=http://influx:8086
# docker inspect influx | grep ip
# telegraf # influxdb
docker run -d --name nginx -p 80:80 -p 443:443 -v /root/.acme.sh/t.buf.bid:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
# VIRTUAL_PORT=
docker run --name tensorflow -d -e VIRTUAL_HOST=tf.t.buf.bid -e VIRTUAL_PORT=8888 tensorflow/tensorflow
docker run --name paddle -it -v $PWD:/paddle paddlepaddle/paddle /bin/bash
/etc/update-motd.d
go env -w GOPROXY=https://goproxy.io,direct go env -w GOPRIVATE=*.corp.example.com
snap set system proxy.http=http://127.0.0.1:18081 snap set system proxy.https=http://127.0.0.1:18081 snap install zerotier-one docker snap connect zerotier-one:network-control
zerotier-one.zerotier-cli join
export PATH=/snap/bin:$PATH
systemctl stop systemd-logind systemctl stop accounts-daemon systemctl disable systemd-logind systemctl disable accounts-daemon
curl -s https://install.zerotier.com | sudo bash
cat >> /etc/security/limits.conf <<EOF
root soft nofile 655360
root hard nofile 655360
* soft nofile 655360
* hard nofile 655360
* soft core 0
* hard core 0
* soft nproc 655360
* hard nproc 655360
* soft stack unlimited
* hard stack unlimited
* soft memlock unlimited
* hard memlock unlimited
EOF
# cat /etc/systemd/system.conf
DefaultLimitNOFILE=65535
DefaultLimitNPROC=65535
DefaultLimitMEMLOCK=infinity
cat >> /etc/sysctl.conf <<EOF
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
vm.swappiness=0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce=2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.conf.all.arp_announce=2
net.ipv4.tcp_max_tw_buckets=5000
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_max_syn_backlog=65536
net.ipv4.tcp_synack_retries=2
kernel.sysrq=1
net.ipv4.ip_forward=1
fs.file-max=655360
vm.max_map_count=500000
net.ipv4.tcp_fin_timeout=3
net.ipv4.tcp_max_orphans=655360
net.core.somaxconn=8192
net.core.netdev_max_backlog=64000
EOF
/sbin/sysctl -p
loginctl enable-linger $user
docker run --network host -d --name pgsql -v pgsql:/var/lib/postgresql/data -e POSTGRES_PASSWORD=coding postgres:12 -c 'shared_buffers=256MB' -c 'max_connections=50'
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb
apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
U_RUNTIME="/opt/runtime/python3/bin:/opt/runtime/go/bin:/opt/runtime/node12/bin"
old
对象存储 数据文件备份