-
ssh -i "antonio.pem" [email protected]
-
chmod 600 antonio.pem
-
Live at: ec2-52-59-194-158.eu-central-1.compute.amazonaws.com
-
Accessible SSH port: 2200
-
sudo apt-get update
-
sudo apt-get upgrade
-
This application will look up various pieces of information about an user and display it in an easy to read format
-
sudo apt-get install finger
-
sudo adduser grader
-
Connecting as the New User
ssh -i "antonio.pem" [email protected]
-
Giving sudo access to new user
sudo cp /etc/sudoers.d/90-init-cloud-users /etc/sudoers.d/grader
-
sudo nano /etc/sudoers.d/grader
-
Log into your server as the new user you've just created
-
mkdir .ssh
-
touch .ssh/authorized_keys
-
nano .ssh/authorized_keys
-
Paste the private key content into
.ssh/authorized_keys
in your server with the new user. -
chmod 700 .ssh
-
chmod 644 .ssh/authorized_keys
-
vim /etc/ssh/sshd_config (Change ssh to 2200)
-
service ssh restart
-
Log in using the Key pair:
ssh -i "antonio.pem" [email protected]
-
sudo nano /etc/ssh/sshd_config
and change PasswordAuthentication to no -
Then restart de service by
sudo service ssh restart
-
sudo ufw default deny incoming
-
sudo ufw default allow outgoing
-
sudo ufw allow ssh
-
sudo ufw allow 2222/tcp
-
sudo ufw allow www
-
sudo ufw enable
-
Install Apache HTTP Server
sudo apt-get install apache2
-
Install mod_wsgi
sudo apt-get install libapache2-mod-wsgi
-
sudo apt-get install postgresql postgresql-contrib
-
sudo a2enmod wsgi
-
Then, change directory to
cd /var/www
-
sudo git clone https://github.com/balusus/Item-Catalog.git
-
sudo apt-get install python-pip
sudo pip install virtualenv
sudo virtualenv catalog
source catalog/bin/activate
sudo pip install Flask
sudo pip install -r requirements.txt
-
Then, To deactivate the environment, give the following command:
deactivate
-
Change directory to
cd /etc/apache2/sites-available
-
Create the file catalog.conf:
sudo touch catalog.conf
with this content:<VirtualHost *:80> ServerName ec2-52-59-194-158.eu-central-1.compute.amazonaws.com ServerAdmin [email protected] WSGIScriptAlias / /var/www/Item-Catalog/catalog.wsgi <Directory /var/www/Item-Catalog/> Order allow,deny Allow from all </Directory> Alias /static /var/www/Item-Catalog/static <Directory /var/www/Item-Catalog/static/> Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
-
Enable catalog.conf with this command:
sudo a2ensite catalog
-
Now restart apache2:
sudo service apache2 restart
-
Configure postgres:
sudo su - postgres
- In psql:
CREATE USER grader WITH PASSWORD 'udacity'
ALTER USER grader CREATEDB