PersNAS
D:\Backup\PersNAS.txt should be kept in sync with dokuwiki
mdadm and Disks
https://www.digitalocean.com/community/tutorials/how-to-create-raid-arrays-with-mdadm-on-ubuntu-16-04
dnf install mdadm -y
dnf install bc -y # only for initial setup
dnf install wget -y
### wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
### rpm -Uvh epel-release-latest-7.noarch.rpm
??? yum install gparted -y
??? yum install gdisk -y
New md Array
mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda /dev/sdb /dev/sdc
cat /proc/mdstat
mkdir /nas
mkfs.ext4 -F /dev/md0
Existing md Array
In case the array is not already found:
mdadm --examine --scan
mdadm --assemble --scan
mount -t ext4 /dev/md0 /nas/
mount /dev/md0 /nas/
SmartCtl
dnf install smartmontools
Samba and Shares
dnf install samba samba-client samba-common -y
groupadd NetUsers
groupadd NetAdmins
useradd chris -G NetAdmins
or
usermod chris -a -G NetAdmins
smbpasswd -a chris
mkdir -p /nas/samba_disks # initial only
chmod -R 0755 /nas/samba_disks # initial only
chown -R nobody:nobody /nas/samba_disks # initial only
chcon -t samba_share_t /nas/samba_disks/*
setsebool -P samba_export_all_ro=1 samba_export_all_rw=1
systemctl enable smb.service
systemctl enable nmb.service
systemctl restart smb.service
systemctl restart nmb.service
testparm
firewall-cmd --permanent --zone=public --add-service=samba
firewall-cmd --reload
vi /etc/samba/smb.conf
[global]
workgroup = IANCULOVICI
server string = Personal NAS (Samba Server Version %v)
netbios name = PersNAS
security = user
map to guest = bad user
dns proxy = no
[Data]
path = /nas/samba_disks/Data
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
[Docs]
path = /nas/samba_disks/Docs
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
[Music]
path = /nas/samba_disks/Music
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
[Photos & Videos]
path = /nas/samba_disks/Photos_Videos
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
[Restore]
path = /nas/samba_disks/Restore
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
[Share]
path = /nas/samba_disks/Share
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
[Work]
path = /nas/samba_disks/Work
valid users = @NetAdmins
guest ok = no
writable = yes
browsable = yes
/etc/group
...
NetUsers:x:1000:
NetAdmins:x:1001:chris
chris:x:1002:
NFS Client/Server
Server
dnf install nfs-utils -y
systemctl enable nfs-server
systemctl start nfs-server
vi /etc/exports
/nas/samba_disks/ 172.22.0.10(rw,sync,no_root_squash,no_all_squash)
/nas/samba_disks/ 172.22.0.12(rw,sync,no_root_squash,no_all_squash)
exportfs -arv
firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --reload
Client
dnf install nfs-utils nfs4-acl-tools
showmount -e 172.22.0.11
mount -t nfs 172.22.0.11:/nas/samba_disks /something
echo "172.22.0.11:/nas/samba_disks /something nfs defaults 0 0">>/etc/fstab
99 systemctl enable rpcbind
101 systemctl enable nfs-lock
102 systemctl enable nfs-idmap
103 systemctl start rpcbind
105 systemctl start nfs-lock
106 systemctl start nfs-idmap
systemctl restart nfs-server
DLNA
http://blog.irq1.com/install-minidlna-centos/
tar xzvf minidlna-1.1.4_static.tar.gz
mv etc/minidlna.conf /etc/
mv ./usr/sbin/minidlnad /usr/sbin/
mv usr/share/locale/it/LC_MESSAGES/minidlna.mo /usr/share/locale/it/LC_MESSAGES
vi /etc/minidlna.conf
vi /etc/init.d/minidlna
systemctl restart minidlna
systemctl status minidlna
systemctl enable minidlna
systemctl stop minidlna
chkconfig minidlna on
firewall-cmd --reload
systemctl restart minidlna
yum install lm_sensors -y
yum install lsof -y
Docker: https://hub.docker.com/r/vladgh/minidlna
firewall-cmd --permanent --new-service minidlna
firewall-cmd --permanent --service minidlna --add-port 8200/tcp
firewall-cmd --permanent --service minidlna --add-port 1900/udp
firewall-cmd --permanent --add-service minidlna
firewall-cmd --reload
firewall-cmd --list-services
Backup for NAS
LDAP
yum install openldap openldap-servers openldap-clients -y
mkdir /nas/app/ldap/db
chcon -R -t slapd_db_t /nas/app/ldap/db
cp /usr/share/openldap-servers/DB_CONFIG.example /nas/app/ldap/db/DB_CONFIG
chown -R ldap. /nas/app/ldap/db
systemctl restart slapd
systemctl status slapd.service
vi init.ldif
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}L9Fa9o8mZMeMtmyUupBvA7zcJFkftjWS
dn: olcDatabase={2}hdb,cn=config
changetype: modify
add: olcRootPW
olcRootPW: {SSHA}L9Fa9o8mZMeMtmyUupBvA7zcJFkftjWS
- ``` replace: olcRootDN olcRootDN: cn=Manager,dc=ianculovici,dc=com
1. ```
replace: olcSuffix
olcSuffix: dc=ianculovici,dc=com
- ``` replace: olcDbDirectory olcDbDirectory: /nas/app/ldap/db
ldapmodify -a -Q -Y EXTERNAL -H ldapi:/// -f init.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/misc.ldif ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/nis.ldif ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/openldap.ldif
vi org.lfif
dn: dc=ianculovici,dc=com objectClass: dcObject objectClass: organization dc: ianculovici o: Ianculovici description: Ianculovici
dn: cn=Manager,dc=ianculovici,dc=com objectClass: organizationalRole cn: Manager description: Directory Manager
ldapadd -D "cn=Manager,dc=ianculovici,dc=com" -W -f org.ldif
firewall-cmd --permanent --add-service=ldap firewall-cmd --reload
## nginx
---------------
dnf install nginx systemctl enable nginx systemctl start nginx
firewall-cmd --permanent --add-service=http firewall-cmd --reload
dnf -y install php php-fpm
### php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-magickwand php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy
systemctl start php-fpm systemctl enable php-fpm
firewall-cmd --permanent --zone=public --add-port=8080/tcp
SE Linux permissions:
setsebool -P httpd_can_network_connect 1
Run
/nas/app/nginx/setup.sh
## Set BOOT default for another kernel
----------------------------------------
grub2-set-default 'CentOS Linux (3.10.0-229.20.1.el7.x86_64) 7 (Core)' grub2-editenv list
## Docker
https://phoenixnap.com/kb/how-to-install-docker-on-centos-8
https://www.techrepublic.com/article/a-better-way-to-install-docker-on-centos-8/
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.10-3.2.el7.x86_64.rpm dnf install docker-ce -y systemctl enable --now docker usermod -aG docker chris
https://www.howtoforge.com/install-and-use-docker-compose-on-centos-8/
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
## VMWare Player
wget "https://download3.vmware.com/software/player/file/VMware-Player-16.1.1-17801498.x86_64.bundle" dnf install gcc kernel-devel libaio pcsc-lite-libs make elfutils-libelf-devel -y sh VMware-Player-16.1.1-17801498.x86_64.bundle --console
dnf install tigervnc-server -y firewall-cmd --add-port=5901/tcp --permanent firewall-cmd --reload dnf install @base-x gnome-shell gnome-shell gnome-terminal gnome-tweaks
cat /etc/tigervnc/vncserver.users
TigerVNC User assignment
This file assigns users to specific VNC display numbers.
The syntax is =. E.g.:
:2=andrew
:3=lisa
:1=root
cat /root/.vnc/config session=gnome securitytypes=vncauth,tlsvnc desktop=sandbox geometry=2000x1200 localhost alwaysshared
### For PowerEdge T410
Change the .vmx files and add
monitor.allowLegacyCPU = "true"
## Other
dnf install vim -y dnf install wget -y ```