Skip to content

Instantly share code, notes, and snippets.

@ETiV
Last active August 29, 2015 13:59
Show Gist options
  • Save ETiV/10630364 to your computer and use it in GitHub Desktop.
Save ETiV/10630364 to your computer and use it in GitHub Desktop.
快速创建服务器环境, 使用 sudo 执行
# nginx version 1.6.0
# http://nginx.org/download/nginx-1.6.0.tar.gz
# Install GD Library, GeoIP, SSL-dev
# apt-get install -y libgd2-xpm-dev libgeoip-dev libssl-dev
./configure --prefix=/srv/nginx --user=www --group=www --with-poll_module --with-file-aio --with-http_ssl_module --with-http_spdy_module --with-http_realip_module \
--with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_dav_module --with-http_flv_module \
--with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module \
--with-http_secure_link_module --with-mail --with-pcre
# php version 5.5.11
# Decencies
# apt-get install libxml2 libxml2-dev libbz2-dev libcurl4-gnutls-dev libicu-dev libmcrypt-dev
./configure --prefix=/srv/php --enable-fpm --disable-short-tags --with-zlib --enable-bcmath --with-bz2 --enable-calendar \
--with-curl --enable-exif --enable-ftp --enable-gd-native-ttf --enable-intl --enable-mbstring --with-mcrypt --with-mysql=mysqlnd \
--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-sockets --enable-zip --enable-mysqlnd
/**
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
**/
#!/bin/bash
cd ~
# apt
apt-get update ; apt-get upgrade
apt-get install -y wget build-essential libtool libncurses5-dev libncursesw5-dev git libpcre3-dev zlib1g-dev
# put all softwares in ~/software
mkdir ~/software
cd ~/software
wget 'https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz' -O libevent-2.0.21-stable.tar.gz
wget 'http://www.zsh.org/pub/zsh-5.0.5.tar.bz2' -O zsh-5.0.5.tar.bz2
wget 'http://cznic.dl.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz' -O tmux-1.8.tar.gz
tar xzf libevent-2.0.21-stable.tar.gz
tar xzf tmux-1.8.tar.gz
tar xjf zsh-5.0.5.tar.bz2
cd ~/software/libevent-2.0.21-stable/
# make 会报错: libtool blahblah
# 修改 Makefile, 找到 SHELL = /bin/sh 修改为 /bin/bash
/bin/bash ./configure && make -j2 && make install
ldconfig
cd ~/software/tmux-1.8/
/bin/bash ./configure && make -j2 && make install
cd ~/software/zsh-5.0.5/
/bin/bash ./configure && make -j2 && make install
cd ~
curl -L http://install.ohmyz.sh | sh
# install nvm
curl https://raw.githubusercontent.com/creationix/nvm/v0.5.1/install.sh | sh
source ~/.zshrc
# install nodejs
NODE_10=`nvm ls-remote|grep v0.10|tail -n1`
nvm install $NODE_10
nvm alias default $NODE_10
# install cnpm
echo '\
#alias for cnpm \
alias cnpm="npm --registry=http://r.cnpmjs.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=http://cnpmjs.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment