enable replicaSet in mongoDB yaml conf file I want to enable oplog on mongoDB and the recommended approach is to setup a standalone replica set. I tried following the instructions here...

https://docs.mongodb.com/manual/reference/configuration-options/#replication-options

...and added the following to /etc/mongod.conf

replication:
   oplogSizeMB: 1024
   replSetName: rs0


After restarting I tried initialising and checking the the status but see the following...

&gt; rs.initiate()
{
        "ok" : 0,
        "errmsg" : "This node was not started with the replSet option",
        "code" : 76,
        "codeName" : "NoReplicationEnabled"
}

&gt; rs.conf()
2017-08-11T18:08:51.336+0900 E QUERY    [thread1] Error: Could not retrieve replica set config: {
        "ok" : 0,
        "errmsg" : "not running with --replSet",
        "code" : 76,
        "codeName" : "NoReplicationEnabled"
} 


The error states run with the --repSet option, but if I try the following the error still appears

sudo /usr/bin/mongod --config /etc/mongod.conf --replSet rs0


Update 
The config is being passed in

2017-08-13T21:19:03.708+0900 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=63900M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-08-13T21:19:05.688+0900 I CONTROL  [initandlisten] 
2017-08-13T21:19:05.689+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-08-13T21:19:05.689+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-08-13T21:19:05.689+0900 I CONTROL  [initandlisten] 
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] 
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] 
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] 
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-08-13T21:19:05.690+0900 I CONTROL  [initandlisten] 
2017-08-13T21:19:05.912+0900 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2017-08-13T21:19:05.915+0900 I REPL     [initandlisten] Did not find local voted for document at startup.
2017-08-13T21:19:05.915+0900 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2017-08-13T21:19:05.916+0900 I NETWORK  [thread1] waiting for connections on port 27117
Check your mongod.log file, there should be line what lists all configuration items from you /etc/mongod.conf

2017-08-12T12:44:23.999+0300 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { port: 27017 }, replication: { oplogSizeMB: 1024, replSetName: "rs0" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }


if you cannot see replication: { oplogSizeMB: 1024, replSetName: "rs0" } then it has NOT readed your current config file.

You can see what file it has readed when you look to start of that line config: "/etc/mongod.conf"

And remember, if your mongod is not running on standard 27017 port, you must adjust your commands to use the right port. Command rs.initiate() (without parameter), don't work if the port is something else than the default.

Update
If connecting to a specific port ensure you define it when using the client mongo --port 27117. For some reason the rs.initiate() command checks for a custom port based on the command line parameter and not what is defined in /etc/mongod.cof