How To Install MongoDB on FreeBSD 10.1
One of the most popular databases which is used in web applications now a days is MongoDB which is a free and open-source NoSQL database. With its use the applications boosts up as it provides high performance, pliability, scalability in database schema design. In this blog you will get to know how you will you install and access MongoDB on FreeBSD 10.1.
In order to execute this tutorial , you will need the following:
- You need to have a FreeBSD 10.1 server which can run over SSH
- You will then need a user having access to root privileges; also you need the default freebsd user on DigitalOcean.
- Also you will require SSH key
SSH key is required for smooth and remote access in a FreeBSD Droplet. The SSH key will be added to this user account and the freebsd user will be automatically created. From FreeBSD root password will not be emailed.
Installing the Package Management Tool
You will have to log into your FreeBSD 10.1 Droplet by inserting the command:
$ ssh freebsd@your_server_ip
For managing binary packages FreeBSD uses a tool called pkg. You will have to update the repository catalogue by typing:
$ sudo pkg update -f
After pkg is ready to be used now, you will have to install MongoDB and all its dependencies by inserting the following command:
$ sudo pkg install mongodb
Now you will get prompted to upgrade pkg before you install mongodb. If you are prompted, you will have to press Y. As soon as you are installing MongoDB, it will automatically start after pkg gets updated.
You will be shown a list of packages that are going to be installed and asked to confirm if you want to proceed. Press Y to begin the installation.
Allowing MongoDB to Start Automatically At Boot Time
In order to start MongoDB automatically at boot time, you will have to customize the /etc/rc.conf file. You will have to use sudo because root privileges are an important requirement. If you want to use nano, you will need to install it with the following command:
$ sudo pkg install nano
You will have to log out and log in back in order to get nano to be added to your default path.
Or else , you can also use vi:
$ sudo vi /etc/rc.conf
Now you will have to add the following line at the end of the file in order to allow MongoDB’s primary daemon to get started automatically whenever your FreeBSD server is booting up:
In order to start MongoDB automatically you can reboot your server. If you want to start MongoDB manually you can do it with the use of the service command.
$ sudo service mongod start
Now MongoDB is up and it is running.
You can also add configuration details to /usr/local/etc/mongodb.conf in order to edit MongoDB.
For instance, in order to run on port 9000 instead of port 27017 (the default port),you will have to add the following to mongodb.conf:
net: port: 9000
Every time you try to modify mongodb.conf, you will have to restart MongoDB to enable the changes:
$ sudo service mongod restart.
Verifying the Installation
You will have to communicate to the database with the help of mongo shell:
$ sudo mongo
If you have changed the configuration to run MongoDB on a different port, you will have to run the following instead:
$ sudo mongo --port
If everything falls on the right place, you will get to see the following output:
MongoDB shell version: 2.6.7 connecting to: test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user >
You will also see the following warnings on a 32-bit FreeBSD server:
Server has startup warnings: 2015-05-13T19:01:49.548+0100 [initandlisten] 2015-05-13T19:01:49.548+0100 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary. 2015-05-13T19:01:49.548+0100 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal). 2015-05-13T19:01:49.548+0100 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off. 2015-05-13T19:01:49.548+0100 [initandlisten] ** See http://dochub.mongodb.org/core/32bit 2015-05-13T19:01:49.548+0100 [initandlisten]
Though these warnings can be ignored in a development or test environment, it is recommended that you run production instances of MongoDB only on 64-bit servers.
Through this brief guide you get to know how to use the package management tool in order to install MongoDB on your FreeBSD 10.1 server.
- Android courses
- App Development
- Artificial Intelligence Course
- Cloud Computing Course
- Content Writing
- Crash Course
- Digital Marketing
- Embedded System and Robotics Course
- Ethical Hacking and Cyber Security Course
- How To
- Internet of Things (IoT) Course
- iOS App Development
- iPhone courses
- IT Certification Course
- Machine Learning with Python Course
- Mean stack
- Mern stack
- NET Development
- Networking with Cisco Tools Course
- PHP Variable
- Professional IT course
- Python Course
- React Native
- SAP Development
- Social Media
- Software Testing
- Successful Career
- Tech Industry
- Tech News & Tips
- UI/UX Design Course
- Web Design
- Web Development