更新源這些操作請(qǐng)自行百度
安裝git
apt-get install git
安裝rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
用來編譯安裝 ruby
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
用來管理 gemset, 可選, 因?yàn)橛?bundler 也沒什么必要
git clone git://github.com/jamis/rbenv-gemset.git ~/.rbenv/plugins/rbenv-gemset
通過 rbenv update 命令來更新 rbenv 以及所有插件, 推薦
git clone git://github.com/rkh/rbenv-update.git ~/.rbenv/plugins/rbenv-update
使用 Ruby China 的鏡像安裝 Ruby, 國(guó)內(nèi)用戶推薦
git clone git://github.com/AndorChen/rbenv-china-mirror.git ~/.rbenv/plugins/rbenv-china-mirror
然后把下面的代碼放到 ~/.bash_profile 里
export PATH="
PATH"
eval "$(rbenv init -)"
注意 Unubtu請(qǐng)放到 ~/.bashrc 里, zsh用戶是 ~/.zshrc
記得刷新環(huán)境變量
然后重開一個(gè)終端就可以執(zhí)行 rbenv 了.
安裝 ruby
rbenv install --list # 列出所有 ruby 版本
rbenv install 1.9.3-p392 # 安裝 1.9.3-p392
出現(xiàn) install notfound 重新運(yùn)行
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
可能需要安裝的插件(根據(jù)安裝ruby時(shí)的錯(cuò)誤提示 )
apt-get install -y libssl-dev libreadline-dev zlib1g-dev
apt-get install -y libssl-dev libreadline-dev
設(shè)置使用的ruby版本(安裝好ruby之后一定要執(zhí)行)
rbenv global 1.9.3-p392
安裝 rails
先將gem設(shè)置源
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
然后執(zhí)行
gem install rails -v 版本號(hào)
安裝nginx
apt-get install nginx
安裝mysql
首先運(yùn)行mysql指令 顯示結(jié)果
The program 'mysql' can be found in the following packages:
- mysql-client-core-5.7
- mariadb-client-core-10.0
- Try: apt install selected package
然后根據(jù)提示安裝相應(yīng)的包,最后運(yùn)行
apt-get install mysql-server
安裝node
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
安裝yarn
npm install -g yarn