mirror of
https://git.valherun.com/valherun/pxe_boot_alma.git
synced 2026-10-15 23:52:03 -04:00
- restructure boot/kickstarts/scripts/docs into homelab/ - docs: alma9->10 breaking changes, CIS hardening, kickstart changes - add find_cron_entries.sh helper and codex running memory notes Co-Authored-By: Claude Fable 5 <[email protected]>
71 lines
2.4 KiB
Plaintext
71 lines
2.4 KiB
Plaintext
# description: Setup Postgres
|
|
|
|
###
|
|
# Postgres Setup
|
|
###
|
|
echo "Setting up Postgres" #LOG
|
|
|
|
/usr/sbin/useradd -n -r -c "Postgres Account" -d /home/postgres -m -u 26 -g 100 -G 106 -s /bin/bash postgres #LOG
|
|
|
|
cp /mnt/tmp/custom/pgsql/postgres.bash_profile /home/postgres/.bash_profile #LOG
|
|
cp /mnt/tmp/custom/pgsql/postgres.bashrc /home/postgres/.bashrc #LOG
|
|
cp /mnt/tmp/custom/pgsql/reindexdb.sh /usr/local/pgsql/bin/ #LOG
|
|
mkdir /usr/local/pgsql/data #LOG
|
|
mkdir /usr/local/pgsql/etc #LOG
|
|
chown -R postgres /usr/local/pgsql* #LOG
|
|
|
|
if [ -f "/home/iglass/conf/pg_service.conf" ]; then
|
|
ln -s /home/iglass/conf/pg_service.conf /usr/local/pgsql/etc/pg_service.conf
|
|
else
|
|
echo "No /home/iglass/conf/pg_service.conf file to link to"
|
|
fi
|
|
|
|
chmod 0700 /usr/local/pgsql/data #LOG
|
|
|
|
# data dir must be empty
|
|
echo "Running initdb" #LOG
|
|
su -c '/usr/local/pgsql/bin/initdb /usr/local/pgsql/data' - postgres #LOG
|
|
|
|
cp -af /mnt/tmp/custom/pgsql/data/* /usr/local/pgsql/data/ #LOG
|
|
chown -R postgres /usr/local/pgsql* #LOG
|
|
|
|
echo "Running postgres finish script" #LOG
|
|
#/bin/cp /mnt/tmp/custom/pgsql/finish.sh /usr/local/pgsql/ #LOG
|
|
su -c '/mnt/tmp/custom/pgsql/finish.sh' - postgres #LOG
|
|
|
|
# cp /mnt/tmp/custom/src/postgresql-7.2/contrib/start-script/linux /etc/init.d/postgresql #LOG
|
|
chmod 755 /etc/init.d/postgresql #LOG
|
|
chkconfig --add postgresql #LOG
|
|
|
|
if [ -f "/home/iglass/bin/pgMemTweak" ]; then
|
|
/home/iglass/bin/pgMemTweak >> /etc/sysctl.conf
|
|
SHMALL=`/home/iglass/bin/pgMemTweak shmall`
|
|
if [ "$SHMALL" != "" ]; then
|
|
echo "$SHMALL" > /proc/sys/kernel/shmall
|
|
|
|
SHMMAX=`/home/iglass/bin/pgMemTweak shmmax`
|
|
if [ "$SHMMAX" != "" ]; then
|
|
echo "$SHMMAX" > /proc/sys/kernel/shmmax
|
|
fi
|
|
fi
|
|
else
|
|
echo "iGlass software must be installed first for pgMemTweak"
|
|
fi
|
|
|
|
echo "/usr/local/pgsql/lib" >> /etc/ld.so.conf
|
|
ldconfig
|
|
|
|
echo "Starting postgres to create iglass user" #LOG
|
|
/etc/init.d/postgresql start #LOG
|
|
|
|
sleep 5
|
|
|
|
/usr/local/pgsql/bin/psql -U postgres -c "CREATE USER iglass PASSWORD 'iglass' CREATEDB NOCREATEUSER;" -d template1 #LOG
|
|
|
|
/usr/local/pgsql/bin/psql -U postgres -c "ALTER USER postgres SET statement_timeout=0;" -d template1 #LOG
|
|
|
|
/usr/local/pgsql/bin/createlang -U postgres plpgsql template1 #LOG
|
|
|
|
#cd /etc/rc.d/rc3.d
|
|
#/bin/ln -s ../init.d/postgresql S98postgresql #LOG
|