modify the file /etc/ssh/sshd_config to the following
PasswordAuthentication no
then I restarted the machine
$> sudo service ssh restarton my client machine, I copied the rsa key to my remote machine
$> ssh-copy-id -i /path_top_RSA/id_rsa.pub grader@52.24.130.27
$> eval "$(ssh-agent -s)"
$> ssh-add
$> ssh -p 2200 grader@52.24.130.27the passoword is grader/9,
on your terminal type
$> sudo adduser grader
$> sudo adduser grader sudo
$> su - grader$> sudo apt-get update
$> sudo apt-get upgrade
$> sudo apt-get dist-upgrade
$> sudo unattended-upgrade
$> sudo apt-get install unattended-upgradesto configure Automatic Updates for unattended-upgrades, edit file /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Allowed-Origins {
"Ubuntu trusty-security";
// "Ubuntu trusty-updates";
}; $> sudo vi /etc/ssh/sshd_configchange this line
# What ports, IPs and protocols we listen for
Port 22to
# What ports, IPs and protocols we listen for
Port 2200also put the permitrootlogin to no
PermitRootLogin no $> sudo ufw allow 2200/tcp
$> sudo ufw allow 80/tcp
$> sudo ufw allow 123/tcp
$> sudo ufw enable
$> sudo service ssh restart##Install and configure Apache to serve a Python mod_wsgi application
$> sudo apt-get install apache2
$> sudo apt-get install libapache2-mod-wsgi python-dev
$> sudo a2enmod wsgi#Install and configure PostgreSQL:
$> sudo apt-get install postgresql postgresql-contrib
$> sudo -i -u postgres
$> createuser catalog --interactivedo not allow the user any priviledges
$> vi /etc/postgresql/9.3/main/pg_hba.confand remove any remote connection from the file
$> cd /var/www
$> sudo mkdir FlaskApp
$> cd FlaskApp/
$> sudo apt-get install git
$> sudo git clone https://github.com/Idresign/Catalog-app.git
$> sudo mv Catalog-app FlaskApp
$> cd FlaskApp/
$> sudo mv project.py __init__.py
$> sudo nano __init__.py remove
debug = true $> sudo apt-get install python-pip
$> sudo pip install virtualenv
$> sudo virtualenv venv
$> source venv/bin/activate
$> sudo pip install Flask
$> sudo pip install sqlalchemy
$> sudo pip install requests
$> sudo pip install oauth2clientfollow the instruction in the readme of the git to get a client_secrets.json file for the project.
Check if everything is fine.
$> sudo python __init__.py $> sudo deactivate $> sudo nano /etc/apache2/sites-available/FlaskApp.confAdd the following
<VirtualHost *:80>
ServerName 52.24.130.27
ServerAdmin admin@52.24.130.27
WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
<Directory /var/www/FlaskApp/FlaskApp/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/FlaskApp/FlaskApp/static
<Directory /var/www/FlaskApp/FlaskApp/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$> sudo a2ensite FlaskApp
$> cd ..
$> sudo nano flaskapp.wsgiAdd the following
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskApp/")
from FlaskApp import app as application
application.secret_key = 'Add your secret key' $> sudo service apache2 restart###this is the ip of the project 52.24.130.27