设置部署用户
useradd -m -s /bin/bash deploy
adduser deploy sudo
passwd deploy
sudo apt-get update
sudo apt-get install openssh-server
- 使用 deploy 登录 (实现公钥登录)
ssh deploy@xxx.xxx.xxx.xxx
sshkey-gen -t rsa
touch /home/deploy/.ssh/authorized_keys
- 将自己本机的 id_rsa.pub 的内容粘贴到上述文件中
配置服务器环境
ssh deploy@xxx.xxx.xxx.xxx
sudo apt-get install vim git curl
-
rvm
安装请看这
source .bashrc
rvm use --install --default 2.3.0
gem install bundler
服务的安装 我选择的目录是 /opt/Cellar
cd /opt/Cellar
sudo mkdir Cellar var rails
sudo chown deploy:deploy Cellar var rails
环境变量如下 /etc/profile
****
export JAVA_HOME=/opt/Cellar/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=$PATH:${JAVA_HOME}/bin:${JRE_HOME}/bin
export CUSTOM_SOFT_DIR=/opt/Cellar
PATH=$PATH:$CUSTOM_SOFT_DIR/elasticsearch-2.1.1/bin
PATH=$PATH:$CUSTOM_SOFT_DIR/redis-3.0.6/src
PATH=$PATH:$CUSTOM_SOFT_DIR/postgresql/bin
安装postgresql
wget https://ftp.postgresql.org/pub/source/v9.5.0/postgresql-9.5.0.tar.bz2
tar -jxvf postgresql-9.5.0.tar.bz2
cd postgresql-9.5.0
./configure --prefix=/opt/postgresql
- 纳尼 这里显示缺少redline 和 zliib的依赖 弱鸡们 有个命令 叫做 apt-cache search
sudo apt-get install libreadline-dev zlib1g-dev
./configure --prefix=/opt/postgresql
make -j8 #4核心8进程不好意思
make check & make install
- 至于怎么跑起来pg 请看源码中的 INSTALL
安装redis 直接make 不需要install
wget http://download.redis.io/releases/redis-3.0.6.tar.gz
- 解压等参考上面
make
安装elasticsearch
wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.1.1/elasticsearch-2.1.1.zip
- unzip it & install java then down
wget http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-i586.tar.gz?AuthParam=1453916054_032f3e8a251438200e26a0df7257cf6a
- unzip it to /opt/Cellar/jdk
nginx 参看官网 apt-get 即可