Skip to content

Instantly share code, notes, and snippets.

@xserveraws
xserveraws / create_debian-sys-maint_for_mysqladmin.sh
Created April 29, 2020 11:07 — forked from waja/create_debian-sys-maint_for_mysqladmin.sh
Create 'debian-sys-maint' MariaDB user for use of mysqladmin. Just in case you can't use 'root' via 'unix_socket' plugin.
#!/bin/sh
MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf"
# generate password
PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)');
# adjust /etc/mysql/debian.cnf (used as defaults file by system scripts)
sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf
sed -i "s/^user =.*$/user = debian-sys-maint/" /etc/mysql/debian.cnf
# create config file for mysqladmin itself (maybe not needed)
umask 066
cat > ${MYSQLADMIN_CFG} <<EOF

Installation of bind9

apt install bind9

Create a virtual interface (eth0:1)

Note: i have the IP : 192.168.1.109 by DHCP

edit the network settings file

@xserveraws
xserveraws / install.sh
Created July 29, 2020 22:14 — forked from janus57/install.sh
Images optimization
apt install jpegoptim pngquant optipng
@xserveraws
xserveraws / PKGBUILD
Created July 30, 2020 18:55 — forked from sevu/PKGBUILD
MariaDB optimized build script for Archlinux
# Maintainer: Michael Herzberg
# Maintainer: Severin Glöckner <severin.gloeckner@stud.htwk-leipzig.de>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Christian Hesse <mail@eworm.de>
pkgbase=mariadb-10.3
pkgname=('mariadb-libs-10.3' 'mariadb-clients-10.3' 'mytop-10.3' 'mariadb-10.3')
pkgver=10.3.12
pkgrel=2
arch=('x86_64')
  1. Make sure mysql-client is installed. If not, then :
    sudo apt install mysql-client
	or
    sudo apt-get install mysql-client
  1. Open php.ini

; PHP's default character set is set to UTF-8.

@xserveraws
xserveraws / install.md
Created August 1, 2020 06:19 — forked from prochor666/install.md
Mount Google drive under Debian Linux (Jessie and later)
@xserveraws
xserveraws / letsencrypt-hostname.sh
Created August 8, 2020 11:24 — forked from agarzon/letsencrypt-hostname.sh
Secure plesk clean installation with hostname certificate by Let's Encrypt
#!/bin/bash -e
### Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved.
### Secure plesk clean installation with hostname certificate by Let's Encrypt
export PYTHONWARNINGS="ignore:Non-standard path"
LE_HOME=${LE_HOME:-"/usr/local/psa/var/modules/letsencrypt"}
HOSTNAME=$(hostname)
# Use staging server for testing
# --server https://acme-staging.api.letsencrypt.org/directory
@xserveraws
xserveraws / rsync_parallel.sh
Created August 11, 2020 07:24 — forked from rcoup/rsync_parallel.sh
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@xserveraws
xserveraws / post-mortem.md
Created August 24, 2020 15:29 — forked from joewiz/post-mortem.md
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files) 2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

    • Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  1. Added fs.file-max = 70000 to /etc/sysctl.conf
  2. Added `nginx soft nofile 1
@xserveraws
xserveraws / setup.sh
Created August 25, 2020 09:14 — forked from annttu/setup.sh
Debian PXE install
#!/bin/bash
# Setup Debian PXEinstall environment
export MYIP=10.66.6.1 # TODO: Setup this
export MYINTERFACE=$(netstat -ie | grep -B1 "$MYIP" | head -n1 | awk '{print $1}')
if [ -z "$MYINTERFACE" ]
then
echo "Setup ip $MYIP first"