在Ubuntu上安装和设置使用的语言的方法和环境构建等方面
最近我在为每种后端语言准备虚拟机环境并进行学习,并且最近我在使用Gist来管理环境配置方法,但是现在转移到了Qitta上。但需要注意的是,我的Gist是用英语写的。
环境
-
- host OS: Windows
-
- VM: Virtual Box with Vagrant
Ubuntu 18.0
使用Ubuntu来构建CUI或GUI的虚拟环境是这边的选择。
Ruby on Rails is a web development framework written in the Ruby programming language.
安装最新版本
# install in one time
sudo apt install autoconf bison build-essential libssl-dev libreadline-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev
# install rbenv
# rbenv is tool to manage a few of ruby versions and enable to change ruby ver. project by project.
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
# Install ruby
rbenv install --list
rbenv install 2.〇.〇
rbenv global 2.〇.〇
# Instal yarn
# Rails6 needs webpacker, and Webpacker needs yarn to install
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
# Install Rails
gem install rails --no-document
# install webpacker
# inner App
rails webpacker:install
通过”apt install”命令安装RubyonRails
sudo apt install -y ruby ruby-dev build-essential
sudo apt install yarn
sudo gem install rails
-
- “-y” means “All Yes”
-
- build-essential contain information about package to build Debian pack.
If do not build Debian, build~ is not needed
Reference
Node.js
Rails6使用Webpacker,需要Node.js。
# first, install nodejs and npm
sudo apt install -y nodejs npm
# install n-package
sudo npm install n -g
# by n-package, install node
sudo n stable
# uninstal old nodejs and npm, and re-login
sudo apt purge -y nodejs npm
exec $SHELL -l
# confirm
node -v
生锈
当 Discord 将 Golang 更换为 Rust 时,我尝试了一下并写了一点代码。
sudo apt install build-essential
# install rust
curl https://sh.rustup.rs -sSf | sh
# add the pass
source $HOME/.cargo/env
Java (Java)
sudo apt update
sudo apt install git
sudo apt install openjdk-11-jdk
# confirmation
java --version