Friday, 20 September 2024

Network in AWS - VPC

How to make EC2 instance in private subnet to access internet

  • Create a NAT gateway in public subnet
  • Edit route table associated to the private subnet. add a roue. destination: 0.0.0.0/0 target: that nat gateway

Security group

  • security group is locked down to region and vpc combination
  • security group only set ALLOWED rules

Saturday, 7 September 2024

Use WSL (The Windows Subsystem for Linux )

When I bought a new window machine, I would wipe window out and install linux. For window 11 machine I just bought, it has WSL. I want to try it.

Install WSL

  1. Log in, run as admin and install
    wsl --install
  2. restart machine
  3. create user name and password

To use Ubuntu

  • click start button, find Ubuntu and click it.
  • another way is to open windon cmd terminal, click arrow, and choose Ubuntu

Install development tools

To install tools such as Docker, vscode and npm, please check docs and DO NOT install directly in ubuntu using apt install.

Install git

  1. sudo apt update
  2. sudo apt install git-all

Install node and npm

sudo apt-get install curl

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

#restart terminal. Then
nvm install --lts

#see nodes installed
nvm ls

Access Window files from Linux

cd /mnt/c/Users/<your_Windows_username>
#for example
cd /mnt/c/Users/oldwe/Downloads/
cp prj-00-initial-starting-setup.zip ~/. 

Install MySQL

sudo apt update
sudo apt install mysql-server

Start and access MySQL

# start MySQL server
systemctl status mysql

# open MySQL client as log in as root
sudo mysql

# create a new user
CREATE USER 'leo'@'localhost' IDENTIFIED  BY 'test1234';

# normally should give privileges by db name.
GRANT ALL PRIVILEGES ON *.* TO 'leo'@'localhost';

In Summary, after install MySQL, to work with it, we need

#start server
systemctl status mysql

#login as root
sudo mysql

#login as a user
mysql -u leo  --password=test1234

Debug

issue 1: Can not access docker daemon in Ubuntu after window update

Solution, need to enable docker desktop with wsl in docker desktop setting.