From 74f3e9c1240571919377a9437123f1662399caa3 Mon Sep 17 00:00:00 2001 From: YIk Teng Hie Date: Sat, 22 May 2021 11:24:44 +0800 Subject: [PATCH] ubuntu --- ubuntu/README.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++ vagrant/README.md | 22 ++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 ubuntu/README.md create mode 100644 vagrant/README.md diff --git a/ubuntu/README.md b/ubuntu/README.md new file mode 100644 index 0000000..7c3fa5c --- /dev/null +++ b/ubuntu/README.md @@ -0,0 +1,77 @@ +# Useful shell command + +* commands + +```shell +// add a user to root group +$ visudo + +# User privilege specification +root ALL=(ALL:ALL) ALL +newuser ALL=(ALL:ALL)ALL + +hold `ctrl` and press `x` to save and exit +``` + + + +* run as root + +```shell +user@host$ sudo su - + +// prompt will show root login +root@host$ +``` + + + +* add a user to a group + +```shell +// create docker group +$ sudo groupadd docker + +// add current user to group +$ sudo usermod -aG docker ${USER} + +// restart to take effect +``` + + + +* change file permission + +```shell + +// excecute, read, write +$ chmod 777 filename + +// +``` + +## node version manager [nvm](https://github.com/nvm-sh/nvm) + +* version manger for nodejs +* use nvm to avoid npm version conflict installation +* ubuntu 20.10 support node 12 +* ubuntu 19.10 support node 10 + +```shell +// installation + +$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash + +$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash + +$ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + +// to install node version 10.10.0 +$ nvm install 10.10.0 + +// remove node to solve conflicting version +$ sudo apt-get remove nodejs +$ sudo apt autoremove +``` + diff --git a/vagrant/README.md b/vagrant/README.md new file mode 100644 index 0000000..cbc61e4 --- /dev/null +++ b/vagrant/README.md @@ -0,0 +1,22 @@ +# Vagrant + +* virtualize CLI. Required VM provider such as HyperV, VirtualBox, Vmware +* Box at [vagrant app](https://app.vagrantup.com/boxes) + +* CLI (run as admin) + +```shell + +// init folder for vm setup +$ vagrant init bento/ubuntu-19.10 + +// spin up the vm +$ vagrant up + +// login to vm +$ vagrant ssh + +// shoutdown the vm +$ vagrant halt +``` +