22.04 Data Storage
Setup information for Network Attached Storage on a machine running the following hardware:
- Intel Core i3 9100f CPU @ 3.60Ghz x 4
- Hynix 16Gb DDR4 2400mhz
- Intel PRO/1000 PT Quad-Port Server Adapter (39Y6136)
- Gigabyte B365M-DS3H
- SP 9--- 128Gb NVMe M.2
- Seagate Iron Wolf NAS 8Tb 7200RPM
- Seagate Iron Wolf NAS 8Tb 7200RPM
- Seagate Iron Wolf NAS 8Tb 7200RPM
- Seagate Iron Wolf NAS 8Tb 7200RPM
- Seasonic Focus PX-550
- Silverstone SG11
SSH - Server
$ sudo apt install openssh-server
Hosts
$ sudo nano /etc/hosts
127.0.0.1 localhost
192.168.0.1 hitron.home
192.168.0.2 access.home
192.168.0.5 network.home
192.168.0.29 data.wifi
192.168.0.30 onyx.wifi
192.168.0.31 atom.wifi
192.168.0.130 work.home
192.168.0.131 game.home
192.168.0.132 media.home
192.168.0.200 webserver.home
192.168.0.201 phpmyadmin.home
192.168.0.202 nextcloud.home
192.168.0.203 network0.home
192.168.0.204 network1.home
192.168.0.205 network2.home
192.168.0.206 network3.home
192.168.0.207 network4.home
192.168.0.208 network5.home
192.168.0.209 network6.home
192.168.1.210 berladyn.home
192.168.1.211 assets.berladyn.home
192.168.1.212 api.berladyn.home
192.168.1.213 stats.berladyn.home
192.168.1.214 dev.berladyn.home
192.168.1.215 his.berladyn.home
192.168.1.216 dan.berladyn.home
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Netplan - Network Configuration
$ sudo nano /etc/netplan/01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
wifis:
wlp15s0:
dhcp4: true
dhcp6: true
access-points:
"****-******":
password: "**********"
ethernets:
eth0:
match:
macaddress: **:**:**:**:**:**
dhcp4: true
dhcp6: true
set-name: eth0
enp6s0f0:
dhcp4: false
dhcp6: false
enp6s0f1:
dhcp4: false
dhcp6: false
enp7s0f0:
dhcp4: false
dhcp6: false
enp7s0f1:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [enp6s0f0, enp6s0f1, enp7s0f0, enp7s0f1]
dhcp4: false
dhcp6: false
addresses:
- 192.168.0.5/24
- 192.168.0.129/24
- 192.168.0.200/24
- 192.168.0.201/24
- 192.168.0.202/24
- 192.168.0.203/24
- 192.168.0.204/24
- 192.168.0.205/24
- 192.168.0.206/24
- 192.168.0.207/24
- 192.168.0.208/24
- 192.168.0.209/24
- 192.168.0.210/24
- 192.168.0.211/24
- 192.168.0.212/24
- 192.168.0.213/24
- 192.168.0.214/24
- 192.168.0.215/24
- 192.168.0.216/24
- 192.168.0.217/24
- 192.168.0.218/24
- 192.168.0.219/24
- 192.168.0.220/24
routes:
- to: default
via: 192.168.0.1
mtu: 1500
nameservers:
addresses:
- 192.168.0.1
- 192.168.0.5
parameters:
stp: true
forward-delay: 4
$ sudo netplan apply
Disks
Identify and Format Disks.
sudo fdisk -l
$ sudo wipefs -a /dev/sdb
$ sudo wipefs -a /dev/sdc
ZFS - File System
$ sudo apt update
$ sudo apt install zfsutils-linux
$ zfs --version
Remove 'srv' folder from ssd, replace with mirrored tank.
$ sudo rm -R /srv
$ sudo zpool create srv mirror /dev/sdb /dev/sdc
Check the pool creation.
$ zpool status
$ zpool list
Samba - Server
$ sudo apt install samba
$ sudo nano /etc/samba/smb.conf
[smb]
comment = Samba File Server Share
path = /srv/smb
browsable = yes
guest ok = yes
read only = no
create mask = 0755
[www]
comment = HTML File Server Share
path = /srv/www
browsable = yes
guest ok = yes
read only = no
create mask = 0755
[berladyn]
comment = HTML File Server Share
path = /home/berladyn
browsable = yes
guest ok = yes
read only = no
create mask = 0777
$ sudo systemctl restart smbd.service nmbd.service
Apache - Webserver
$ sudo apt update
$ sudo apt install apache2
Set the directives.
$ sudo nano /etc/apache2/apache2.conf
<Directory /srv/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /home/berladyn/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
$ sudo systemctl restart apache2
Create 'webmaster' usergroup and add user for file access.
$ sudo addgroup webmaster
$ sudo usermod -a -G webmaster dan
# Log out and back in for the Group change to take effect.
Create 'webserver' generic webhost.
$ sudo mkdir /srv/www/webserver
$ sudo chgrp -R webmaster /srv/www/webserver.home
$ sudo chown -R dan:webmaster /srv/www/webserver.home
Configure 'webserver' virtualhost.
$ sudo nano /etc/apache2/sites-available/webserver.conf
<VirtualHost 192.168.1.200:80>
ServerName www.webserver.home
ServerName webserver.home
ServerAdmin webmaster@webserver.home
DocumentRoot /srv/www/webserver.home/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost 192.168.1.210:80>
ServerName www.berladyn.home
ServerName berladyn.home
ServerAdmin webmaster@berladyn.home
DocumentRoot /home/berladyn/public_html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ sudo a2ensite webserver.conf
$ sudo systemctl restart apache2
MariaDB
$ sudo apt update
$ sudo apt install mariadb-server
Configure 'root' account.
$ sudo mysql_secure_installation
PHP - Scripting Language
$ sudo apt install php8.1
$ php -v
$ sudo apt install php8.1-bcmath php8.1-cli php7.4-common php8.1-curl php8.1-dev php8.1-gd php8.1-gmp php8.1-imagick php8.1-imap php8.1-intl php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-redis php8.1-soap php8.1-xml php8.1-xmlrpc php8.1-zip
$ php -m
$ sudo nano /etc/php/8.1/apache2/php.ini
output_buffering = disabled
realpath_cache_size = 8192k
memory_limit = 2048M
upload_max_filesize = 8M
extension = mysqli
date.timezone = UTC
$ sudo systemctl restart apache2
myPhpAdmin - Database Managment
$ sudo mysql -uroot
mysql> CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'New-Password-Here';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ sudo mkdir /srv/www/phpMyAdmin/tmp
$ sudo chgrp -R www-data /srv/www/phpmyadmin/tmp/
$ sudo chmod -R g+w /srv/www/phpmyadmin/tmp
$ sudo cp -r /home/dan/Desktop/phpMyAdmin /srv/www/phpmyadmin
$ sudo nano /srv/www/phpMyAdmin/config.sample.inc.php
# Add a secret passphrase (blowfish_secret), save as config.inc.php
$ sudo nano /etc/apache2/sites-available/phpmyadmin.conf
<VirtualHost 192.168.1.201:80>
ServerName www.phpmyadmin.home
ServerName phpmyadmin.home
ServerAdmin webmaster@phpmyadmin.home
DocumentRoot /srv/www/phpmyadmin.home/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ sudo a2ensite phpmyadmin.conf
$ sudo systemctl restart apache2