Monday, January 3, 2022

Laravel with MongoDB

 STEPS TO INSTALL MONGODB

 Ensure that the following php extensions are installed:

    

sudo apt-get install php-pear 
sudo apt install php7.4-dev //sudo apt install php8.0-dev

sudo pecl install mongodb

sudo apt-get install php-mongodb
 
MONGODB INSTALLATION COMMANDS 

 

commands:

    1:Import the public key used by the package management system.

 wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

 

    2: Create a list file for MongoDB

   

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list


    3.Reload local package database

 sudo apt-get update

    4.Install the MongoDB packages

 sudo apt-get install -y mongodb-org

    5.Start MongoDB

sudo systemctl start mongod

    6.Verify that MongoDB has started successfully

sudo systemctl status mongod //enable, stop, restart

 

sudo systemctl enable mongod
 


STEPS TO INSTALL LARAVEL WITH MONGODB

During 'composer install', it will show issues with the following packages. 

composer require mongodb/mongodb --ignore-platform-reqs
composer require jenssegers/mongodb --ignore-platform-r

 

 

composer require mongodb/mongodb --ignore-platform-reqs
composer require jenssegers/mongodb --ignore-platform-r

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

https://blog.shahednasser.com/how-to-use-mongodb-with-laravel/

study Mongodb commands

https://www.tutorialspoint.com/mongodb/mongodb_create_database.htm


No comments:

Post a Comment