0% found this document useful (0 votes)
65 views2 pages

AWS EC2 - Full Config

This document provides instructions for installing and configuring MongoDB and Apache2/Webmin on a server. It includes steps to: 1) Update and upgrade packages, set the hostname, and install MongoDB from its official repository. 2) Create an admin user for MongoDB, configure authentication and bind IP in mongod.conf, restart mongod, and enable free monitoring. 3) Install Apache2 and Webmin, configure Apache as a reverse proxy for Webmin, disable SSL in Webmin, restrict Webmin referers, and restart services. 4) Install Certbot and obtain an SSL certificate for the server domain.

Uploaded by

catalin pirnog
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views2 pages

AWS EC2 - Full Config

This document provides instructions for installing and configuring MongoDB and Apache2/Webmin on a server. It includes steps to: 1) Update and upgrade packages, set the hostname, and install MongoDB from its official repository. 2) Create an admin user for MongoDB, configure authentication and bind IP in mongod.conf, restart mongod, and enable free monitoring. 3) Install Apache2 and Webmin, configure Apache as a reverse proxy for Webmin, disable SSL in Webmin, restrict Webmin referers, and restart services. 4) Install Certbot and obtain an SSL certificate for the server domain.

Uploaded by

catalin pirnog
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

sudo apt update

sudo apt upgrade


sudo hostnamectl set-hostname
sudo passwd root

###### Install MongoDB ######


wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-
org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
sudo systemctl start mongod
####################
mongo
use admin
db.createUser({user:"username", pwd:"password!", roles:[{role:"root",
db:"admin"}]})
exit
sudo vim /lib/systemd/system/mongod.service

================================================================
##On the 'ExecStart' line 9, add the new option '--auth'.
ExecStart=/usr/bin/mongod --auth --config /etc/mongod.conf
================================================================

sudo vim /etc/mongod.conf

=======================================
# network interfaces
net:
port: 26016
bindIp: 0.0.0.0

security:
authorization: 'enabled'
=======================================
sudo systemctl daemon-reload
sudo service mongod restart
sudo systemctl status mongod
sudo systemctl enable mongod.service
sudo systemctl status mongod
mongo --port 26016 --authenticationDatabase "admin" -u username -p
db.enableFreeMonitoring()
db.enableFreeMonitoring({"userReminder": "username"})
copy the URL link
exit

###### Install Apache2 & Webmin ######


sudo apt update
sudo apt install apache2
sudo vim /etc/apt/sources.list
=======================================
deb http://download.webmin.com/download/repository sarge contrib [add this to the
bottom of the file]
=======================================
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
sudo apt update
sudo apt install webmin
sudo vim /etc/apache2/sites-available/......conf
=======================================
<VirtualHost *:80>
ServerAdmin your_email
ServerName your_domain
ProxyPass / http://localhost:10000/
ProxyPassReverse / http://localhost:10000/
</VirtualHost>
=======================================
sudo vim /etc/webmin/miniserv.conf
=======================================
ssl=0 [change from 1 to 0]
=======================================
sudo vim /etc/webmin/config
=======================================
referers=your_domain [add this to the bottom of the file]
=======================================
sudo systemctl restart webmin
sudo a2enmod proxy_http
sudo a2ensite ....conf
sudo systemctl restart apache2
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python3-certbot-apache
sudo certbot --apache --email [email protected] -d admin.username.com --agree-tos
--redirect --noninteractive
sudo reboot

You might also like