Skip to content

Instantly share code, notes, and snippets.

@ltfschoen
Last active January 13, 2020 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ltfschoen/bffe25d02e034c45afce56645d601694 to your computer and use it in GitHub Desktop.
Save ltfschoen/bffe25d02e034c45afce56645d601694 to your computer and use it in GitHub Desktop.
osboxes.org ubuntu 18.04 setup

------- START IGNORE

shasum -a 256 18.04.3VB-64bit.7z
brew install p7zip
  • Extract 7z file
7za x 18.04.3VB-64bit.7z
  • Open Virtual box

  • Load the download as harddisk:

    • Tools > Media > select ~/Downloads/64bit/Ubuntu 18.04.3 (64bit).vdi ------- END IGNORE
  • Welcome > New > Enter name: ubuntu64bit1804; choose Linux; choose Ubuntu 64-bit; use 4000 MB memory (half of your host machine)

  • Choose "Create a virtual hard disk" VirtalBox type, of fixed size 8GB

  • Change settings:

    • Settings > General > Advanced > Shared Clipboard > Bidirectional
    • Settings > General > Advanced > Drag and Drop > Bidirectional
    • System > Motherboard > Boot Order > "Check" Network
    • System > Processor > 2 CPUS (half the amount of CPUs your host machine has)
    • Display > Video Memory > 128 MB (or approx half what your graphics card has)
    • Display > Screen > Enable 3D Acceleration
    • Display > Scale Factor > 130%
    • Storage > Click "Add Hard Disk" under "Controller IDE" > Primary Master
    • Storage > Click "Add Optical Drive" under "Controller IDE" > Primary Slave
      • Choose the Virtual Box 6.1 Guest Additions ISO image
    • Network > Port Forwarding > Forward ports 4000, 8080, 5432, 3000 from 127.0.0.1 to same
    • Ports > Enable USB 3
    • Shared Folders > ~/Public, rename Folder name to: public, enable Auto Mount

Click Start > Install Ubuntu, English US keyboard, Minimal installation, Erase Disk and Install Ubuntu

------- START IGNORE Click "Start" > enter Ubuntu Password: osboxes.org (username is the same) DO NOT Click icon to install software updates and wait for them to install. (when you restart it may not load!!) ------- END IGNORE

View a folder on the desktop which is the shared folder that you created for access to your local machine fromn the VM.

Open the "Terminal" application (bash terminal)

Run the following to install guest additions and enable clipboard sharing (since we configured the VM to use Bidirectional clipboard sharing). If you get error Could not get lock /var/lib/dpkg/lock, then the Software Update and associated dialog window needs to be closed first.

sudo apt-get update &&
sudo apt-get install -y xorg-video-abi-23 &&
sudo apt-get install -y xserver-xorg-core &&
sudo apt-get install -y virtualbox-guest-utils &&
sudo apt-get install -y virtualbox-guest-x11 &&
sudo VBoxClient --clipboard

Copy some text from the local machine (i.e. CMD+C), and paste the text in the VM by "right-click > Paste" (i.e. CMD+V shortcut in the VM does not work).

  • Install dependencies
sudo apt-get install -y curl git wget xclip vim
sudo apt update &&
sudo apt install -y software-properties-common apt-transport-https wget &&
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - &&
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" &&
sudo apt update &&
sudo apt install -y code &&
code
  • Set VSCode as default text editor
sudo update-alternatives --set editor /usr/bin/code
  • Install VSCode Extensions
code --install-extension dbaeumer.vscode-eslint
code --install-extension eamodio.gitlens
code --install-extension eg2.tslint
code --install-extension msjsdiag.debugger-for-chrome
code --install-extension robertohuertasm.vscode-icons
code --install-extension infeng.vscode-react-typescript
code --install-extension Orta.vscode-jest
code --install-extension PeterJausovec.vscode-docker
code --install-extension rust-lang.rust
code --list-extensions
  • Install NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
source ~/.bashrc
command -v nvm
nvm list
nvm install v10.16.3
nvm use v10.16.3
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
  • Install Yarn Version Manager
curl -fsSL https://raw.githubusercontent.com/tophat/yvm/master/scripts/install.js | node
source ~/.yvm/yvm.sh
  • Setup Github SSH keys associated with current device
ssh-keygen -t rsa -b 4096 -C "Luke Schoen <ltfschoen@gmail.com>"
cat /home/ltfschoen/.ssh/id_rsa.pub
cd downloads
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb
sudo apt update
sudo apt upgrade -y
google-chrome
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
sudo apt-get remove docker docker-compose docker-engine docker.io
sudo apt-get purge docker-ce
sudo rm -rf /var/lib/docker

sudo apt-get update
sudo apt-get install \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg-agent \
  software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo docker run hello-world

sudo usermod -aG docker $USER
docker --version
sudo curl -L https://raw.githubusercontent.com/docker/compose/1.25.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
systemctl stop docker
sudo rm /var/run/docker.pid
sudo dockerd --debug --host tcp://127.0.0.1:2375
  • Setup LPWAN App Server
echo "export DOCKER_HOST=127.0.0.1:2375" >> ~/.bash_profile
source ~/.bash_profile
export DOCKER_HOST=127.0.0.1:2375
sudo usermod -aG docker $USER
sudo apt-get install -y python

git clone git@gitlab.com:MXCFoundation/cloud/lpwan-app-server.git
cd lpwan-app-server
git checkout develop
git pull --rebase origin develop
./appserver remote_database lora.test.cloud.mxc.org
  • Run in another tab
export DOCKER_HOST=127.0.0.1:2375
git clone git@gitlab.com:MXCFoundation/cloud/mxprotocol-server.git
cd mxprotocol-server
git checkout develop
git pull --rebase origin develop
./mxprotocol-server remote_database lora.test.cloud.mxc.org
  • Setup connection between:
docker network connect ...
  • i.e. connect three services' network docker network ls // for getting network name of lora-app-server and payments-service docker ps // for getting container id of mxprotocol-server docker network connect $(network name of lora-app-server) $(container id of mxprotocol-server) docker network connect $(network name of payments-service) $(container id of mxprotocol-server)

  • View Free Space

df -h

------- START IGNORE

https://docs.docker.com/config/daemon/ sudo docker info sudo service docker info dockerd --debug --host list dockerd --debug --dns list ps ax | grep docker

systemctl enable docker systemctl start docker systemctl status

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Grpc-Metadata-Authorization: Bearer ey...' -d '{ \ 
   "gateway": { \ 
     "boards": [ \ 
       { \ 
         "fineTimestampKey": "", \ 
         "fpgaID": "" \ 
       } \ 
     ], \ 
     "description": "string", \ 
     "discoveryEnabled": false, \ 
     "gatewayProfileID": "07ad4afd-7474-4eca-8177-49ec39d7f9b5", \ 
     "id": "760fe677ddada0f6", \ 
     "location": { \ 
       "accuracy": 0, \ 
       "altitude": 0, \ 
       "latitude": 0, \ 
       "longitude": 0, \ 
       "source": "UNKNOWN" \ 
     }, \ 
     "name": "lixuan", \ 
     "networkServerID": "1", \ 
     "organizationID": "1" \ 
   } \ 
 }' 'https://localhost:8080/api/gateways'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment