Sign inSign up

moonlitaltar/cs340noavx

By moonlitaltar

•Updated over 2 years ago

Docker image for CS340 with an older version of mongo for CPUs without AVX support

Image
Databases & storage
0

308

moonlitaltar/cs340noavx repository overview

⁠Open Terminal
⁠Get Container:
docker pull moonlitaltar/cs340noavx:latest
⁠Run Container:

Change "container_name" to whatever you'd like the container to be called

docker run -d -p 27017:27017 --name container_name moonlitaltar/cs340noavx
⁠Run Commands
docker exec -it container_name bash
⁠Add user

Create a user using your SNHU handle for assignments.

su -
useradd -m -s /bin/bash yourname_snhu
passwd yourname_snhu
su - yourname_snhu
⁠The datasets for CS340 are on the image and located at /usr/local/datasets
⁠Add MongoDB environment file to bash
echo 'source /usr/local/datasets/mongodb-env.txt' >> ~/.bashrc
echo 'alias mongo="mongo --shell --eval \"var mongo_user='\''$MONGO_USER'\''; var mongo_password='\''$MONGO_PASS'\''; var mongo_host='\''$MONGO_HOST'\''; var mongo_port='\''$MONGO_PORT'\'';\""' >> ~/.bashrc


⁠Copy mongorc.js file to home folder
cd /usr/local/datasets
cp mongorc.js ~/.mongorc.js
source ~/.bashrc
⁠Connect to mongo shell
mongo
⁠Change root user password in MongoDB
db.changeUserPassword("root", "NewPasswordHere")
exit
exit - # This returns to root user
⁠Edit MongoDB environment file
cd /usr/local/datasets
nano mongodb-env.txt

Change the password for MONGO_PASS from "password" to what you put in for "NewPasswordHere", use Ctrl+S to save, then Ctrl+X to exit.

⁠Change User and Test Connection
su - yourname_snhu
mongo
⁠If it connects without errors and starts you in the admin database, that means everything is setup correctly.
⁠Install Jupyter - (You must have Python Installed with pip before continuing)
  • Either exit the container or open a new terminal. Run the following:
pip install pymongo notebook jupyter-dash dash-leaflet==0.1.9 dash==2.8.1 pandas==1.4.2 matplotlib
⁠When you get to module 4
⁠If you get errors in visual studio code about pymongo, make sure you're python interpreter path is correct, it should look something like this:
C:\Users\yournamehere\AppData\Local\Programs\Python\Python312\python.exe
⁠To Start Jupyter Notebook
  • Open your terminal and navigate to the folder where your python file is located
jupyter notebook
  • Your browser should automatically open jupyter notebook and you can proceed to making scripts

Tag summary

Content type

Image

Digest

sha256:bf281bf46…

Size

188.7 MB

Last updated

over 2 years ago

docker pull moonlitaltar/cs340noavx