Training for the Exam!

1. First I downloaded pwgen to help generate passwords.
sudo apt-get update && sudo apt-get install pwgen

2. Then I installed the LAMP stack
sudo apt-get install apache2 mysql-server

I input a password for the root user of the MySQL database, as per recommendation.

I checked if my version of Ubuntu (16.04) had php, because some versions come prepackaged with it:
which php

This yielded no result, so I then installed php as well:
sudo apt-get install php

After this I checked again with which php and this time it yielded a result.

Screenshot from 2018-03-14 04-05-58
I restarted Apache and then checked to see if it was operational by going to localhost
apacherestart

3. Next I installed the SSH demon
sudo apt-get install ssh

I made sure there’s a firewall rule to allow access through port 22:
sudo ufw allow 22/tcp
sudo ufw enable

Opening a remote connection through Putty to test that SSH works.

4. Time to create some users!

First I generated some passwords
sudo pwgen 20 10
20 character passwords for 10 people, a few extras in case I need them.

I created the users using command:
sudo adduser maime
(3 letters from first name, 2 from surname, example here being Maika Meikäläinen)

Then I created one admin user.
admin_user

5. Next I created some example webpages for all my non-privileged users.
examplepagel

6. Next one of my users wants to practice using LAMP so I made them a database.

I first logged into MySQL as root user:
mysql -u root -p

Then I granted privileges to my user:
GRANT ALL PRIVILEGES ON *.* TO ‘pekhu’@’localhost’ IDENTIFIED BY ‘strongpassword’;

Then I quit using \q and logged in as the user I just gave access to:
mysql -u pekhu -p

I proceeded to create the database:
CREATE DATABASE potaato;

I tried creating a few tables for the database using following examples:
CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20));
CREATE TABLE customers (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, company VARCHAR(20), contact VARCHAR(20), phone VARCHAR(20));

Both of these went through but I could not find the tables with the ‘describe ‘tablename” command.
mysql

7. Next I made a command ‘wowstats’ like so:
alias wowstats=htop

Now I can access information about the computer cpu and and memory usage by typing ‘wowstats’. This will open htop, which I previously installed.
wowstats

Sources:

Linux course by Tero Karvinen

Example Lab assignment

Installing LAMP

Managing MySQL

Creating MySQL Tables

Linux Alias commands

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s