<\/span><\/h2>\nFlintCMS also requires Node.js.\u00a0 Node.js is an open-source, cross-platform JavaScript run-time environment that will allow you to execute JavaScript code on your server. At the moment of writing this tutorial, the latest LTS version of Node.js is version 10.x.<\/p>\n
NPM stands for Node Package Manager and is the default package manager tool for Node.js.<\/p>\n
To install Node.js and NPM, first, you will need to add the Node.js official repository to the system.<\/p>\n
sudo curl -sL https:\/\/rpm.nodesource.com\/setup_10.x | sudo bash -<\/pre>\nOnce the repository is added, run the following command:<\/p>\n
sudo yum install nodejs<\/pre>\nTo verify the version and if Node.js has been successfully installed, run the following command:<\/p>\n
node --version<\/pre>\nTo verify the NPM installation, run the following:<\/p>\n
npm --version\n<\/pre>\nTo be able compile and install native add-ons from NPM, we also need to install the following build tools:<\/p>\n
sudo yum install gcc-c++ make<\/code><\/pre>\n<\/span>Step 3: Install MongoDB<\/strong><\/span><\/h2>\nThe default CentOS 7 repository does not contain a package for MongoDB, so we will need to use the official MongoDB repository to install MongoDB package.<\/p>\n
At the time of writing this tutorial, the latest stable version of MongoDB is 4.0. Let’s add the MongoDB repository by creating the following file:<\/p>\n
nano \/etc\/yum.repos.d\/mongodb-org-4.0.repo<\/pre>\nThen, add the following lines:<\/p>\n
[mongodb-org-4.0]\nname=MongoDB Repository\nbaseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/4.0\/x86_64\/\ngpgcheck=1\nenabled=1\ngpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-4.0.asc<\/pre>\nYou can now install MongoDB using the following command:<\/p>\n
sudo yum install -y mongodb-org<\/pre>\nEnable the MongoDB service to start automatically on boot:<\/p>\n
sudo systemctl enable mongod<\/pre>\nStart the MongoDB service:<\/p>\n
sudo systemctl start mongod<\/pre>\nFor security reasons, if you are going to allow remote access to your MongoDB server, it is recommended to enable database authorization.<\/p>\n
Open the MongoDB configuration file:<\/p>\n
nano \/etc\/mongod.conf<\/pre>\nAnd add the following:<\/p>\n
security:\n authorization: \"enabled\"<\/pre>\nRestart the MongoDB server for the changes to take effect:<\/p>\n
sudo systemctl restart mongod<\/pre>\n<\/span>Step 4: Create a MongoDB user and database<\/span><\/h2>\nOnce we have our MongoDB server up and running, we will need to create a new user and database for our FlintCMS installation<\/p>\n
First, we need to access and MongoDB shell, by typing the following command:<\/p>\n
mongo<\/pre>\nYou can then create a new database for our FlintCMS by entering the following command in the MongoDB shell:<\/p>\n
> use flint_db<\/span>;<\/pre>\nNext, create a new user, with readWrite<\/code> permissions for this database:<\/p>\n> db.createUser(\n {\n user: \"flint_user<\/span>\",\n pwd: \"PASSWORD<\/span>\",\n roles: [ { role: \"readWrite\", db: \"flint_db\" } ]\n }\n)<\/pre>\nDo not forget to replace PASSWORD\u00a0with your own strong password.<\/span><\/span><\/p>\nAfter you are done, you can exit the MongoDB shell with:<\/p>\n
> quit()<\/pre>\n