Homebrew + Nginx + PHP-FPM + Redis + MongoDB + MariaDB on MAC OS

nano ~/install.sh

#!/usr/bin/bash # Перед запуском обязательно установите последний JDK # http://www.oracle.com/technetwork/java/javase/downloads/index.html # wget http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-macosx-x64.dmg # Устанавливаем Xcode # Устанавливаем Command Line Tools xcode-select --install ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # Устанавливаем репозитории brew tap homebrew/versions/bison27 brew tap homebrew/versions brew tap homebrew/dupes brew tap josegonzalez/homebrew-php brew tap dart-lang/dartbrew tap dart-lang/dart brew tap homebrew/nginx brew update brew upgrade brew install caskroom/cask/brew-cask brew install lzlib BREW=$(cat <<BREW aircrack-ng android-sdk ant atk autoconf autoconf-archive automake bash binutils bison27 boost boost-build brew-cask cabextract cairo cloog cloog-ppl015 cloog018 cmake coreutils cpanminus curl dart diffutils drush ed elasticsearch erlang file-formula findutils flex fontconfig freetype gawk gcc gd gdbm gdk-pixbuf gearman geoip gettext git glib gmp gmp4 gnu-indent gnu-sed gnu-tar gnu-which gnutls gobject-introspection gpatch grep gzip harfbuzz htop-osx icu4c isl isl011 jasper jpeg less libbson libconfig libev libevent libffi libgcrypt libgpg-error libgphoto2 libicns libmemcached libmpc libmpc08 libpng libsodium libssh2 libtasn1 libtiff libtool libusb libusb-compat libxml2 libyaml little-cms2 logrotate lzip lzo m4 make makedepend mariadb mcrypt memcached mercurial mhash midnight-commander mongodb mongodb24 mpfr mpfr2 nano ncurses nettle nginx ngrep node nspr openssl openvpn ossp-uuid p7zip pango pbzip2 pcre perl518 phantomjs php54 --with-fpm php54-apc php54-gearman php54-geoip php54-mcrypt php54-memcache php54-memcached php54-mongo php54-pcntl php54-redis php54-xdebug php54-yaml pigz pixman pkg-config popt postgresql pyqt5 python python3 qcachegrind qt qt5 rbenv re2c readline reaver redis ruby ruby-build s-lang samba sane-backends scons sip sphinx spidermonkey sqlite tuntap unixodbc unoconv unrar v8 watch wdiff wget wxmac xz BREW ) brew install `echo $BREW|sed "s/screen//"|sed "s/brew-cask//"|sed "s/dart//"` brew install libpng --universal brew install wine --with-gcc brew install wine winetricks brew unlink php54 && brew link php54 #brew install php-code-sniffer #brew install composer PROFILE=$(cat <<PROFILE export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/libexec:~/bin:$PATH export PATH=$PATH:/usr/local/etc/bash_completion.d export PATH="$(brew --prefix php54)/bin:$PATH" export PEAR_HOME="/usr/local/lib/php/PEAR" export PATH="$PEAR_HOME:$PATH" export PATH=/usr/local/apache2nginx/bin:$PATH export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" export MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH" export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512M" export JAVA_HOME=`/usr/libexec/java_home -v 1.8` export PKG_CONFIG_PATH=$(find /usr/local/Cellar -name 'pkgconfig' -type d | grep lib/pkgconfig | tr '\n' ':' | sed s/.$//) # pip install --upgrade setuptools # pip install --upgrade pip # ARCHFLAGS="-arch x86_64" gem install pg export TERM=xterm-256color export LANG=ru_RU.UTF-8 # CMAKE_PREFIX_PATH export CMAKE_PREFIX_PATH="/usr/local/opt/qt5/lib/cmake" export QTPATH=/usr/local/opt/qt5/bin alias qmake=/usr/local/opt/qt5/bin/qmake # Дополнительные свойства для текта: BOLD='\033[1m' # ${BOLD} # жирный шрифт (интенсивный цвет) DBOLD='\033[2m' # ${DBOLD} # полу яркий цвет (тёмно-серый, независимо от цвета) NBOLD='\033[22m' # ${NBOLD} # установить нормальную интенсивность UNDERLINE='\033[4m' # ${UNDERLINE} # подчеркивание NUNDERLINE='\033[4m' # ${NUNDERLINE} # отменить подчеркивание BLINK='\033[5m' # ${BLINK} # мигающий NBLINK='\033[5m' # ${NBLINK} # отменить мигание INVERSE='\033[7m' # ${INVERSE} # реверсия (знаки приобретают цвет фона, а фон -- цвет знаков) NINVERSE='\033[7m' # ${NINVERSE} # отменить реверсию BREAK='\033[m' # ${BREAK} # все атрибуты по умолчанию NORMAL='\033[0m' # ${NORMAL} # все атрибуты по умолчанию # Цвет текста: BLACK='\033[0;30m' # ${BLACK} # чёрный цвет знаков RED='\033[0;31m' # ${RED} # красный цвет знаков GREEN='\033[0;32m' # ${GREEN} # зелёный цвет знаков YELLOW='\033[0;33m' # ${YELLOW} # желтый цвет знаков BLUE='\033[0;34m' # ${BLUE} # синий цвет знаков MAGENTA='\033[0;35m' # ${MAGENTA} # фиолетовый цвет знаков CYAN='\033[0;36m' # ${CYAN} # цвет морской волны знаков GRAY='\033[0;37m' # ${GRAY} # серый цвет знаков # Цветом текста (жирным) (bold) : DEF='\033[0;39m' # ${DEF} DGRAY='\033[1;30m' # ${DGRAY} LRED='\033[1;31m' # ${LRED} LGREEN='\033[1;32m' # ${LGREEN} LYELLOW='\033[1;33m' # ${LYELLOW} LBLUE='\033[1;34m' # ${LBLUE} LMAGENTA='\033[1;35m' # ${LMAGENTA} LCYAN='\033[1;36m' # ${LCYAN} WHITE='\033[1;37m' # ${WHITE} # Цвет фона BGBLACK='\033[40m' # ${BGBLACK} BGRED='\033[41m' # ${BGRED} BGGREEN='\033[42m' # ${BGGREEN} BGBROWN='\033[43m' # ${BGBROWN} BGBLUE='\033[44m' # ${BGBLUE} BGMAGENTA='\033[45m' # ${BGMAGENTA} BGCYAN='\033[46m' # ${BGCYAN} BGGRAY='\033[47m' # ${BGGRAY} BGDEF='\033[49m' # ${BGDEF} # Finished adapting your PATH environment variable for use with MacPorts. # export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" #export PHP_AUTOCONF=/usr/local/bin/autoconf #export PHP_AUTOHEADER=/usr/local/bin/autoheader export PHP_AUTOCONF="'$(which autoconf)'" export PHP_AUTOHEADER="'$(which autoheader)'" # history # Не сохраняем в историю export HISTIGNORE="\&:ls:ln:ll:la:cd:fg:bg:exit:clear:mc:source:ep:er:h:history:man:pwd:." export HISTSIZE=90000 # Сохранение истории за сессию export HISTFILESIZE=${HISTSIZE} # Межсессионое хранение истории export HISTTIMEFORMAT="[%Y-%m-%d - %H:%M:%S] " export HISTCONTROL=ignoreboth:erasedups export HISTFILE=~/.bash_history # grep export GREP_OPTIONS='--color=auto' #export GREP_COLOR='5;38' #мигающий export GREP_COLOR='1;33' #ярко-желный на черном shopt -s cmdhist shopt -s histappend #export CLICOLOR=1 #export LSCOLORS=dxfxcxdxbxegedabagacad export CLICOLOR=1 export LSCOLORS=ExFxCxDxBxegedabagacad PS1="\[$GREEN\]\u \[$LBLUE\]\w \[$LGREEN\]\$ \[\033[0m\]" #ln -s mate ~/bin/mate_wait # run this once to create the link #export EDITOR='~/bin/mate -w' # use in your ~/.bash_profile #alias nano='nano -u' alias nano='nano' export EDITOR='nano' alias m='~/bin/mate -w ' #alias sssh="ssh -C -Xv " #alias c='tabc SSH;sssh centre;tabc' alias newip="sudo ipconfig set en0 BOOTP;sudo ipconfig set en0 DHCP" alias localip="ipconfig getifaddr en0 2>&1" alias remoteip='dig +short myip.opendns.com @resolver1.opendns.com' alias ips="ifconfig -a | grep -o 'inet6\? \(\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)\|[a-fA-F0-9:]\+\)' | sed -e 's/inet6* //'" #alias rp="source ~/.profile " # history alias h="history|grep -i ${1}" alias hc="history -c" alias groups="groups | tr ' ' '\n'" # Операции с group alias group="dseditgroup -v -o read -t group ${1}" alias groupcreate="sudo dseditgroup -v -o create -t group ${1}" alias groupdel="sudo dseditgroup -v -o delete -t group ${1}" # Операции с User (Добавление/удаление в/из группу ${1}) alias groupcheck="dseditgroup -v -o checkmember -m $USER -t group ${1}" alias groupadd="dseditgroup -v -p -o edit -a $USER -t user ${1}" alias grouprm="dseditgroup -v -p -o edit -d $USER -t user ${1}" # Composer alias getcomposer='wget https://getcomposer.org/composer.phar' alias ci='rm ./composer.phar && getcomposer && php ./composer.phar install' alias getyii2='rm ./composer.par && getcomposer && php ./composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic ./yii && cd yii && ./yii' alias getyii2-advanced='rm ./composer.par && getcomposer && php ./composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced ./yii && cd yii && ./yii' #alias grep='grep -ilr --color=auto' alias grep='grep --color=auto' alias ls="ls -lahFG --color=auto" alias cp="cp -ivpRP " # interactive, verbose alias rm='rm -Rifv' # interactive alias rmf='rm -Rf' alias mv="mv -iv" # interactive, verbose alias ln='ln -ivs' alias chown='chown -vR ' alias chmod='chmod -v ' alias chgrp='chgrp -v ' alias make="make" alias curl='curl ' alias mkdir='mkdir -pv' alias diff='colordiff' alias mount='mount |column -t' #alias x='exit' alias which='which -a ${1}' alias locateupdate='sudo /usr/libexec/locate.updatedb' alias cls='clear' # Sudo alias tcp="sudo lsof -iTCP -sTCP:LISTEN -P -n| grep ${1}" alias udp="sudo lsof -iUDP -P -n| grep ${1}" # |egrep -v '(127|::1) alias ports="sudo lsof -iTCP -iUDP -sTCP:LISTEN -P -n" #sudo lsof -iTCP:80 -sTCP:LISTEN #alias port="sudo port ${1}" alias upgrade="brew update && brew upgrade" # alias wget="sudo curl -O -C - " alias wget="wget --no-check-certificate " alias path='echo ${PATH//:/\\n}' alias listuser="users | tr ' ' '\n'; echo '====================='; " #alias ej="diskutil eject /Volumes/*[!Pro_HD]" alias ping='ping -c 5 -s 2' alias ~='cd ~/;pwd;' alias .='pwd;' alias ..='cd ..;pwd;' alias ...='cd ../..;pwd;' alias ....="cd ../../..;pwd;" alias wbc24="cd /usr/local/var/www/wbc-24.loc" # Обновление всего программного обеспечения alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g; sudo gem update; cpan -u' alias soffice='/Applications/LibreOffice.app/Contents/MacOS/soffice' alias soffice.bin=soffice # Конфигурации / Редактирование alias vhn="m /opt/local/apache2/conf/httpd.conf" alias er='source ~/.profile' alias ep='m ~/.profile' # # mysql # alias mysqlup='mysql_upgrade -u root -p' # # Server # alias startserver='bash ~/bin/server-resart.sh' alias stopserver='bash ~/bin/server-stop.sh' alias restartserver='bash ~/bin/server-resart.sh' alias serverstart=startserver alias serverstop=stopserver alias serverrestart=restartserver # # Функции # ssr() { cat ~/.ssh/id_rsa.pub | ssh "${1}" 'cat >> .ssh/authorized_keys' } man() { #alias man='LANG=C man' sudo LANG=C man -t "${1}" | open -f -a /Applications/Preview.app } function locate () { local MAXAGE=$(( 24 * 60*60 )) # twenty-four hours, in seconds. local NOW="$(date +%s)" local DB="/var/db/locate.database" if [ ! -e "$DB" ] then echo "$FUNCNAME: $DB does not exist. Initializing..." > /dev/stderr sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist > /dev/stderr echo "$FUNCNAME: Please try again in a few minutes." > /dev/stderr return -1 # stop and fail, there's nothing we can do until the database has been created. fi local DBCREATED="$(eval $(stat -s $DB); echo $st_mtime )" local DBAGE="$(( $NOW - $MAXAGE ))" if [ $DBAGE -gt $NOW ] then echo "$FUNCNAME: $DB is more than $(( $MAXAGE / (60*60) )) hours old. Updating..." > /dev/stderr #sudo launchctl start com.apple.locate > /dev/stderr sudo /usr/libexec/locate.updatedb echo "$FUNCNAME: stale results: " > /dev/stderr fi command locate "$@" } #ulimit -S -n 4096 function xt() { # xt = eXTract, a wrapper to extract many different archive formats if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xvf $1 ;; *.tbz2) tar xvjf $1 ;; *.tgz) tar xvzf $1 ;; *.zip) unzip $1 ;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted via >extract<" ;; esac else echo "'$1' is not a valid file" fi } # function procs() # { # # n=`netstat -an | wc -l` # nw=`netstat -an | grep WAIT | wc -l` # p=`ps -ef | wc -l` # psh=`ps -ef | fgrep sh | wc -l` # # echo "netstat: $n wait: $nw ps: $p sh: $psh" # # } function commands { if [ -z "$1" ]; then ALIASES=`alias`; else ALIASES=`alias | grep $1`; fi echo "$ALIASES" | sort -u } # Вывод списка установленных программ, доступных через путь $PATH function progs { echo $PATH | tr ':' '\n' | xargs -I {} find {} -maxdepth 1 -type f -perm '++x' } # Поиск файлов f() { sudo find "${1}" -type f -print 2>/dev/null; } # Поиск папок fd() { sudo find "${1}" -type d -print 2>/dev/null; } sshr(){ cat ~/.ssh/id_rsa.pub | ssh "${1}" 'cat >> .ssh/authorized_keys' } # git clone + submodules gc(){ git clone cd "${1}" && git submodule update --init --recursive } # Удаление новой строки и замена ее на пробел trim(){ tr '\n' ' ' } alias rmnl=trim # # Ruby On Rails # alias ruby=/usr/local/bin/ruby alias gem=/usr/local/bin/gem alias irb=/usr/local/bin/irb alias rails=/usr/local/bin/rails alias redis=/usr/local/bin/redis-cli export HOMEBREW_GITHUB_API_TOKEN="396dfcaf6d372299678bf6274114acf84a84457c" # # Подключаемые скрипты # source /Users/mirocow/.iterm2_shell_integration.bash ulimit -S -n 4096 PROFILE ) echo $PROFILE > ~/.profile