Rails centos部署环境搭建

添加用户 deployer

groupadd deployer
adduser deployer -g deployer
passwd deployer
sudo vi /etc/sudoers #加上 deployer ALL=(ALL:ALL) ALL
su - deployer

安装 ruby

\curl -sSL https://get.rvm.io | bash -s stable

sed -i -e 's/ftp.ruby-lang.org/pub/ruby/gems.ruby-china.org/mirrors/ruby/g' ~/.rvm/config/db
rvm install 2.3.1
rvm use 2.3.1 --default

gem source -r https://rubygems.org/
gem source -a http://mirrors.aliyun.com/rubygems/

gem install bundler

sudo yum install mysql-devel

安装nginx

sudo yum -y install nginx
sudo service nginx start
sudo systemctl enable nginx

创建程序目录

mkdir /var/www/app_name
需要 /var/www/app_name 这些目录都有 755 权限
sudo chmod 755 /var/www
sudo chmod 755 /var/www/app_name
sudo chown -R -v deployer:deployer /var/www

开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo systemctl stop firewalld.service
sudo systemctl start firewalld.service

你可能感兴趣的:(Rails centos部署环境搭建)