Installation of CentOS 8 

Goal: Install centos 8 on tx2 (test system to port TCS to CentOS8).
      In 2018, tcs3 was ported and run on centos7, but never depolyed due to
      HA drive issues, and the sense CentOS7 wasn't going to see deployment on the IRTF.
      Setup this computer with CentOS8 to begin test the TCS on CentOS8.
Date: 2019/10

1. HARDWARE  

   purchased by denault from newegg, amazon, mwave on 2018/01:
   GA-B250M-D3H LGA-1151, I5-7400 CPU,
   16GB RAM (DDR4 2133), 500GB HD(WD Black WD50003AZEX). DVD
   Seasonic FOCUS Pluse 550FX P/S
   case: Chenbro RM41300-F1 (mwave)

2. DVD Install and update 

   Created USB boot disk using CentOS-8-x86_64-1905-dvd1.iso using Win32DiskImager.

   desired partitions are:
		sda1  210M  /boot/efi      # efi system parition
		sda2   52G  /              # centos8 root
		sda3   52G  /r3            # unused
		sda4  395G  /aux           # 

   Selected bios boot menu: usb (UEFI)
   Software selection: GNOME Desktop
	Installation destination: sda, I will configure partitioning
   manual parititon:
      /boot/efi 210M sda1
      /          52G sda2
      (will do other later, as installer want to assign sdaX ).
   manual config ethernet.
   start installation.
   made local user 'irtf', during setup

   INSTALLATION FROZE about 85%. Tried again. with Server+GUI install. This worked!

1st Boot

   Stop & Turn off filewall:
      systemctl stop    firewalld
      systemctl disable firewalld
   Turn off selinux:
      vi /etc/selinux/config
      SELINUX=disabled.

   yum update
   reboot

Insure you have everything you want:

   dnf groupinstall "Workstation" "Development Tools" \
      "Graphical Administration Tools"  "Scientific Support" "System Tools"

   dnf install nano net-tools gnuplot gsl gsl-devel tigervnc tigervnc-server \
       expect mercurial mutt gtk2-devel hplip samba ypbind rpcbind gtk3-devel \
       mariadb tcsh autofs ntpstat xterm 

   pmac driver support:
      dnf install elfutils-libelf-devel

Now you have a complete working system/desktop.

3. IRTF Client Setup 

Setup Chrony - the NTP client

   vi /etc/chrony.conf
   comment out pool 2.centos.pool.ntp.org iburst, and add:
	server duke.ifa.hawaii.edu     iburst
	server goblin.ifa.hawaii.edu   iburst
	pool ntproundtop.hawaii.edu iburst maxsources 3
	server irtfgps2.ifa.hawaii.edu  iburst

   to insure chronyc was enabled:
      systemctl status chronyd
   to start and enable :
      systemctl start chronyd
      systemctl enable chronyd

   chronyc can be used to show status:
      chronyc sources        # displayinfo about current sources
      chronyc sourcestats    # Display estimation info about current sources
      chronyc tracking       # display system time information
      chronyc activity       # show the NTP sources
      ntpstat

Accounts:
   make droot, mroot
   update root pw (still i-------)
  Only if created local user:
     move irtf (local user) to /home2, as /home will be an automount

Setup as NIS Client:
   ypdomainname    irtf.ifa.hawaii.edu
   vi /etc/hosts        # define the NIS servers
   vi /etc/yp.conf

   authselect select nis 
   systemctl enable --now rpcbind ypbind 

Install NFS
   vi /etc/idmapd.conf
      Domain = ifa.hawaii.edu

Enable:
      systemctl enable rpcbind
      #systemctl enable nfs-server
      systemctl enable autofs

Create netdisk automont links:

   ln -s /netdisks/htdocs      /htdocs           # create needed netdisks links 
   ln -s /netdisks/irtf.backup /irtf.backup

Now you have IRTF client with YP,NFS,Automount.  IRTF accounts are working.

smartd:
   Add devices to scan in conf:
      vi /etc/smartmontools/smartd.conf
         #DEVICESCAN  ...
         /dev/sda -a -d sat -o on -S on -s (S/../.././07|L/../../6/09) -R 194 -m root

   To enable service:
      systemctl enable smartd.service
   To start service:
      systemctl start smartd.service

finish setting up /r3, /aux
   fdisk /dev/sda
   used 'n'  to create 53G for /r3
   used 'n'  to create remainder (360.6G) for /aux
 
   mkfs.ext4 -v -m 2 /dev/sda3
   mkfs.ext4 -v -m 2 /dev/sda4

   blkid /dev/sda3          # used to print UUID
   blkid /dev/sda4

   mkdir /r3; mkdir /aux    # to ceate mounts
   vi /etc/fstab            # add mounts to fstab: used /dev/sdaX, ont UUID
      /dev/sda3               /r3                     ext4    defaults        1 2
      /dev/sda4               /aux                    ext4    defaults        1 2

4. TCS Custom Set Up

Setup 192.168 address

cd /etc/sysconfig/network-scripts
vi ifcfg-enp0s31f6:0
   DEVICE=enp0s31f6:0
   ONBOOT=yes
   BOOTPROTO=none
   IPADDR=192.168.110.232
   PREFIX=16

ip addr show   # should show 2 IP attached to your device.

TO account, restrict logins to a select few on the computer

   1. custom /etc/nsswitch.conf for NIS to restrict who can login to the TCS computers:

      "file" only for automount 

      vi /etc/authselect/user-nsswitch.conf
         #automount:  files sss
         automount:  files 

      authselect apply-changes   # didn't applycchanges
      authselect select nis      # but ran this, then changes applied.

   2. setup /etc/auto.home and /etc/automap file based automounts
      vi /etc/auto.master
         #+auto.master
         # only file based autofs for TCS
         /netdisks    /etc/automap
         /home        /etc/auto.home
      
   3. Setup local /home2/to' account to run the TCS application.
      ( not /home/to is in auto.home)
      to:x:6028:501:Telescope Operator:/home/to:/bin/tcsh

      Setup local /home2/nologin for users in nis passwd, but not allow on TCS.

Now login are limited to certain accounts, and local 'to' account works.

/home/to setup: pulse audio, /etc/group fixes
Finish setting up /home/to, get audio to run via a ssh login.

   1. setup /home/to's links (data, current), and /bin files.

   2. vi /etc/group
      add "to,tcs3" to audio:63 group
      staff:x:500:tcs3
      project:x:501:
   
   Login as 'to' to the console/desktop and set the volume on the audio device.
   Now using "ssh -x" the ssh login/IC can play sounds using, ie:
      aplay /home/tcs3/dev/ic/audio/wav/next_obj.wav
   
Copy /aux/catalogs4 to new computer
   # copy from t1hilo to local system:
   rsync -az -v -e ssh --delete  --numeric-ids  t1hilo:/aux/catalogs4 /aux/

/usr/local/bin

   # for apeio need rpcgen, and libtirpc-devel (replacment for sun's rpc lib).
   dnf --enablerepo=PowerTools install rpcgen
   dnf install libtirpc-devel 

   #install the following /usr/local/bin binaries, scripts
   apeio -  /home/tcs3/src/tcs3/embeddedx86/apeio.64/
   ielog, ielog_2hr.sh, ielog_query - /home/ida/src/ielog
      alternatives --set python /usr/bin/python2  # set the default verion of python
      dnf install python2-PyMySQL                 # for import pymysql
      dnf install python3-PyMySQL                 # for import pymysql
   isd_q1 - /home/tcs3/src/tcs3/clients/iSD-TH/
   rioquery -  /home/tcs3/src/tcs3/clients/rio/
   smokeyio -  /home/smokey/current/ic/icio/
   t3io - /home/tcs3/src/tcs3/clients/t3io/ 

/etc/rc.local stuff

/etc/rc.local Enable & add commands
   To enable
      chmod u+x /etc/rc.d/rc.local
      systemctl start rc-local

Add the following lines: 
   #
   # if you screen blanck after 10 min or so, this stops it
   #
   /usr/bin/setterm -blank 0

   #
   # change the limits for the mqueues using the /proc file system.
   #    msg_max default is 10, need 40.
   #    msgsize_max default is 8192, need 1024 is ok.
   #
   echo "40"   > /proc/sys/fs/mqueue/msg_max
   echo "1024" > /proc/sys/fs/mqueue/msgsize_max

   #
   # load the tcs device drivers: pmac.ko
   #
   sleep 8 # since systemd runs in parallel (need delay)
   mknod --mode=666 /dev/pmac c 66 0
   insmod /home/to/current/drivers/pmac/pmac.ko

--------------------------------------------------------------------------------------
problems with sound:

show setting:
  pactl list sinks

ssh for IC "Mute: yes" , to unmute:
   sh -c "pactl set-sink-mute 0 false" 

Increase volume in IC xterm:
sh -c "pactl set-sink-mute 0 false ; pactl set-sink-volume 0 +5%"

Set defaults: xterm:

 cat ~/.config/pulse/default.pa
.include /etc/pulse/default.pa

# Set volume to 50% on boot
set-sink-volume 0 32768