Archive for the ‘Linux’ Category
Disable IPv6 in kernel module (requires reboot) CentOS7
Check IP V6 Interface
[root@fs teee]# ip addr show | grep net6
inet6 ::1/128 scope host
inet6 fe80::1097:73ff:fe6e:9d73/64 scope link
inet6 fe80::504d:83ff:fe2b:962/64 scope link
[root@fs teee]# ee /etc/default/grub
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL=”serial console”
GRUB_CMDLINE_LINUX=”ipv6.disable=1 crashkernel=auto rhgb quiet”
GRUB_SERIAL_COMMAND=”serial”
GRUB_CMDLINE_LINUX=”console=tty0 crashkernel=auto net.ifnames=0 console=ttyS0″
GRUB_DISABLE_RECOVERY=”true”
Rebuilt GRUB
[root@fs teee]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@fs teee]# ee /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
<SAVE>
[root@fs teee]# sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
SSH
[root@fs teee]# ee /etc/ssh/sshd_config
Port xxxx
AddressFamily inet
How To Install MariaDB on CentOS 7
[root@voice teee]# yum -y install mariadb-server mariadb.x86_64 mariadb-devel.x86_64 mariadb-libs.x86_64
[root@voice teee]# systemctl restart mariadb
[root@voice teee]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 31899/mysqld
[root@voice teee]# mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n] y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
[root@voice teee]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.00 sec)
[root@voice teee]# systemctl enable mariadb
[root@voice teee]# systemctl status mariadb
Configure a Postfix Relay through Gmail on CentOS
[root@fs ~]# yum -y install postfix cyrus-sasl-plain mailx
[root@fs ~]# ee /etc/postfix/main.cf
####### RELAY GMAIL ######
relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
[root@fs ~]# ee /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 bots@naitinoi.com:sana2455xxxx
[root@fs ~]# postmap /etc/postfix/sasl_passwd
[root@fs ~]# chown root:postfix /etc/postfix/sasl_passwd*
[root@fs ~]# chmod 640 /etc/postfix/sasl_passwd*
[root@fs ~]# service postfix restart
Shutting down postfix: [FAILED]
Starting postfix: [ OK ]
[root@fs ~]# echo “This is a test.” | mail -s “test message” mail@some.co.th
[root@fs ~]# ee /etc/aliases
root: testuser@naitinoi.com
[root@fs ~]# newaliases
FreeSwitch CentOS 6.x Installation
FreeSwitch CentOS 6.x Installation
REF. https://freeswitch.org/confluence/display/FREESWITCH/CentOS+6
[root@naitinoi ]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@naitinoi]# uname -r
2.6.32-504.16.2.el6.x86_64
Install Prerequisites
[root@naitinoi /]# rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@naitinoi /]# rpm -ivh http://mirror.cedia.org.ec/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@naitinoi /]# yum install git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel
Install FreeSWITCH
[root@naitinoi /]# cd /usr/src
[root@naitinoi src]# git clone -b v1.4 https://freeswitch.org/stash/scm/fs/freeswitch.git
Initialized empty Git repository in /usr/src/freeswitch/.git/
remote: Counting objects: 262168, done.
remote: Compressing objects: 100% (51716/51716), done.
remote: Total 262168 (delta 205126), reused 259999 (delta 203225)
Receiving objects: 100% (262168/262168), 113.54 MiB | 542 KiB/s, done.
Resolving deltas: 100% (205126/205126), done.
[root@naitinoi src]# cd /usr/src/freeswitch
[root@naitinoi freeswitch]# ./bootstrap.sh -j
# if you want to add or remove modules from the build, edit modules.conf
[root@naitinoi freeswitch]# ee modules.conf
#TEEE
say/mod_say_th
[root@naitinoi freeswitch]# ./configure -C
[root@naitinoi freeswitch]# make
[root@naitinoi freeswitch]# make install
Install Sounds
CD-Quality Sounds
[root@naitinoi freeswitch]# make cd-sounds-install
[root@naitinoi freeswitch]# make cd-moh-install
8KC Sounds
[root@naitinoi freeswitch]# make sounds-install
[root@naitinoi freeswitch]# make moh-install
Set Owner and Permissions
# create user ‘freeswitch’
# add it to group ‘daemon’
# change owner and group of the freeswitch installation
[root@naitinoi freeswitch]# cd /usr/local
[root@naitinoi local]# useradd –system –home-dir /usr/local/freeswitch -G daemon freeswitch
[root@naitinoi local]# passwd -l freeswitch
Locking password for user freeswitch.
passwd: Success
[root@naitinoi local]# chown -R freeswitch:daemon /usr/local/freeswitch/
[root@naitinoi local]# chmod -R 770 /usr/local/freeswitch/
[root@naitinoi local]# chmod -R 750 /usr/local/freeswitch/bin/*
[root@naitinoi local]# mkdir /var/run/freeswitch
[root@naitinoi local]# chown -R freeswitch:daemon /var/run/freeswitch
[root@naitinoi local]# ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/
Automatic Start At Boot
[root@naitinoi local]# cp /usr/src/freeswitch/build/freeswitch.init.redhat /etc/init.d/freeswitch
[root@naitinoi local]# chmod 750 /etc/init.d/freeswitch
[root@naitinoi local]# chown freeswitch:daemon /etc/init.d/freeswitch
[root@naitinoi local]# chkconfig –add freeswitch
[root@naitinoi local]# chkconfig –levels 35 freeswitch on
[root@naitinoi local]# service freeswitch restart
Shutting down freeswitch:
cannot stop freeswitch: freeswitch is not running. [FAILED]
Starting freeswitch: [ OK ]
[root@naitinoi local]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.10.10.21:5060 0.0.0.0:* LISTEN 27000/freeswitch
tcp 0 0 127.0.0.1:8021 0.0.0.0:* LISTEN 27000/freeswitch
tcp 0 0 10.10.10.21:5080 0.0.0.0:* LISTEN 27000/freeswitch
tcp 0 0 ::1:5060 :::* LISTEN 27000/freeswitch
tcp 0 0 ::1:5080 :::* LISTEN 27000/freeswitch
[root@naitinoi local]# cd /usr/local/freeswitch/
[root@naitinoi freeswitch]# ls -l
total 60
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:32 bin
drwxr-x— 2 freeswitch freeswitch 4096 Jun 1 00:59 certs
drwxrwx— 12 freeswitch daemon 4096 Jun 1 00:32 conf
drwxrwx— 2 freeswitch daemon 4096 Jun 1 01:00 db
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:32 grammar
drwxrwx— 3 freeswitch daemon 4096 Jun 1 00:32 htdocs
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:32 include
drwxrwx— 3 freeswitch daemon 4096 Jun 1 00:32 lib
drwxrwx— 4 freeswitch daemon 4096 Jun 1 00:59 log
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:32 mod
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:32 recordings
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:59 run
drwxrwx— 2 freeswitch daemon 4096 Jun 1 00:32 scripts
drwxrwx— 4 freeswitch daemon 4096 Jun 1 00:51 sounds
drwxr-x— 3 freeswitch freeswitch 4096 Jun 1 00:59 storage
[root@naitinoi bin]# cd /usr/bin
[root@naitinoi bin]# ln -s /usr/local/freeswitch/bin/fs_cli .
VNC SERVER-CentOS
[root@naitinoi ~]# yum -y install vnc-server tigervnc-server
[root@naitinoi ~]# mkdir .vnc
[root@naitinoi ~]# vncpasswd
Password:
Verify:
[root@naitinoi ~]# ee /etc/sysconfig/vncservers
# VNCSERVERS=”2:myusername”
# VNCSERVERARGS[2]=”-geometry 800×600 -nolisten tcp -localhost”
VNCSERVERS=”2:root”
VNCSERVERARGS[2]=”-geometry 800×600″
[root@naitinoi ~]# chkconfig vncserver on
[root@naitinoi ~]# /etc/init.d/vncserver start
Starting VNC server: 2:root xauth: creating new authority file /root/.Xauthority
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/xxxxxx.com:2.log
[ OK ]
allow firewall TCP 5902,6002
[root@naitinoi ~]# iptables -nvL
0 0 ACCEPT tcp — * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5902
0 0 ACCEPT tcp — * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:6002
DISABLE IPV6 (Debian)
root@fs18ast16:~# ee /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.enp0s3.disable_ipv6 = 1
root@fs18ast16:~# sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.enp0s3.disable_ipv6 = 1
root@fs:/home/teee# ee /etc/sysctl.d/70-disable-ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
root@fs:/home/teee# ee /etc/default/grub
GRUB_CMDLINE_LINUX=”ipv6.disable=1″