centos6 vps部署rails

c3tc3tc3t發表於2017-10-17

centos 6 vps初始化部署rails應用
1 ssh登入 vps
ssh -p port root@server_ip_address

2 新增使用者

adduser username
passwd username

3將使用者新增到wheel組,得到sudo許可權

vi /etc/sudoers

將%wheel ALL=(ALL) ALL 前面註釋 #去掉,儲存退出

usermod -aG wheel username

注意: 如果centos新增了authroized_keys不能無密碼登入可能是許可權問題
http://www.cnblogs.com/snowbook/p/5671406.html
原因是,不能讓所有者之外的使用者對authorized_keys檔案有寫許可權,否則,sshd將不允許使用該檔案,因為它可能會被其他使用者篡改
authroized_keys修改成644
ssh配置檔案中開起如下開啟
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

4 安裝rvm

https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/install_language_runtime.html


5 安裝nodejs

https://github.com/creationix/nvm

注意新增軟連線 :

sudo ln -s /home/rudy/.nvm/versions/node/v8.7.0/bin/node /usr/bin/node


6 centos 安裝最新git

You can use WANDisco's CentOS repository to install Git 2.x.

Install WANDisco repo package:
sudo yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
Install the latest version of Git 2.x:
sudo yum install git
Verify the version of Git that was installed:
git --version
As of 2017-02-08, the latest available version from WANDisco is 2.11.0.


7 安裝 passenger
https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/install_language_runtime.html

8 git clone 專案

9 安裝 imagemagick
yum install -y ImageMagick ImageMagick-devel

10 配置 secrets.yml
bundle exec rake secret
得到的secret可以貼上到 secrets.yml中 具體看 https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el6/deploy_app.html


11 修改config db cofig/database.yml config/sectrts.yml許可權

chmod 700 config db
chmod 600 config/database.yml config/secrets.yml


12 編輯Nginx 配置檔案

 

相關文章