over 3 years ago
adduser appdev
adduser appdev sudo
vim /etc/ssh/sshd_config

update PasswordAuthentication from no to yes to allow new user login with password

service ssh restart

on local machine

ssh-copy-id appdev@mzctjkj.com
ssh appdev@mzctjkj.com
vim /etc/ssh/sshd_config

update PasswordAuthentication from yes to no to secure your linux server
and update PermitRootLogin from yes to no

sudo service ssh restart
sudo apt-get update
sudo apt-get upgrade

install tool

sudo apt-get install build-essential git-core curl libssl-dev libreadline5 libreadline-gplv2-dev zlib1g zlib1g-dev libcurl4-openssl-dev libxslt-dev libxml2-dev libffi-dev git vim

install rvm without root user

\curl -sSL https://get.rvm.io | bash
source ~/.rvm/scripts/rvm

install ruby now

rvm install 2.3.1

update gem source from default to china mirror

gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
gem sources -l

$## confirm there is only one gems.ruby-china.org
gem install bundler
gem install passenger
rvmsudo passenger-install-nginx-module

选择Ruby & NodeJS

再选择选项1. Yes: download, complie and install Nginx for me. (recommended)

选择安装目录, 可以直接按回车,使用默认安装目录[/opt/niginx]

install nginx with passenger now

git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git
sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
sudo chown root:root /etc/init.d/nginx
sudo vim /lib/systemd/system/nginx.service
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID

restart nginx to verify

sudo /etc/init.d/nginx restart

install rails

gem install rails -v 5.1.4

install nodejs

sudo apt-get install npm

install PostgreSQL

sudo apt-get install postgresql postgresql-contrib libpq-dev
gem install pg

update postgre password

sudo -u postgres psql
\password postgres

leave by


let rails know how to connect database

sudo vim /etc/postgresql/9.5/main/pg_hba.conf

update all md5 to peer

sudo /etc/init.d/postgresql reload

now the machine is running

← how to host a singe page application with nginx erc20_code →