Skip to content

Instantly share code, notes, and snippets.

@tiancheng91
Last active June 3, 2018 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiancheng91/c9b605cd7cdd363c75a1 to your computer and use it in GitHub Desktop.
Save tiancheng91/c9b605cd7cdd363c75a1 to your computer and use it in GitHub Desktop.
初始化脚本
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew tap caskroom/drivers
brew tap caskroom/versions
brew tap homebrew/core
brew tap homebrew/services
# set mirror
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# open
brew install coreutils moreutils binutils curl aria2 wget
brew install autoconf boris composer dialog dnsmasq ffmpeg freetype gdbm gettext
brew install git git-flow git-lfs go gradle htop icu4c iftop igbinary jpeg kotlin lame libevent libmemcached libpng libsass libsodium libtool libxml2
brew install masscan maven mc memcached nginx nmap node openssl openssl@1.1 p7zip pcre
brew install php-code-sniffer php72 php72-igbinary php72-memcached php72-mongodb php72-xdebug
brew install pipenv proxychains-ng python python3 readline redis@3.2 sassc sqlite telnet tree ucl unixodbc unrar upx wget x264
# cask
brew cask install android-platform-tools google-chrome intellij-idea
brew cask install iterm2 java8 postman qq qqmusic
brew cask install robo-3t sourcetree visual-studio-code
# env
alias setproxy="export ALL_PROXY=socks5://127.0.0.1:18081"
# npm
npm install -g yarn
# 更新时区及语言
apt-get update
apt-get upgrade
dpkg-reconfigure tzdata
dpkg-reconfigure locales
# base
apt-get install language-pack-zh-hans nginx-full man git-core build-essential autoconf automake curl dnsutils p7zip-full p7zip-rar
echo "
LANG='zh_CN.UTF-8'
" >> /etc/default/locale
echo "
set nu
set encoding=utf8
set ffs=unix,dos,mac
colorscheme desert
" >> $HOME/.vimrc
# 挂载磁盘
lsblk
mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb
mkdir /data
mount -o discard,defaults,noatime,nofail /dev/sdb /data
echo UUID=`sudo blkid -s UUID -o value /dev/sdb` /data ext4 discard,defaults,noatime,nofail 0 2 | tee -a /etc/fstab
# tunnel
mkdir -p /opt
wget https://github.com/ginuerzh/gost/releases/download/v2.5/gost_2.5_linux_amd64.tar.gz
tar -zxvf gost_2.5_linux_amd64.tar.gz
chmod a+x gost_2.5_linux_amd64/gost
mv gost_2.5_linux_amd64/gost /usr/local/bin/
nohup gost -L=ss://aes-256-cfb:password@:23 > /dev/null 2>&1 &
# runtime
## python
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install pipenv
## node
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/node
echo "PATH=/opt/node/bin:$PATH" >> .bashrc
echo 'prefix=/usr/local' > /opt/node/etc/npmrc
ln -s /opt/node/bin/node /usr/local/bin/node
ln -s /opt/node/bin/npm /usr/local/bin/npm
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
## php
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
## docker
docker-machine create --driver generic --generic-ip-address=$HOST --generic-ssh-key=.ssh/id_rsa --engine-opt data-root=/data cloud
## mongo
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb https://mirrors.tuna.tsinghua.edu.cn/mongodb/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list
apt-get update && apt-get install -y mongodb-org
chown mongodb:mongodb /opt/mongodb
service mongod start
```conf
storage:
mmapv1:
smallFiles: true
security:
authorization: enabled
```
```create admin
use admin
db.createUser(
{
user: "admin",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
```
## mysql
apt-get install mysql-server
mkdir -p /data/db
cp -R -p /var/lib/mysql /data/db/mysql
echo "
[mysqld]
datadir = /data/db/mysql
performance_schema = 0
max_connections = 50
key_buffer_size = 32M
query_cache_size = 32M
query_cache_limit = 512K
" >> /etc/mysql/conf.d/setting.cnf
service mysql restart
## postgresql
cp -R -p /var/lib/postgresql /data/db/psql
echo "
include = 'special.conf'
" >> /etc/postgresql/9.4/main/postgresql.conf
echo "
max_connections = 40
shared_buffers = 64MB
max_worker_processes = 4
data_directory = '/data/db/psql/9.4/main'
" >> /etc/postgresql/9.4/main/special.conf
```tengine
./configure --prefix=/opt/tengine --with-http_addition_module=shared --with-http_image_filter_module=shared --with-http_geoip_module=shared --with-http_flv_module=shared --with-http_mp4_module=shared
make
make install
make dso_install
```
```
# --data-root ./ --exec-root ./ 旧版本
nohup dockerd -g /data/docker --registry-mirror=https://lhh84km0.mirror.aliyuncs.com:443 -H tcp://0.0.0.0:2375 -p docker.pid >> run.log 2>&1 &
```
apt install linux-generic-hwe-16.04-edge
# https://github.com/lukesampson/scoop
set-executionpolicy remotesigned -scope currentuser
[environment]::setEnvironmentVariable('SCOOP','C:\Scoop','User')
$env:SCOOP='C:\Scoop'
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop install git
scoop bucket add extras
scoop bucket add versions
scoop search ssh
scoop update
# base
scoop install git git-lfs openssh vcredist
scoop install curl wget aria2 coreutils cmder
# runtime
scoop install php python nodejs-lts ruby kotlin openjdk
scoop install go dark # need proxy
# dev tools
scoop install adb ffmpeg thrift upx youtube-dl
# cask package
scoop install vscode chromium robo3t sourcetree
# scoop reset python27
# scoop config proxy user:password@default
#export http_proxy='http://127.0.0.1:8123'
#export https_proxy='http://127.0.0.1:8123'
alias setproxy="export ALL_PROXY=socks5://127.0.0.1:18081"
alias bpython3="python3 -m bpython"
alias burpsuite="nohup java -jar /Users/tian/.config/burpsuite/BurpLoader.jar &"
alias charles="nohup java -jar /Users/tian/.config/charles-bs-v420.jar &"
alias chrome="~/Applications/Chromium.app/Contents/MacOS/Chromium --host-resolver-rules='MAP * 0.0.0.0 , EXCLUDE localhost' --incognito --proxy-server='socks5://"
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
export GOPATH="$HOME/Workspace/go"
export PATH="$GOPATH/bin:$PATH"
export PATH="/usr/local/opt/curl/bin:$PATH"
ip -6 addr add new_IPv6_address_in_range/64 dev eth0
for i in {1..100..1};
ip -6 addr add 2604:a880:2:d0::1425:100f:i/64 dev eth0;
done
@tiancheng91
Copy link
Author

brew install php
pecl install xdebug
pecl install mongodb

[xdebug]
xdebug.remote_autostart = 1
xdebug.remote_enable = 1

@tiancheng91
Copy link
Author

tengine

./configure  --prefix=/opt/nginx --with-ipv6 --with-file-aio --with-http_v2_module --with-http_sub_module --with-http_mp4_module --with-http_gzip_static_module --with-http_sysguard_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module

make
make install

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