Saturday, January 14, 2023

How To Install & Configure JupyterLab Environment On Rocky Linux 9

 JupyterLab is a next-generation web-based development environment for Project Jupyter. Project Jupyter was developed with the goal to develop open-source, open standards, and services for interactive computing across multiple programming languages. JupyterLab offers a flexible interface that allows developers to work with documents and activities such as Jupyter notebooks, text editors, terminals, and custom components in a flexible, integrated, and extensible manner. JupyterLab is the next generation of Jupyter Notebook and is supposed to eventually replace it. It supports over 40 programming languages, including R, Python, Scala, and Julia.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; dnf groupinstall "Development Tools" -y
dnf install wget curl nano unzip yum-utils -y
firewall-cmd --add-service=http --permanent ; firewall-cmd --add-service=https --permanent ; firewall-cmd --reload

nano /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

dnf install nginx -y
systemctl enable nginx --now ; systemctl status nginx

python -V
dnf install python3-pip -y
mkdir jupyterlab ; cd ~/jupyterlab
python3 -m venv --system-site-packages jupyterlab_env
source jupyterlab_env/bin/activate
pip install --upgrade pip
pip install jupyterlab

python3 -c "from jupyter_server.auth import passwd; print(passwd('YOUR_PASSWORD'))"
jupyter lab --generate-config
nano ~/.jupyter/jupyter_lab_config.py
c.ServerApp.allow_remote_access = True
c.ServerApp.password = 'YOUR_PASSWORD'
=8$jAJtckno+4fUhJ7nXWbR+w$kaMe/LaitfDs7vRKLEVRrb08WNiMZEAhXHGjfIbgtkU

firewall-cmd --add-port=8888/tcp --permanent ; firewall-cmd --reload
jupyter lab --ip 0.0.0.0 --allow-root
http://127.0.0.1:8888/
deactivate
__________________________________________________________________________________________________________________________________

Sunday, January 8, 2023

How To Install and Secure MongoDB on Oracle Linux Server 9

 MongoDB is an object-oriented, schema-less, NoSQL database server used in developing modern dynamic apps.
__________________________________________________________________________________________________________________________________
Server - Os:  Oracle Linux Server 9.0   64Bit      | IP -192.168.1.50        |Hostname - server.testbox.com
__________________________________________________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

nano /etc/yum.repos.d/mongodb-org-4.4.repo     [ Latest Repo - https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/ ]
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc

dnf install mongodb-org -y
systemctl start mongod ; systemctl enable mongod ; mongod --version

Configure MongoDB -
nano /etc/mongod.conf
security:
 authorization: enabled
systemctl restart mongod

Create an Admin User for MongoDB -
mongosh    Or mongosh "mongodb://localhost:27017"
use admin

db.createUser(
{
user: "mongoadmin",
pwd: passwordPrompt(),
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)

exit
systemctl restart mongod
mongosh --port 27017 --authenticationDatabase "admin" -u "mongoadmin" -p



Create a Database in MongoDB- --
use wpdb
db.person.insertOne(
  { "Anant" : "31",
   "Test" : "8",
   "Test Two" : "18"
  }
)
db
show collections
db.person.find()
use admin
db.getUsers()
__________________________________________________________________________________________________________________________________

rm -rf mongod.lock rm -rf /tmp/mongodb-27017.sock