Skip to content

Instantly share code, notes, and snippets.

View coder4web's full-sized avatar

Aleksey Deryagin coder4web

View GitHub Profile
@coder4web
coder4web / redis_install_centos.txt
Last active September 10, 2017 01:45
Redis install on CentOS 6.4
BTW yum has last Redis too, remi repository at least.
$ sudo -i
$ yum list redis
$ redis.x86_64 2.6.13-1.el6.remi remi
But today we want compile redis from source (see http://redis.io/download)
$ yum install make gcc tcl
$ cd /usr/local/src
@coder4web
coder4web / essential_server_security.txt
Last active December 27, 2020 13:22
Essential web-server security
# ------------------------
# SSH:
# ------------------------
#http://wiki.centos.org/HowTos/Network/SecuringSSH
#https://www.linode.com/docs/security/securing-your-server/
sudo nano /etc/ssh/sshd_config
Port 20202
PermitRootLogin no
#PermitRootLogin without-password
@coder4web
coder4web / debian_locales.sh
Last active November 27, 2015 09:51
Locales in Debian
# @see https://people.debian.org/~schultmc/locales.html
# @see http://badyblog.com/ustanovka-utf-8-rusifikaciya-konsoli-v-debian/
# perl: warning: Please check that your locale settings:
# locale: Cannot set LC_ALL to default locale: No such file or directory
locale
sudo dpkg-reconfigure locales
#138. en_US.UTF-8 UTF-8
#349. ru_RU.UTF-8 UTF-8
@coder4web
coder4web / setup_rbenv_per_user.sh
Last active January 24, 2020 14:34
Debian rbenv per-user install
#-------------------------------
# Debian 10
# https://linux4one.com/how-to-install-ruby-on-debian-10/
#-------------------------------
sudo apt update
sudo apt install git libreadline-dev zlib1g-dev libreadline-dev libncurses5-dev autoconf bison libssl-dev build-essential libyaml-dev libffi-dev libssl-dev libreadline-dev zlib1g-dev libgdbm-dev
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
@coder4web
coder4web / freebsd_bash.txt
Last active November 27, 2015 09:53
Setting bash as default shell in FreeBSD
1) Install binary package
# pkg search bash
bash-4.3.42
# pkg install bash
# which bash
/usr/local/bin/bash
@coder4web
coder4web / freebsd_software.sh
Last active October 21, 2015 17:50
FreeBSD ports and packages management
# FreeBSD ports (portmaster) and packages (pkgng) management
# ports
portsnap fetch extract
# portmaster
# You must upgrade the ports-mgmt/pkg port first.
make -C /usr/ports/ports-mgmt/pkg build deinstall install clean
pkg -v
# If you are upgrading from the old package format, first run:
@coder4web
coder4web / filesystem_monitoring.sh
Last active March 7, 2020 14:01
Linux filesystem monitoring
# df - report file system disk space usage
df -h
df -i
df -hl
df -hl | sort -n
# du - disk used - estimate file space usage
alias du1='du . -hs'
alias du10='du . -k | sort -n -r | head -n 10'
@coder4web
coder4web / sphinxsearch_src.sh
Created December 16, 2015 08:28
Sphinx (sphinxsearch) install from source
# @see http://sphinxsearch.com/downloads/release/
# redhats: yum remove sphinx
# debians: apt-get remove sphinxsearch
cd /usr/local/src
wget -c http://sphinxsearch.com/files/sphinx-2.2.10-release.tar.gz
tar xzvf sphinx-2.2.10-release.tar.gz
cd sphinx-2.2.10-release
./configure
make install
@coder4web
coder4web / php7_memcached_src.sh
Last active December 18, 2018 09:31
PHP 7 with Memcached from source
# -------------------------------------------------------
# STEP 1: install requirements
# -------------------------------------------------------
# CentOS / RHEL / Amazon EC2 AMI:
# @see https://webtatic.com/packages/php70/
sudo yum install php70w php70w-devel
sudo yum groupinstall "Development Tools"
sudo yum install libmemcached libmemcached-devel zlib zlib-devel
# -------------------------------------------------------
# Debian
@coder4web
coder4web / lets_encrypt_nginx.sh
Last active February 27, 2016 13:31
How To Secure Nginx with Let's Encrypt
# ------------------------
# CentOS
# @see https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-centos-7
# ------------------------
sudo yum install git bc
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
sudo systemctl stop nginx
netstat -na | grep ':80.*LISTEN'
firewall-cmd --add-port=443/tcp
cd /opt/letsencrypt