SAC:staging2.www.osgeo.org

wwwosgeo (staging server) is running on winnie.postgis.net virtual box ssh port 53022, passwords on secure/access server

Setup from Disk the prompts
(Regular install, don't use graphical)
 * 1) Virtual Box use VMDK, dynamically allocated, 100GB
 * 2) Start with debian-9.3.0-amd64-netinst.iso image ( https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso (2017-12-09)
 * 1) set mirror to debian.csail.mit.edu
 * 2) Participate in Package Usage: Yes
 * 3) Uncheck Debian Desktop Environment
 * 4) Check SSH server
 * 5) Check Web Server
 * 6) Uncheck Print Server
 * 7) Install Grub
 * 8) Select 2nd option (only drive)

Install LDAP SSH support
Note for the remainder of installs, I went with apt instead of (apt-get or aptitude) Per Debian Handbook apt, apt is the preferred installer and what I saw being used for newer Debians.

su root apt install locales-all libpam-ldapd libnss-ldapd apt install sudo apt install tcsh

apt install ldapscripts
 * 1) During install fill in below and check passwd, group, shadow

/etc/ldap/ldap.conf should have this --   BASE    dc=osgeo, dc=org URI    ldaps://ldap.osgeo.org/ #SIZELIMIT     12 #TIMELIMIT     15 #DEREF         never TLS_CHECKPEER yes TLS_REQCERT demand TLS_CACERT /etc/ssl/certs/ca-certificates.crt #I'm using genric one, osgeo6 is different pam_groupdn cn=telascience,ou=Shell,dc=osgeo,dc=org #not though telascience is defunct so not sure what that cn    nss_base_passwd ou=People,dc=osgeo,dc=org nss_base_shadow ou=People,dc=osgeo,dc=org nss_base_group ou=Group,dc=osgeo,dc=org ldap_version 3 pam_password md5 bind_policy soft ---


 * 1) copy contents of /etc/nslcd.conf from osgeo6

conf should look like --  # /etc/nsswitch.conf #  # Example configuration of GNU Name Service Switch functionality. # If you have the `glibc-doc-reference' and `info' packages installed, try: # `info libc "Name Service Switch"' for information about this file.
 * 1) nano /etc/nsswitch.conf

passwd:        compat ldap group:         compat ldap shadow:        compat gshadow:       files

hosts:         files dns networks:      files

protocols:     db files ldap services:      db files ldap ethers:        db files rpc:           db files

netgroup:      nis aliases:       ldap ---

service nscd restart service nslcd restart service ssh restart

Verify ldap authentication and query all set up
getent passwd robe

robe:x:15108:100:Regina Obe:/home/robe:/bin/bash
 * should output:

ldapsearch -x uid=robe
 * should output a lot of information about Regina

cp -a /etc/skel /home/robe chown -R robe:100 /home/robe

sudo usermod -a -G sudo robe sudo usermod -a -G www-data robe
 * add robe to sudoers

should now be able to log in as robe

Installing PHP, MariaDb etc for wordpress
sudo apt install mariadb-server #installed Mariadb 10.1

sudo apt install apache2 #was already installed as part of setup so not needed
 * Install apache, php7

sudo apt install php php-dev libapache2-mod-php php-mysql php-curl php-gd php-xmlrpc php-intl php-mcrypt php-xsl sudo apt install php-ldap
 * on debian 9, php7.0 is default, so I can dispense with php7.0 prefix,
 * for older, might have to do php7.0, libapache2-mod-php7.0 etc.

Download backups and restore, and setup website
copy configs to etc/apache2/sites-available (for this server I created staging version) copy database and sql backups from old server to /var/www/backups

sudo a2dissite 000-default.conf sudo a2ensite staging.www.osgeo.org.conf sudo a2enmod rewrite sudo a2enmod file_cache sudo a2enmod expires

cd /var/www/backups tar -xvf osgeo_wp_daily.tar.gz    mv osgeo.org /var/www/staging.osgeo.org

cd /var/www sudo chown -R www-data:www-data staging.osgeo.org sudo chmod -R 770 staging.osgeo.org

mysql CREATE USER 'osgeo_site' @'localhost' IDENTIFIED BY 'look in config for password';
 * 1) create new database and user and restore backup

CREATE DATABASE staging_osgeo; GRANT ALL ON staging_osgeo.* TO 'osgeo_site'@'localhost'; exit

cd /var/www/backups sudo gunzip osgeo_daily.sql.gz   sudo mysql --user=root staging_osgeo  < osgeo_daily.sql
 * 1) restore backup

sudo apt update sudo apt upgrade sudo reboot


 * 1) you may need to fiddle with the www/osgeo.org/httpdocs/core/.htaccess if you are setting up a dev

sudo systemctl reload apache2

Install apache, php7
sudo apt install apache2 #was already installed as part of setup so not needed

sudo apt install php php-dev libapache2-mod-php php-mysql php-curl php-gd php-xmlrpc php-intl php-mcrypt php-xsl sudo apt install php-ldap
 * 1) on debian 9, php7.0 is default, so I can dispense with php7.0 prefix,
 * 2) for older, might have to do php7.0, libapache2-mod-php7.0 etc.

download backups and restore
copy configs to etc/apache2/sites-available (for this server I created staging version) copy database and sql backups from old server to /var/www/backups

sudo a2dissite 000-default.conf sudo a2ensite staging.www.osgeo.org.conf sudo a2enmod rewrite sudo a2enmod file_cache sudo a2enmod expires

cd /var/www/backups tar -xvf osgeo_wp_daily.tar.gz mv osgeo.org /var/www/staging.osgeo.org

cd /var/www sudo chown -R www-data:www-data staging.osgeo.org sudo chmod -R 770 staging.osgeo.org

Create new database and user and restore backup
mysql CREATE USER 'osgeo_site' @'localhost' IDENTIFIED BY 'look in config for password';

CREATE DATABASE staging_osgeo; GRANT ALL ON staging_osgeo.* TO 'osgeo_site'@'localhost'; exit

cd /var/www/backups sudo gunzip osgeo_daily.sql.gz   sudo mysql --user=root staging_osgeo  < osgeo_daily.sql
 * 1) restore backup

sudo apt update sudo apt upgrade sudo reboot


 * 1) you may need to fiddle with the www/osgeo.org/httpdocs/core/.htaccess if you are setting up a dev

sudo systemctl reload apache2