This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### This walkthrough has been tested on Ubuntu Linux 22.04 LTS for xfs filesystem | |
### Reference: https://www.cyberciti.biz/faq/howto-add-disk-to-lvm-volume-on-linux-to-increase-size-of-pool | |
# df -h | grep -v tmpfs | |
Filesystem Size Used Avail Use% Mounted on | |
/dev/mapper/VG_SERVER-LV_ROOT 45G 7.9G 38G 18% / | |
/dev/sda2 974M 374M 533M 42% /boot | |
# lvs | |
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### This bash script below has been tested on Oracle Linux 8 | |
### Put these 3 lines in the bottom file of your ~/.bashrc | |
export SERVER_NAME="[MyServerName] " | |
export PS0='\[\e[1;33m\]└─ exec @ \D{%F %T%z} $(eval printf %.0s─ '{36..'"${COLUMNS:-$(tput cols)}"\}; echo)\[\e[m\]\n' | |
export PS1="\n\[\e[1;33m\]┌$(eval printf %.0s─ '{2..'"${COLUMNS:-$(tput cols)}"\}; echo)\n├─ \h ($(eval hostname -I|cut -f1 -d' ')) ${SERVER_NAME}@ \w\n├─ \[\e[1;36m\]\u \\$\[\e[m\] " | |
### Adjust env SERVER_NAME, save and execute command below | |
$ source ~/.bashrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GMapsDECtoDMS($latitude, $longitude) { | |
// $latitude and $longitude must be a float value | |
// e.g. National Monument (-6.175413294875829, 106.82718181252345) | |
$latitudeDirection = $latitude < 0 ? 'S': 'N'; | |
$longitudeDirection = $longitude < 0 ? 'W': 'E'; | |
$latitudeNotation = $latitude < 0 ? '': ''; | |
$longitudeNotation = $longitude < 0 ? '': ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### nginx http upstream with fallback if upstream return http error page ### | |
### https://www.digitalocean.com/community/tools/nginx | |
# upstream members of soa | |
upstream soa { | |
server 11.22.33.41:1234 max_fails=1 fail_timeout=1m; | |
server 11.22.33.42:1234 max_fails=1 fail_timeout=1m; | |
server 11.22.33.43:1234 max_fails=1 fail_timeout=1m backup; | |
server 11.22.33.44:1234 max_fails=1 fail_timeout=1m backup; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Disable weak SSH ciphers in Linux ### | |
# check ssh ciphers, macs, and kexalgorithms | |
sshd -T | grep "\(ciphers\|macs\|kexalgorithms\)" | |
# edit sshd_config | |
nano /etc/ssh/sshd_config | |
# add following conf lines into most bottom of sshd_config file | |
Ciphers [email protected],[email protected],aes256-ctr,aes128-ctr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Disable ICMP Timestamp Response Ubuntu LTS ### | |
# sysctl disable tcp_timestamps | |
echo 0 > /proc/sys/net/ipv4/tcp_timestamps && \ | |
echo "net.ipv4.tcp_timestamps = 0" > /etc/sysctl.d/tcp_timestamps.conf && \ | |
sysctl -p && \ | |
sysctl -a | grep "net\.ipv4\.tcp_timestamps" | |
# open icmp to specified segment | |
iptables -A INPUT -s 10.10.0.0/16 -p icmp -m icmp --icmp-type 8 -j ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Updating glibc, libstdc++, and gcc on RHEL / CentOS 6 ### | |
# https://code.visualstudio.com/docs/remote/linux#_updating-glibc-and-libstdc-on-rhel-centos-6 | |
# https://serverkurma.com/linux/how-to-update-glibc-newer-version-on-centos-6-x/ | |
# https://gist.github.com/harv/f86690fcad94f655906ee9e37c85b174 | |
# https://copr.fedorainfracloud.org/coprs/mosquito/myrepo-el6/ | |
# WARNING !!! | |
# Do not run this script on anything mission critical without a rollback strategy | |
# since it does update libraries that other applications depend on. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### COMPILE NGINX 1.20.1 RHEL/(CentOS?) 6 ### | |
# installing dependencies | |
yum install git yum-utils gcc gcc-c++ pcre-devel zlib-devel make unzip libuuid-devel \ | |
openssl-devel libxml2-devel libxslt-devel libgcrypt-devel libgpg-error-devel \ | |
pcre pcre-devel geoip-devel cpp gd-devel | |
# install glibc | |
wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm \ | |
https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### COMPILE PHP 8.0 RHEL/(CentOS?) 6 ### | |
# You can find PHP 8.0 repository here: | |
# https://pkgs.dyn.su/el6-extras/x86_64 | |
# installing dependencies | |
# https://coderwall.com/p/ggmpfa/php-configuration-error-and-solutions-in-rpm | |
yum install -y autoconf autotools gmp-devel libcurl-devel postgresql postgresql-devel sqlite sqlite-devel \ | |
libxslt-devel net-snmp-devel readline-devel aspell aspell-devel unixODBC-devel libicu-devel libc-client-devel \ | |
freetype-devel libXpm-devel libpng-devel libvpx-devel enchant-devel libmcrypt-devel libmemcached-devel \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Install Let's Encrypt with ACME.sh in Nginx ### | |
# clone acme (as root) | |
git clone https://github.com/acmesh-official/acme.sh.git && \ | |
cd acme.sh && \ | |
./acme.sh --install -m [email protected] | |
# create cert ---------------------------------------------------------------------- | |
# acme.sh is an alias for /root/.acme.sh/acme.sh |
NewerOlder