Posts

How to enable swap-drive on linux

Image
in my post, How to enable swap-drive on linux. The solve problem "Swap Not working" on linux such as centos, Fedora 25.  The open terminal, to check status of swap space ( as run root account) . swapon -s lsblk As the content below NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT sr0     11:0    1  1024M  0 rom sda      8:0    0 465.8G  0 disk ├─sda4   8:4    0 202.1G  0 part ├─sda2   8:2    0 105.9G  0 part / ├─sda5   8:5    0  12.9G  0 part [SWAP] ├─sda3   8:3    0     1K  0 part ├─sda1   8:1    0   487M  0 part └─sda6   8:6    0 144.4G  0 part /media/installed To turn on swap-drive /dev/sda5 swapon /dev/sda5 To make this permanent start-up on the system vim /etc/fstab  As the content below /dev/sda5 swap swap defaults 0 0 To check, if swap drive that work! free -h As the content below               total        used        free      shared  buff/cache   available Mem:           3.6G        2.2G        123M        321M        1.3G        

zimbra 8.6 cbpolicyd example

Image
Links to below you maybe likes: How to zimbra enforce spf checking for incomming email How to use cbpolicyd to configure 120 message from sender in last 30s. in order configure in zimbra cbpolicyd policies -->policy_members -->quotas -->quotas_limits To create zimbra-example.sql file BEGIN TRANSACTION; INSERT INTO "policies" (ID,Name,Priority,Description) VALUES(6,'Example CBPolicyd Policies', 0, 'Example CBPolicyd Policies'); INSERT INTO "policy_members" (ID,PolicyID,Source,Destination) VALUES(10,6, 'user@domain', '!%internal_domains'); INSERT INTO "quotas" (ID,PolicyID,Name,Track,Period,Verdict,Data) VALUES (14,10, 'Sender:user@domain','Sender:user@domain', 30, 'REJECT', 'Rejected from CBPolicyd: Too many messages from sender in last 30s'); INSERT INTO "quotas_limits" (ID,QuotasID,Type,CounterLimit) VALUES(16,14, 'MessageCount', 120); COMMIT; To

screen command on linux

To install screen on linux For centos/RHEL base system sudo yum install screen -y For ubuntu base system sudo apt-get install screen -y screen command useful for wget,ryncs not lose session, when you detach it. For example, create the screen with title $ screen -t 'zimbra' ssh [email protected] pressing "ctrl+a" n: next the screen (switch between screen) pressing "ctrl+a" p: previous the screen (switch between screen) pressing "ctrl+a" x : lock the screen pressing "ctrl+a" k: kill the screen pressing ctrl+a d : deattach To list the screen [huupv@huupv ~]$ screen -ls There is a screen on:     31083.pts-0.huupv    (Detached) 1 Socket in /var/run/screen/S-huupv. To resume the screen screen -r 31083 How to deattached screen with Attached status [huupv@localhost]$ screen -ls The output There is a screen on: 20655.pts-4.ra3 (Attached)1 Socket in /var/run/screen/S-huupv. [huupv@localhost]$ screen -r -d 20655.pts-4.ra3 Error

How to install ibus-bogo on fedora 25

Image
How to install ibus-bogo on fedora 25. I'm running commands as privileged ! To download ibus-bogo-0.4-12.fc26.noarch.rpm wget https://kojipkgs.fedoraproject.org//packages/ibus-bogo/0.4/12.fc26/noarch/ibus-bogo-0.4-12.fc26.noarch.rpm To install ibus-bogoon fedora 25 sudo rpm -ivh ibus-bogo-0.4-12.fc26.noarch.rpm  To configure ibus-bogo on fedora 25 ibus-daemon & ibus restart ibus-setup  Note: for program writen QT, example: skype... vim ~/.bash_profile The content as following: export GTK_IM_MODULE=ibus export QT4_IM_MODULE=xim export QT_IM_MODULE=xim export XMODIFIERS=@im=ibus To after, logout and login. Thanks for reading!

How to install mediawiki on centos 6

Image
Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat How to install mediawiki on centos 6 To require nginx php MySQL Step 1: To update and install epel repo, ntpd #yum update -y #yum install -y epel-release #yum install -y ntp #chkconfig ntpd on #ntpdate pool.ntp.org #service ntpd start Step 2: To install the dependencies #yum install gd sendmail gcc pcre yum-utils wget Step 3:  To install php7 for nginx remi centos 6 Step 4: To install ImageMagick #yum install php-mbstring php-fpm php-devel php-mysql php-pear ImageMagick ImageMagick-devel --enablerepo=remi-php70 #pecl install imagick #echo "extension=imagick.so" > /etc/php.d/imagick.in Step 5: To enable module php-mbstring for nginx #find / -name mbstring.so The result /opt/remi/php70/roo

Linux basic commands

Linux basic commands How to check version Ubuntu lsb_release -a How to check to distribute cat /etc/*release How to check CPU information cat /proc/cpuinfo How to check PCI devices lspci How to list all USB devices lsusb How to get PC name from IP nmblookup -A <ip> nbtscan <ip> How many connect on server who -H How many core processor nproc How to check full CPU information lscpu  How to create new user adduser huupv passwd huupv For centos usermod -aG wheel huupv For ubuntu echo "huupv ALL=(ALL) ALL" >> /etc/sudoers How to find UUID disk blkid /dev/sda6 lsblk -f To continuous....

How to install php7 on centos 6

Image
How to install php7 on centos 6, I'm use remi repo to install remi-php70. I'm running commands as root account. To install php7  yum install wget yum-utils wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm yum-config-manager --enable remi-php70 yum install php --enablerepo=remi-php70 To check for available repositories yum repolist For example: To install php7 for nginx ( Due to, nginx use php-fpm and php-mysql) yum install php-fpm php-mysql --enablerepo=remi-php70 Thanks for reading! How to install php7 on centos 6

How to install and configure redmine on centos 6

Image
How to install and configure redmine on centos 6. I'm running commands as root account! Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat To require install redmine on centos 6 CentOS is installed and works Nginx   is installed and works MySQL is installed and works Your are logged as root To install the the dependence packages yum update yum install -y wget gcc gcc-c++ mysql-server mysql-devel openssl-devel readline-devel zlib-devel curl-devel libxslt-devel pcre ImageMagick-devel yum install -y epel-release  yum install -y ntp chkconfig ntpd on ntpdate pool.ntp.org service ntpd start To install ruby on centos 6 cd /usr/local/src/ wget -qO- https://cache.ruby-lang.org/pub/ruby/stable/ruby-2.3.4.tar.gz | tar xvz cd ruby-2.3.4/ ./configure --disable-inst

How to send email using mail command in linux

Image
in my post, i'm use mail command to send message email. mail -s "Subject title huuphan.com" -S [email protected] <<EOF ---------------------------------------- The content email Hello phan van huu My site: huuphan.com ----------------------------------------- EOF The script sending 100 email from command. #!/bin/sh i=1 for (( i = 1 ; i <= 100 ; i++ )); do  echo "Test Mail $i, Send from mail.huuphan.com" | mailx -v -r "[email protected]" -s "Test Mail $i" -a "/tmp/quotausage" -S smtp="mail.huuphan.com:25" -S smtp-auth=login -S smtp-auth-user="[email protected]" -S smtp-auth-password="123456789" -S ssl-verify=ignore -S nss-config-dir=/etc/ssl/certs [email protected],[email protected] done

Log file zimbra script

Image
The function read /var/log/zimbra.log use bash script. To input 1. FILE1=/var/log/zimbra.log 2. FOLDER=/tmp/test 2. NUMBER=/tmp/test/number.txt file To output TEMP_LOG=$FOLDER/tmp_zimbra.log Function f_check_folder to check folder existing yes or no. f_check_folder () {         if [[ -d $FOLDER ]]; then                 if [[ ! -s $NUMBER ]]; then                         touch $NUMBER                         echo 0 > $NUMBER                 fi         else                 mkdir -p $FOLDER                 touch $NUMBER                 echo 0 > $NUMBER         fi } Function f_get_log read /var/log/zimbra.log file f_get_log () {         NUM=`cat $NUMBER`         SUM=`expr "$NUM" + 1`         tail -n +"$SUM" $FILE1 > $TEMP_LOG         echo `wc -l < $FILE1` > $NUMBER }