Zipping Epub: Mimetype file should contain only the string "application/epub+zip"

You need to remove the characters \n and \r from the mimetype file using Linux’s tr command as follows:

tr -d '\n' < mimetype   > mimetype.1
tr -d '\r' < mimetype.1 > mimetype.2
rm mimetype mimetype.1 
mv mimetype.2 mimetype

or simply

tr -d '\n\r' < mimetype > mimetype.2
mv mimetype.2 mimetype

And then you will have to add the file mimetype to the ePUB file using the following command:

zip -0Xq book.epub mimetype

Then you need to add remaining files to ePUB files as follows:

zip -Xr9Dq book.epub * -x mimetype -x book.epub 

Then just validate it using the online EPUB Validator and you will get a NO ERROR regarding mimetype.