Week 6.3—initial_ec2
Completing the Set-Up by Yourself!!
1 min readOct 10, 2021
--
Last time, we downloaded and ran the EC2 code to prepare our server for uploads. However, this time, we will do it manually, running every single component by our hands.
Setting Time Zone (Korea)
sudo ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
Python
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
PIP (PIP3 -> PIP)
# downlaod pip3
sudo apt-get update
sudo apt-get install -y python3-pip # command for pip instead of pip3
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
MongoDB
- Download MongoDB
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list sudo apt-get update sudo apt-get install -y mongodb-org
2. Run MongoDB
sudo service mongod start
3. Create an Account for MongoDB
# change account type to admin
use admin; # create account and set passwords
db.createUser({user: "test", pwd: "test", roles:["root"]});
Port Forwarding (80 -> 5000)
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000
Done! Next time, we’ll finally upload our projects to the server.
Fin.