Error installing mongodb on Amazon Linux - 'File contains no section headers'

989 views
Skip to first unread message

Meta Zone

unread,
Apr 14, 2016, 4:35:39 PM4/14/16
to mongodb-user
I have an EC2 Instance on Amazon cloud running & am trying to install mongodb on it.  I followed the instructions at https://docs.mongodb.org/v3.0/tutorial/install-mongodb-on-amazon/

After creating /etc/yum.repos.d/mongodb-org-3.0.repo, I run: sudo yum install -y mongodb-org

I get the following results:

Loaded plugins: priorities, update-motd, upgrade-helper


File contains no section headers.
file
: file:///etc/yum.repos.d/mongodb-org-3.0.repo, line: 1
'name=MongoDB Repository\n'


My /etc/yum.repos.d/mongodb-org-3.0.repo is :
name=MongoDB Repository
baseurl
=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.0/x86_64/
gpgcheck
=0
enabled
=1


od -c  /etc/yum.repos.d/mongodb-org-3.0.repo shows the following:

0000000   n   a   m   e   =   M   o   n   g   o   D   B       R   e   p
0000020   o   s   i   t   o   r   y  \n   b   a   s   e   u   r   l   =
0000040   h   t   t   p   s   :   /   /   r   e   p   o   .   m   o   n
0000060   g   o   d   b   .   o   r   g   /   y   u   m   /   a   m   a
0000100   z   o   n   /   2   0   1   3   .   0   3   /   m   o   n   g
0000120   o   d   b   -   o   r   g   /   3   .   0   /   x   8   6   _
0000140   6   4   /  \n   g   p   g   c   h   e   c   k   =   0  \n   e
0000160   n   a   b   l   e   d   =   1  \n
0000171

Of course, when I run: sudo service mongod start  I get: mongod: unrecognized service

Any help/idea?

Bill

Meta Zone

unread,
Apr 14, 2016, 5:20:25 PM4/14/16
to mongodb-user
Follow instructions at https://docs.mongodb.org/manual/tutorial/install-mongodb-enterprise-on-amazon/ worked;; there are other instructions that don't work.

Just to make sure, here's the summary of steps (without explanation / annotation):

1. My Amazon EC2 instance (I snipped out the info): uname -a
Linux ip-<snip>.amzn1.x86_64 #1 SMP <snip> x86_64 x86_64 x86_64 GNU/Linux

2. Create /etc/yum.repos.d/mongodb-enterprise.repo with following contents (I created file in my home folder and did: sudo cp mongodb-enterprise.repo /etc/yum.repos.d):
[mongodb-enterprise]
name
=MongoDB Enterprise Repository
baseurl
=https://repo.mongodb.com/yum/amazon/2013.03/mongodb-enterprise/stable/$basearch/
gpgcheck
=1
enabled
=1
gpgkey
=https://www.mongodb.org/static/pgp/server-3.2.asc

3. Run yum to install it:
sudo yum install -y mongodb-enterprise

4. Install other packages:
sudo yum install cyrus-sasl cyrus-sasl-plain cyrus-sasl-gssapi krb5-libs lm_sensors-libs net-snmp-agent-libs net-snmp openssl rpm-libs tcp_wrappers-libs

DONE INSTALLING

Then make sure you can start it and do a simple sanity check with the interactive shell:

Ai. Start it:
sudo service mongod start

Aii. Wait until you see the log file show 'waiting for connections on port:
sudo tail -f /var/log/mongodb/mongod.log

B. Start the interactive shell:
/usr/bin/mongo

C. Create a database using the interactive shell:
MongoDB Enterprise > use mytestdb

Wan Bachtiar

unread,
Apr 14, 2016, 10:49:02 PM4/14/16
to mongodb-user

File contains no section headers.
file: file:///etc/yum.repos.d/mongodb-org-3.0.repo, line: 1

‘name=MongoDB Repository\n’

Hi Bill,

The error message is caused by a lack of header information in the repo file. Note that the instructions on Install MongoDB on Amazon is listing [mongodb-org-3.0] as the first line, which is missing from your repo file content.

The full content of the repo file for MongoDB v3.0.x should be:

[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1

For general enhancements and bug fixes I would recommend to use the latest stable release of MongoDB, currently is v3.2. See also:

Follow instructions at https://docs.mongodb.org/manual/tutorial/install-mongodb-enterprise-on-amazon/ worked;; there are other instructions that don’t work.

Note that the MongoDB Enterprise edition is a commercially supported product. If your company has a commercial subscription and would like some assistance in installation I would suggest to open a case in the Commercial Support Project in MongoDB Jira.

Alternatively if you are evaluating MongoDB Enterprise and is interested, feel free to send me a private message of your contact details and I can request a MongoDB Account Executive to reach out to you.

Kind regards,

Wan.

Reply all
Reply to author
Forward
0 new messages