Sunday, January 14, 2018

Fresh Install part 2

Part # 1 is here
Create a Ubuntu VM for PiHole

I run two DNS and DHCP servers each running Pihole [1] One is on a old crappy laptop that had a broken screen that I removed and it has serious overheating problem and the other is a VM I am going to rebuild the VM again.

I am going to SSH into the VM and create a new user called "pi11" and delete the user called "test" and then give it a static IP of 192.168.200.10

Set a Static IP

sudo nano /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# auto ens33
# iface ens33 inet dhcp


auto ens33
iface ens33 inet static
        address 192.168.200.11
        netmask 255.255.255.0
        gateway 192.168.200.1
dns-nameservers 192.168.200.10

I'm in no rush so I just reboot
sudo reboot

Is it working

pi11@pi11:~$ ping google.com
PING google.com (172.217.12.174) 56(84) bytes of data.
64 bytes from lga25s62-in-f14.1e100.net (172.217.12.174): icmp_seq=1 ttl=52 time=123 ms
64 bytes from lga25s62-in-f14.1e100.net (172.217.12.174): icmp_seq=2 ttl=52 time=122 ms
64 bytes from lga25s62-in-f14.1e100.net (172.217.12.174): icmp_seq=3 ttl=52 time=124 ms
64 bytes from lga25s62-in-f14.1e100.net (172.217.12.174): icmp_seq=4 ttl=52 time=122 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3009ms
rtt min/avg/max/mdev = 122.148/123.235/124.974/1.078 ms

pi11@pi11:~$ nslookup example.com
Server:         192.168.200.10
Address:        192.168.200.10#53

Non-authoritative answer:
Name:   example.com
Address: 93.184.216.34


Create new user

adduser pi11    # Change username to new user name

Follow the prompts, add password and if you wan, Some fields can left blank

Use the usermod command to add the user to the sudo group.
usermod -aG sudo pi11

Let's see if it worked by logging on to the new account
su - pi11

I Would test if sudo is working properly before proceeding

Delete old user

I am doing this while I'm still in the pi11 user

This command deletes the user and the home folder for it.
sudo deluser --remove-home test

If you do not want to delete the users folder use this command
(deluser test)

Edit the samba config file for the new user

It's still on the old user who does not exist anymore.

sudo nano /etc/samba/smb.conf
[Home_pi11]    #  I add this so I don't get confused with my other Pihole, It's just a display name call it whatever.
   path = /home/pi11
   force group = users
   create mask = 0660
   directory mask = 0771
   browsable =yes
   writable = yes
   guest ok = yes


Change the permissions in terminal
sudo chown -R root:users /home/pi11

sudo chmod -R ug+rwx,o+rx-w /home/pi11

Restart the samba service and test it after on another machine
sudo systemctl restart smbd.service
sudo systemctl restart nmbd.service

I reboot the computer to see if it still works
sudo reboot

Change computer host name

sudo nano /etc/hostname

Delete current hostname and add pi11
pi11

Add the hostname to the hosts file
sudo nano /etc/hosts
127.0.0.1       localhost
127.0.1.1       pi11

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


Reboot the VM
sudo reboot


Finally ready to install Pihole

At the time of this writing (Jan 2018) The easiest way to install Pihole is:
curl -sSL https://install.pi-hole.net | bash


I made a video of the install.






The commands I used during the video

To get the big list
wget -qO - https://v.firebog.net/hosts/lists.php?type=tick | sudo tee -a /etc/pihole/adlists.list

To update the new list
pihole -g

The URL I used to open Pihole in my browser


Sources
[1]
[2]

No comments:

Post a Comment