Skip to content

antoniogagos/Linux-Server-Configuration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

Linux-Server-Configuration

1.- Download RSA Key, restrict key access, and ssh into instance:

Installing & updating software

 Updating and Upgrading Available Package List

  • sudo apt-get update

  • sudo apt-get upgrade

Installing finger

  • 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

Creating a new user

Give SSH access to the new User

  • 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" grader@ec2-52-59-194-158.eu-central-1.compute.amazonaws.com

Forcing Key Based Authentication

  • sudo nano /etc/ssh/sshd_config and change PasswordAuthentication to no

  • Then restart de service by sudo service ssh restart

Configuring Ports in UFW

  • 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

Web Application server

  • 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 antoniogagos@gmail.com
         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

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published