Sky: Unterschied zwischen den Versionen

Aus Info-Theke
Zur Navigation springen Zur Suche springen
 
(25 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 11: Zeile 11:
adduser --uid=201 bupsrv
adduser --uid=201 bupsrv
hostname sky.infeos.de
hostname sky.infeos.de
apt-get install sudo rsync htop gdisk
apt-get install sudo rsync htop gdisk less tmux zip
mkdir /media /media/trg /media/src /media/sixpack /var/log/local
chmod uog+rwx /var/loc/local
</pre>
</pre>
<pre>
<pre>
Zeile 17: Zeile 19:
ssh-copy-id -i ~/.ssh/id_rsa wk@sky
ssh-copy-id -i ~/.ssh/id_rsa wk@sky
# installieren /home/bin
# installieren /home/bin
# /usr/local/bin/restore/BupRestSky.sh kopieren
</pre>
</pre>


Zeile 30: Zeile 33:


mdadm --create /dev/md2 --assume-clean --level=1 --verbose --raid-devices=2 /dev/sdc2 /dev/sdd2
mdadm --create /dev/md2 --assume-clean --level=1 --verbose --raid-devices=2 /dev/sdc2 /dev/sdd2
/usr/share/mdadm/mkconf >/etc/mdadm/mdadm.conf
</pre>
= LVM einrichten =
<pre>
apt-get install lvm2 python3 python
pvcreate /dev/md2
vgcreate --physicalextentsize 32M  sixpack /dev/md2
#lvcreate --size=32M --name=bupdebian sixpack
/usr/local/bin/restore/BupRestSky.sh
python /usr/local/bin/restore/lvs2all.py lvcreate
python /usr/local/bin/restore/lvs2all.py lvcreate | grep lvcreate
python /usr/local/bin/restore/lvs2all.py mkdir
python /usr/local/bin/restore/lvs2all.py mkdir | grep mkdir
python /usr/local/bin/restore/lvs2all.py fstab
python /usr/local/bin/restore/lvs2all.py fstab | grep fstab
python /usr/local/bin/restore/lvs2all.py mkfs
python /usr/local/bin/restore/lvs2all.py mkfs | grep mkfs
</pre>
= NGINX einrichten =
<pre>
apt-get install nginx-full ca-certificates certbot ssl-cert
mkdir /space/php_temp;
/usr/local/bin/restore/NginxRestSky.sh
nxtool make-certs
</pre>
Eintrag in /etc/nginx/nginx.conf:
<pre>
        ##
        # Logging Settings
        ##
        log_format proxyLog '$remote_addr => $http_x_real_ip - $remote_user [$time_local]  '
                          '"$request" $status $body_bytes_sent '
                          '"$http_referer" "$http_user_agent"';
client_body_temp_path /space/php_temp;
client_max_body_size 5G;
fastcgi_read_timeout 3600s;
fastcgi_request_buffering off;
</pre>
Wenn eine Weiterleitung besteht: in /etc/nginx/fastcgi_params
<pre>
fastcgi_param  X-REAL-IP          $http_x_real_ip;
</pre>
= PHP einrichten =
<pre>
apt-get install nginx php-fpm php-cli php-json php-curl php-imap php-gd php-mysql php-xml \
  php-zip php-intl php-mcrypt php-imagick php-mbstring php-memcached memcached php-xdebug
</pre>
/etc/php/7.0/fpm/php.ini:
<pre>
max_execution_time = 3600
max_input_time = 3600
memory_limit = 512M
post_max_size = 5G
upload_max_filesize = 5G
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.revalidate_freq=1
# Neu:
sys_temp_dir = "/space/php_temp"
upload_tmp_dir = /space/php_temp
</pre>
= DB einrichten =
<pre>
apt-get install redis-server redis-tools php-redis
</pre>
== Mariadb 10.3 statt 10.1 ==
<pre>
apt-get install software-properties-common dirmngr
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.zol.co.zw/mariadb/repo/10.3/debian stretch main'
apt-get install mariadb-server mariadb-client
</pre>
<pre>
#Beim Upgrade gab es Probleme. Lösung mit:
apt-get install --reinstall -o Dpkg::Options::="--force-confmiss" mariadb-server-10.3
</pre>
== Konfiguration Mariadb ==
/etc/mysql/mysql.cnf
<pre>
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8
[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server  = utf8
collation-server      = utf8_general_ci
character_set_server  = utf8
collation_server      = utf8_general_ci
plugin-load-add = auth_socket.so
</pre>
== Neuinstallation Mariadb: ==
<pre>
apt-get remove --purge mariadb-server mariadb-client
apt autoremove
rm -Rf /usr/share/mysql /etc/mysql /usr/share/mysql
systemctl daemon-reload
apt-get install mariadb-server mariadb-client
apt-get install --reinstall -o Dpkg::Options::="--force-confmiss" mariadb-server-10.3
</pre>
= Webapplikationen einrichten =
<pre>
cp -a /opt/restore/home/www /home
ln -s /home/www /srv/www
dbtool.py -v3 create-backup-user backup 'SAVE!all' root <root-pw>
dbtool.py create-webapp-dbs root <root-passwd>
</pre>
= Cron und Backup =
<pre>
cd /usr/share
mkdir pyrshell
cd pyrshell
tar xzf '/media/sixpack/skybackup/dayly/current/usr=share=pyrshell.tgz'
cd pyrshell
appl/BackupTool.sh install
appl/Monitor.sh install
crontab -e
</pre>
<pre>
*/2 * * * * /usr/local/bin/MvImport
35 0 * * * PYTHONPATH=/usr/share/pyrshell /usr/local/bin/backup_next -q -r backup dayly
35 1 * * 5 PYTHONPATH=/usr/share/pyrshell /usr/local/bin/backup_next -q -r backup weekly
33 4 * * * /usr/bin/sudo -u www-data /srv/www/cloud.infeos.de/occ --all files:scan >/dev/null 2>&1
33 4 * * * /usr/local/bin/RemoveOccTrash.sh /srv/www/wolke.infeos.de/data -q
43 4 * * * /usr/bin/sudo -u www-data /srv/www/wolke.infeos.de/occ --all files:scan >/dev/null 2>&1
53 4 * * * /usr/bin/sudo -u www-data /srv/www/cloud.connect-develop.de/occ --all files:scan >/dev/null 2>&1
</pre>
</pre>

Aktuelle Version vom 3. April 2019, 09:22 Uhr

  • debian 9 (stretch)
  • m2972.contaboserver.net

Installation[Bearbeiten]

adduser wk
adduser citmaster
adduser sebastian
adduser --uid=202 extbup
adduser --uid=201 bupsrv
hostname sky.infeos.de
apt-get install sudo rsync htop gdisk less tmux zip
mkdir /media /media/trg /media/src /media/sixpack /var/log/local
chmod uog+rwx /var/loc/local
# lokal:mk
ssh-copy-id -i ~/.ssh/id_rsa wk@sky
# installieren /home/bin
# /usr/local/bin/restore/BupRestSky.sh kopieren

RAID erzeugen[Bearbeiten]

# md0 und md1 existieren schon
mknod /dev/md2 b 9 2
chmod 0660 /dev/md2
# 2 Partitionen: 32G + Rest
gdisk /dev/sdc
# 2 Partitionen: 32G + Rest
gdisk /dev/sdd

mdadm --create /dev/md2 --assume-clean --level=1 --verbose --raid-devices=2 /dev/sdc2 /dev/sdd2
/usr/share/mdadm/mkconf >/etc/mdadm/mdadm.conf

LVM einrichten[Bearbeiten]

apt-get install lvm2 python3 python
pvcreate /dev/md2
vgcreate --physicalextentsize 32M  sixpack /dev/md2
#lvcreate --size=32M --name=bupdebian sixpack
/usr/local/bin/restore/BupRestSky.sh
python /usr/local/bin/restore/lvs2all.py lvcreate
python /usr/local/bin/restore/lvs2all.py lvcreate | grep lvcreate
python /usr/local/bin/restore/lvs2all.py mkdir
python /usr/local/bin/restore/lvs2all.py mkdir | grep mkdir
python /usr/local/bin/restore/lvs2all.py fstab
python /usr/local/bin/restore/lvs2all.py fstab | grep fstab
python /usr/local/bin/restore/lvs2all.py mkfs
python /usr/local/bin/restore/lvs2all.py mkfs | grep mkfs

NGINX einrichten[Bearbeiten]

apt-get install nginx-full ca-certificates certbot ssl-cert
mkdir /space/php_temp;
/usr/local/bin/restore/NginxRestSky.sh
nxtool make-certs

Eintrag in /etc/nginx/nginx.conf:

        ##
        # Logging Settings
        ##

        log_format proxyLog '$remote_addr => $http_x_real_ip - $remote_user [$time_local]  '
                          '"$request" $status $body_bytes_sent '
                          '"$http_referer" "$http_user_agent"';

	client_body_temp_path /space/php_temp;
	client_max_body_size 5G;
	fastcgi_read_timeout 3600s;
	fastcgi_request_buffering off;

Wenn eine Weiterleitung besteht: in /etc/nginx/fastcgi_params

fastcgi_param  X-REAL-IP          $http_x_real_ip;

PHP einrichten[Bearbeiten]

apt-get install nginx php-fpm php-cli php-json php-curl php-imap php-gd php-mysql php-xml \
   php-zip php-intl php-mcrypt php-imagick php-mbstring php-memcached memcached php-xdebug

/etc/php/7.0/fpm/php.ini:

max_execution_time = 3600
max_input_time = 3600
memory_limit = 512M
post_max_size = 5G
upload_max_filesize = 5G
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.revalidate_freq=1
# Neu:
sys_temp_dir = "/space/php_temp"
upload_tmp_dir = /space/php_temp

DB einrichten[Bearbeiten]

apt-get install redis-server redis-tools php-redis

Mariadb 10.3 statt 10.1[Bearbeiten]

apt-get install software-properties-common dirmngr
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.zol.co.zw/mariadb/repo/10.3/debian stretch main'
apt-get install mariadb-server mariadb-client
#Beim Upgrade gab es Probleme. Lösung mit:
apt-get install --reinstall -o Dpkg::Options::="--force-confmiss" mariadb-server-10.3

Konfiguration Mariadb[Bearbeiten]

/etc/mysql/mysql.cnf

[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
default-character-set = utf8

[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server  = utf8
collation-server      = utf8_general_ci
character_set_server   = utf8
collation_server       = utf8_general_ci

plugin-load-add = auth_socket.so

Neuinstallation Mariadb:[Bearbeiten]

apt-get remove --purge mariadb-server mariadb-client
apt autoremove
rm -Rf /usr/share/mysql /etc/mysql /usr/share/mysql
systemctl daemon-reload
apt-get install mariadb-server mariadb-client
apt-get install --reinstall -o Dpkg::Options::="--force-confmiss" mariadb-server-10.3

Webapplikationen einrichten[Bearbeiten]

cp -a /opt/restore/home/www /home
ln -s /home/www /srv/www
dbtool.py -v3 create-backup-user backup 'SAVE!all' root <root-pw>
dbtool.py create-webapp-dbs root <root-passwd>

Cron und Backup[Bearbeiten]

cd /usr/share
mkdir pyrshell
cd pyrshell
tar xzf '/media/sixpack/skybackup/dayly/current/usr=share=pyrshell.tgz'
cd pyrshell
appl/BackupTool.sh install
appl/Monitor.sh install

crontab -e
*/2 * * * * /usr/local/bin/MvImport
35 0 * * * PYTHONPATH=/usr/share/pyrshell /usr/local/bin/backup_next -q -r backup dayly
35 1 * * 5 PYTHONPATH=/usr/share/pyrshell /usr/local/bin/backup_next -q -r backup weekly
33 4 * * * /usr/bin/sudo -u www-data /srv/www/cloud.infeos.de/occ --all files:scan >/dev/null 2>&1
33 4 * * * /usr/local/bin/RemoveOccTrash.sh /srv/www/wolke.infeos.de/data -q
43 4 * * * /usr/bin/sudo -u www-data /srv/www/wolke.infeos.de/occ --all files:scan >/dev/null 2>&1
53 4 * * * /usr/bin/sudo -u www-data /srv/www/cloud.connect-develop.de/occ --all files:scan >/dev/null 2>&1