1. 安装rvm
系统centos7
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
rvm -v
2. 安装ruby
rvm install -v 2.6
3. 安装rails
rvm gemset create rails602
rvm 2.6.3@rails602
gem sources --remove https://rubygems.rog
gem sources --add https://gems.ruby-china.com
gem install rails -v 6.0.2
rvm gemset 2.6.3@rails602 --default
4. 新建项目blog
rails new blog
cd blog
bundle install
5. 安装nodejs
wget https://nodejs.org/dist/v13.11.0/node-v13.11.0-linux-x64.tar.xz
解压,把bin目录加到PATH里。
6. 执行webpack:install
rails webpack:install
7. 安装yarn
wget https://github.com/yarnpkg/yarn/releases/download/v1.12.0/yarn-v1.12.0
.tar.gz
解压,把 bin目录加到PATH里。
8. 升级sqlite3
wget https://www.sqlite.org/2020/sqlite-autoconf-3310100.tar.gz
tar xvfz sqlite*.gz
cd sqlite-autoconf-3310100
./configure
make
make install
mv /usr/bin/sqlite3 /usr/bin/sqlite3.old
ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
export LD_LIBRARY_PATH="/usr/local/lib" 加到/etc/profile中,并source。
sqlite3 -version 验证。
9. 运行项目
rails s -b 0
开放3000端口
firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --reload