Giter VIP home page Giter VIP logo

linux-server-configuration's Introduction

Linux-Server-Configuration

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

  • 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

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

  • 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

  • Modify the vagrant text with grader

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" [email protected]

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 [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

References

linux-server-configuration's People

Contributors

antoniogagos avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.