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 配置文件