Monday 30 November 2020

Grafana

Did not go for Enterprise, went for open source

From: https://grafana.com/grafana/download?edition=oss

Config: https://community.grafana.com/t/grafana-and-apache/5508

Helpful, basic proxy
https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-ubuntu-16-04 sudo apt-get install -y adduser libfontconfig1 wget https://dl.grafana.com/oss/release/grafana_7.3.4_amd64.deb sudo dpkg -i grafana_7.3.4_amd64.deb # To start the service and verify that the service has started: sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl status grafana-server # Configure the Grafana server to start at boot: sudo systemctl enable grafana-server.service Install output # sudo apt-get install -y adduser libfontconfig1 Reading package lists... Done Building dependency tree Reading state information... Done adduser is already the newest version (3.118ubuntu2). adduser set to manually installed. libfontconfig1 is already the newest version (2.13.1-2ubuntu3). libfontconfig1 set to manually installed. 0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade. # wget https://dl.grafana.com/oss/release/grafana_7.3.4_amd64.deb --2020-12-01 01:01:22-- https://dl.grafana.com/oss/release/grafana_7.3.4_amd64.deb Resolving dl.grafana.com (dl.grafana.com)... 151.101.18.217, 2a04:4e42:4::729 Connecting to dl.grafana.com (dl.grafana.com)|151.101.18.217|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 54013792 (52M) [application/x-debian-package] Saving to: ‘grafana_7.3.4_amd64.deb’ grafana_7.3.4_amd64.deb 100%[=======================================================================================================>] 51.51M 1.84MB/s in 28s 2020-12-01 01:01:51 (1.84 MB/s) - ‘grafana_7.3.4_amd64.deb’ saved [54013792/54013792] # sudo dpkg -i grafana_7.3.4_amd64.deb Selecting previously unselected package grafana. (Reading database ... 168816 files and directories currently installed.) Preparing to unpack grafana_7.3.4_amd64.deb ... Unpacking grafana (7.3.4) ... Setting up grafana (7.3.4) ... Adding system user `grafana' (UID 128) ... Adding new user `grafana' (UID 128) with group `grafana' ... Not creating home directory `/usr/share/grafana'. ### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable grafana-server ### You can start grafana-server by executing sudo /bin/systemctl start grafana-server Processing triggers for systemd (245.4-4ubuntu3.3) ...

Hardening ubuntu Server for internet

Disable Root Logins Over SSH

$ sudo vi /etc/ssh/sshd_config

Make sure PermitRootLogin is changed from yes to no

PermitRootLogin no

Install fail2ban

Fail2ban is an intrusion-prevention system that monitors log files and searches for particular patterns that correspond to a failed login attempt. If a certain number of failed logins are detected from a specific IP address (within a specified amount of time), fail2ban blocks access from that IP address.

sudo apt-get install fail2ban sudo vi /etc/fail2ban/jail.local 

Add following in the new file

[sshd] enabled = true port = 22 filter = sshd logpath = /var/log/auth.log maxretry = 3 Run sudo systemctl restart fail2ban

Sunday 29 November 2020

Ubuntu and lamp

sudo apt install apache2 libapache2-mod-fcgid sudo apt-get install mysql-server sudo apt-get install php libapache2-mod-php php-mysql sudo vi /etc/apache2/mods-enabled/dir.conf

Make index.php 1st item, from from end. and save exit.


sudo systemctl restart apache2 sudo apt-get install php-cli sudo systemctl restart apache2

Allow ssh

1. First update OS # Fetches the list of available updates sudo apt update # Installs some updates; does not remove packages sudo apt upgrade # Removes any old packages that are no longer needed sudo apt autoremove

2. Install ssh sudo apt install openssh-server sudo systemctl status ssh 3. Update Firewall sudo ufw allow ssh

Firewall

$ sudo ufw status Status: inactive $ sudo ufw enable Firewall is active and enabled on system startup $ sudo ufw status Status: active $ sudo ufw allow 80 $ sudo ufw allow 443 $ sudo ufw disable Firewall stopped and disabled on system startup Restart with above command sudo ufw status verbose Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) New profiles: skip To Action From -- ------ ---- 22/tcp ALLOW IN Anywhere 80 ALLOW IN Anywhere 443 ALLOW IN Anywhere 22/tcp (v6) ALLOW IN Anywhere (v6) 80 (v6) ALLOW IN Anywhere (v6) 443 (v6) ALLOW IN Anywhere (v6)


SSH commands


SSH service by running:

$ sudo systemctl stop ssh

To start it again run:

$ sudo systemctl start ssh

To disable the SSH service to start during system boot run:

$ sudo systemctl disable ssh br />
To enable it again type:

$ sudo systemctl enable ssh



Saturday 28 November 2020

Shrink Windows 10 disk to install Linux as dual boot

This note is for you:
  • Not able to Shrink Windows partition that has been 100% used

  • Defrag is not working and not able to shrink C drive

  • Have lots of free disk but shink only offering small amount

I had 150 GB hard disk. Single C drive and disk was near 100% used up. After clearning freed 80GB, i wante to install Linux on 70GB. So first had to shrink but Windows shrink only allowed my to string 150GB by 2 GB, which is no where near the 70GB i wanted. So did defrag, still only allowed my shrink to 2gb, since system files were scartered all over the disk. So searching, found in asnwers.microsoft.com forume an solution and that worked for me. That is. 

  1. Download 'AOMEI Partition Assistant' Freeware 
    1. I have downloaded from diskpart.com/download.html
    2. I have selected Freeware Version 9.0 (file FAssist_Std.exe)
  2. Install AOMEI Partition Assistant. It goes on installs mini os like software to go in shrink, as you using host 
  3. Use the shrink option, if you try to do split option you have purchase the full version of software. 
  4. Once you have shrunk your disk
  5. Restart your machine and you will see the unalloacted disk and original disk shrunk. 

 

I have installed Ubunto and new unallocated and and kept my Windows side by side, everything working like a treat.

 

Thanks You "AOMEI Partition Assistant"