Tuesday, June 5, 2018

locale debian

export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

Monday, June 4, 2018

Change force ssl roundcude

Change parameter force_https in path /opt/www/roundcubemail/config/config.inc.php

Monday, April 30, 2018

Setup OpenVPN

Server
1. Install openvpn
apt-get install openvpn

2. Install easy-rsa
apt-get install easy-rsa

3. Config easy-rsa

4. Config openvpn

Client
1. Install openvpn

2. Config openvpn

Tuesday, March 27, 2018

Install pgadmin4 on Ubuntu

apt-get install virtualenv python-pip libpq-dev python-dev

wget whl file

mkdir pgadmin4

cd pgadmin4

virtualenv .

source bin/activate

pip install whlfile

echo "SERVER_MODE = False" >> lib/python2.7/site-packages/pgadmin4/config_local.py

sudo -s

mkdir /var/lib/pgadmin

mkdir /var/log/pgadmin

chmod gbsofts:gbsofts /var/lib/pgadmin

chmod gbsofts:gbsofts /var/log/pgadmin

exit


Create desktop icon
nano pgadmin4.desktop
#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=gnome-panel-launcher
Name[en_US]=PgAdmin4
Exec=bash /home/gbsofts/pgadmin4/pgadmin4.sh
Name=PgAdmin4
Icon=/home/gbsofts/pgadmin4/logo-128.png

chmod 755 pgadmin4.desktop

Create script
nano pgadmin4.sh
cd $HOME/pgadmin4
source bin/activate
python ./lib/python2.7/site-packages/pgadmin4/pgAdmin4.py  &
sleep 5; chromium-browser --app=http://localhost:5050

Monday, February 12, 2018

Enable socket admin Haproxy

The stats socket is not enabled by default. In order to enable it, it is
necessary to add one line in the global section of the haproxy configuration.
A second line is recommended to set a larger timeout, always appreciated when
issuing commands by hand :

    global
        stats socket /var/run/haproxy.sock mode 600 level admin
        stats timeout 2m

It is also possible to add multiple instances of the stats socket by repeating
the line, and make them listen to a TCP port instead of a UNIX socket. This is
never done by default because this is dangerous, but can be handy in some
situations :

    global
        stats socket /var/run/haproxy.sock mode 600 level admin
        stats socket ipv4@192.168.0.1:9999 level admin
        stats timeout 2m

Saturday, October 21, 2017

Free SSL Certificate with Let's Encrypt


1. Install git
apt-get install git

2. Create Let's Encrypt source directory
mkdir /opt/letsencrypt

3. Clone source of Let's Encrypt
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

4. Stop web server (apache, tomcat, nginx...) because they can cause of port 443 error

5. Create certificate for specified domain
cd /opt/letsencrypt 
./letsencrypt-auto certonly --standalone -d example.com -d www.example.com

6. All certificates have created in /etc/letsencrypt/live

7. Config fullchain.pem for certificate file, privkey.pem for key file

For HaProxy, create .pem file
cat fullchain.pem privkey.pem > secure.pem

By default, Let's Encrypt issue certificate valid for 90 days, so we need config automatically renew it

1. create auto_renew_cert.sh file as below:
cd /opt/letsencrypt
git pull
service nginx stop
./letsencrypt-auto certonly --quiet --standalone --renew-by-default -d example.com
service nginx start


2.  execute it in crontab monthly
echo '@monthly root sh /root/auto_renew_cert.sh >> /var/log/letsencrypt/letsencrypt-auto-update.log' | sudo tee --append /etc/crontab





Saturday, June 24, 2017

Portable Postgres

Postgres full extension 9.6.3 on Debian 8 64bit 
https://drive.google.com/open?id=0B30EeVPAcvhvWHpMNDZmbFdNYVk