Archive for the ‘Linux’ Category
Install Debian Package *.deb
#dpkg -i webmin_2.202_all.deb
Sudo Users
root@server:/home/teee# apt-get install sudo
root@server:/etc# ee /etc/sudoers
#User privilege specification
root ALL=(ALL:ALL) ALL
sudo(user) ALL=(ALL:ALL) ALL
Test Login :
Login : (User)
$ sudo -s (User Password)
Debian Static IP
root@server:/# ee /etc/network/interfaces
allow-hotplug ens33
iface ens33 inet static
address 192.168.100.xx
netmask 255.255.255.0
gateway 192.168.100.1
dns-nameservers 8.8.8.8
root@server:/#systemctl restart networking.service
SSH Change Port and Allow Users
root@server:/etc/ssh# ee sshd_config
#Port (change this)
AllowUsers (User)
root@server:/etc/ssh# /etc/init.d/ssh reload
CentOS 7 Set time zone
[root@fs network-scripts]# ls -l /etc/localtime
lrwxrwxrwx. 1 root root 25 Nov 14 11:55 /etc/localtime -> ../usr/share/zoneinfo/UTC
[root@fs network-scripts]# timedatectl list-timezones
[root@fs network-scripts]# timedatectl set-timezone Asia/Bangkok
[root@fs network-scripts]# rm -rf /etc/localtime
[root@fs network-scripts]# ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
[root@fs network-scripts]# date
Fri Mar 11 14:52:19 +07 2022
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