Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Yum repository

Yum Repository (Yellow dog Updater)

1) mount /dev/cdrom /mnt

2)touch /data

3)rsync -prav /mnt/CentOS/ /data

4)rpm -ivh /mnt/CentOS/Createrepo-0.4.11.3.el5.noarch.rpm

5)Createrepo /data

6)cd /etc/yum.repos.d/

7)touch local.repo

8)vi local.repo
ENtry,
[local]
name=local
baseurl=file:///data/
enabled=1
gpgcheck=0
:wq

9)yum install samba

How to Configure Primary DNS Server in redhat 6 Step by Step

How to Configure Primary DNS Server in redhat 6 Step by Step
Domain Name Server (DNS) Configuration and Administration

Domain Name System
The Domain Name System (DNS) is the crucial glue that keeps computer networks in harmony by converting human-friendly hostnames to the numerical IP addresses computers require to communicate with each other. DNS is one of the largest and most important distributed databases the world depends on by serving billions of DNS requests daily for public IP addresses. Most public DNS servers today are run by larger ISPs and commercial companies but private DNS servers can also be useful for private home networks. This article will explo

To Check IP
[root@www Desktop]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:84:6D:8C
inet addr:10.90.12.1 Bcast:10.90.12.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:6d8c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6624 errors:0 dropped:0 overruns:0 frame:0
TX packets:1474 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:442710 (432.3 KiB) TX bytes:1901220 (1.8 MiB)
Interrupt:19 Base address:0x2000

eth1 Link encap:Ethernet HWaddr 00:0C:29:84:6D:96
inet addr:10.23.151.66 Bcast:10.23.159.255 Mask:255.255.224.0
inet6 addr: fe80::20c:29ff:fe84:6d96/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13927 errors:0 dropped:0 overruns:0 frame:0
TX packets:7518 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9215651 (8.7 MiB) TX bytes:948169 (925.9 KiB)
Interrupt:19 Base address:0x2080

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)

To Set DNS Server IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0

EVICE=eth0
HWADDR=00:0c:29:84:6d:8c
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=10.90.12.1
BOOTPROTO=none
NETMASK=255.255.255.0
DNS=10.90.12.1
TYPE=Ethernet
IPV6INIT=no
USERCTL=no

save :wq

To Set Host Name
[root@station Desktop]# vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=station.example.com

save :wq

[root@station Desktop]# vim /etc/hosts
0.90.12.1 station.example.com station

save :wq

[root@station Desktop]# vim /etc/resolv.conf
search station.example.com
nameserver 10.90.12.1

save :wq

[root@station Desktop]# hostname station.example.com

[root@station Desktop]# hostname
station.example.com

To Install Package
[root@station Desktop]# yum install bind*
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository ‘yum’ is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Setting up Install Process
Package 32:bind-utils-9.7.3-8.P3.el6.i686 already installed and latest version
Package 32:bind-libs-9.7.3-8.P3.el6.i686 already installed and latest version
Resolving Dependencies
–> Running transaction check
—> Package bind.i686 32:9.7.3-8.P3.el6 will be installed
—> Package bind-chroot.i686 32:9.7.3-8.P3.el6 will be installed
—> Package bind-dyndb-ldap.i686 0:0.2.0-7.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
bind i686 32:9.7.3-8.P3.el6 yum 3.9 M
bind-chroot i686 32:9.7.3-8.P3.el6 yum 67 k
bind-dyndb-ldap i686 0.2.0-7.el6 yum 49 k

Transaction Summary
================================================================================
Install 3 Package(s)

Total download size: 4.0 M
Installed size: 7.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): bind-9.7.3-8.P3.el6.i686.rpm | 3.9 MB 00:00
(2/3): bind-chroot-9.7.3-8.P3.el6.i686.rpm | 67 kB 00:00
(3/3): bind-dyndb-ldap-0.2.0-7.el6.i686.rpm | 49 kB 00:00
——————————————————————————–
Total 20 MB/s | 4.0 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : 32:bind-9.7.3-8.P3.el6.i686 1/3
Installing : 32:bind-chroot-9.7.3-8.P3.el6.i686 2/3
Installing : bind-dyndb-ldap-0.2.0-7.el6.i686 3/3

Installed:
bind.i686 32:9.7.3-8.P3.el6 bind-chroot.i686 32:9.7.3-8.P3.el6
bind-dyndb-ldap.i686 0:0.2.0-7.el6

Complete!
[root@station Desktop]#

To Copy named.conf file
[root@station Desktop]# cp /etc/named.conf /var/named/chroot/etc/named.conf

To Change directory
cd /var/named/chroot/etc/

To edit configuration file
[root@station etc]#vim named.conf
options {
directory “/var/named”;
};

zone “example.com” IN {
type master;
file “for.zone”;
};

zone “12.90.10.in-addr.arpa” IN {
type master;
file “rev.zone”;
};

save :wq

To Change Group Name
[root@station etc]# chgrp named named.conf

To Copy File same Location
[root@station etc]# cp /var/named/named.localhost /var/named/chroot/var/named/for.zone
[root@station etc]# cp /var/named/named.loopback /var/named/chroot/var/named/rev.zone

To change directory
[root@station etc]# cd /var/named/chroot/var/named/

To edit configuration file
[root@station named]# vim for.zone
$TTL 1D
@ IN SOA example.com. root.example.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS station.example.com.
station IN A 10.90.12.1

save :wq

To edit configuration file
[root@station named]# vim rev.zone
$TTL 1D
@ IN SOA example.com. root.example.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS station.example.com.
1 IN PTR station.example.com.

save :wq

To Change Group Name
[root@station named]# chgrp named for.zone
[root@station named]# chgrp named rev.zone
[root@station named]# ll
total 8
-rw-r—–. 1 root named 190 Jun 1 19:12 for.zone
-rw-r—–. 1 root named 196 Jun 1 19:15 rev.zone
[root@station named]#

To Restart Service & On
[root@station named]# service named restart
Stopping named: [ rajesh ]
Starting named: [ rajesh ]

[root@station named]# chkconfig named on

To Check Named Server
[root@station named]# dig 10.90.12.1

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> 10.90.12.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- 23819="" br="" id:="" nxdomain="" opcode:="" query="" status:="">;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;10.90.12.1. IN A

;; AUTHORITY SECTION:
. 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2012060501 1800 900 604800 86400

;; Query time: 193 msec
;; SERVER: 113.193.1.14#53(113.193.1.14)
;; WHEN: Fri Jun 1 19:17:27 2012
;; MSG SIZE rcvd: 103

[root@station named]# dig station.example.com

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- 24133="" br="" id:="" noerror="" opcode:="" query="" status:="">;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;station.example.com. IN A

;; ANSWER SECTION:
station.example.com. 86400 IN A 10.90.12.1

;; AUTHORITY SECTION:
example.com. 86400 IN NS station.example.com.

;; Query time: 1 msec
;; SERVER: 10.90.12.1#53(10.90.12.1)
;; WHEN: Fri Jun 1 19:17:47 2012
;; MSG SIZE rcvd: 67

[root@station named]#

Client end Setting

[admin@station1]$vim /etc/resolve.conf

search station.example.com
nameserver 10.90.12.1
Save :wq
[admin@station1]$ dig station.example.com

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- 24133="" br="" id:="" noerror="" opcode:="" query="" status:="">;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;station.example.com. IN A

;; ANSWER SECTION:
station.example.com. 86400 IN A 10.90.12.1

;; AUTHORITY SECTION:
example.com. 86400 IN NS station.example.com.

;; Query time: 1 msec
;; SERVER: 10.90.12.1#53(10.90.12.1)
;; WHEN: Fri Jun 1 19:17:47 2012
;; MSG SIZE rcvd: 67
Enjoy……….!!!!!!

Getting a core dump out of CentOS 7.2

Getting a core dump out of CentOS 7.2

Since Systemd took over as the main init system in Red Hat Linux and derrivatives like CentOS, it has become more difficult to get a core dump out of a daemon application. The traditional approach of running ulimit -c unlimited before executing the binary works when running the application from the command line but does nothing for a daemon managed by Systemd’s unit files.

There is a lot of misleading information online about how to solve this so I thought I’d add a correct solution to the mix in the hope that it’s helpful.

The suggestions I found online include editing /etc/security/limits.conf, adding LimitCore=infinity to the Unit file, and messing around with /etc/systemd/coredump.conf. None of these methods work without customising the kernel configuration first.

Systemd is not configured to handle core dumps by default on CentOS (and by extension RHEL) distributions. The default behaviour is to write to the file core in the process’s working directory, which for daemons is often the root directory.

The obvious problem here is that the daemon probably doesn’t have write access to the root directory (if running as a non-root user). If is possible to change the working directory with the Systemd unit directive WorkingDirectory=/var/run/XXX. This is typically used with RuntimeDirectory=XXX, which creates and manages the lifecycle of /run/XXX (/var/run is a symlink to /run). Unfortunately, we can’t write the core file to a RuntimeDirectory because it gets deleted when the application terminates.

The simplest solution I found is to overwrite the kernel core_pattern setting. This can be edited at runtime by echoing a new value into /proc/sys/kernel/core_pattern:

echo /tmp/core-%e-sig%s-user%u-group%g-pid%p-time%t > /proc/sys/kernel/core_pattern
This will force the kernel to write all core files during the current OS uptime to /tmp with the filename pattern specified. The core manpage has more information on the syntax.

This change will be lost when the machine reboots. To effect the change at kernel startup, you need to edit /etc/sysctl.conf or a file in /etc/sysctl.d/.

kernel.core_pattern=/tmp/core-%e-sig%s-user%u-group%g-pid%p-time%t
Our solution at work was to write a script to create a file in /etc/sysctl.d/ at machine image creation time, so that the config is always there when we roll out to different environments (int, test, live etc.)

It should go without saying that there is no particular reason to use /tmp. The output can be redirected to any location the process has permission to write to. A network share may be more appropriate in some cases.

There may be another solution using systemd-coredump, but it is not part of this release of CentOS (7.2) and not in the yum repository at this time.

CentOS 6.9 Hadoop 2.7.2

CentOS 6.9 Hadoop 2.7.2

master 192.168.1.130
slave 192.168.1.131

master

[root@localhost ~]# vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost
192.168.1.130 master
192.168.1.131 slave

[root@localhost ~]# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.localdomain
NETWORKING=yes
HOSTNAME=master

slave

[root@localhost ~]# vi /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost
192.168.1.130 master
192.168.1.131 slave

[root@localhost ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NETWORKING=yes
HOSTNAME=slave

hostname your-hostname

selinux

master

[root@master ~]# vim /etc/selinux/config
SELINUX=enforcing

SELINUX=disabled

firewall

CentOS iptables

master

[root@master ~]# iptables -F; /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
iptables -nvL

master

[root@master ~]# ssh-keygen

master

[root@master ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@master ~]# scp ~/.ssh/authorized_keys slave:~/.ssh/
slave

[root@slave ~]# ls .ssh/
authorized_keys
master

[root@master ~]# ssh slave
[root@slave ~]# exit
[root@master ~]#

JDK

# java -version

[root@master ~]# wget http://download.Oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz?AuthParam=1480051498_4f2fdb0325a457f4c7d33a69355b3560

[root@master ~]# mv jdk-7u79-linux-x64.tar.gz\?AuthParam\=1480051498_4f2fdb0325a457f4c7d33a69355b3560 jdk-7u79-linux-x64.tar.gz
[root@master ~]# tar zxvf jdk-7u79-linux-x64.tar.gz
[root@master ~]# mv jdk1.7.0_79 /usr/local/

[root@master ~]# vi /etc/profile.d/java.sh

export JAVA_HOME=/usr/local/jdk1.7.0_79
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@master ~]# source /etc/profile.d/java.sh
[root@master ~]# java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

[root@master ~]# scp jdk-7u79-linux-x64.tar.gz slave:/root/
[root@master ~]# scp /etc/profile.d/java.sh slave:/etc/profile.d/
slave

[root@slave ~]# tar zxvf jdk-7u79-linux-x64.tar.gz
[root@slave ~]# mv jdk1.7.0_79 /usr/local/

[root@slave ~]# source /etc/profile.d/java.sh
[root@slave ~]# java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

Hadoop

master

[root@master ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.7.2/hadoop-2.7.2.tar.gz
[root@master ~]# tar zxvf hadoop-2.7.2.tar.gz
[root@master ~]# mv hadoop-2.7.2 /usr/local/
[root@master ~]# ls /usr/local/
bin games include lib libexec share etc hadoop-2.7.2 jdk1.7.0_79 lib64 sbin src
[root@master ~]# ls /usr/local/hadoop-2.7.2/
bin include libexec NOTICE.txt sbin etc lib LICENSE.txt README.txt share
[root@master ~]# mkdir /usr/local/hadoop-2.7.2/tmp /usr/local/hadoop-2.7.2/dfs /usr/local/hadoop-2.7.2/dfs/data /usr/local/hadoop-2.7.2/dfs/name
/usr/local/hadoop-2.7.2/tmp
/usr/local/hadoop-2.7.2/dfs?

[root@master ~]# ls /usr/local/hadoop-2.7.2/
bin etc lib LICENSE.txt README.txt share dfs include libexec NOTICE.txt sbin tmp
[root@master ~]# rsync -av /usr/local/hadoop-2.7.2 slave:/usr/local
slave

[root@slave ~]# ls /usr/local/hadoop-2.7.2
bin etc lib LICENSE.txt README.txt share dfs include libexec NOTICE.txt sbin tmp

Hadoop

master

[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/core-site.xml
fs.defaultFS
hdfs://master:9000
hadoop.tmp.dir
file:/usr/local/hadoop-2.7.2/tmp
io.file.buffer.size
131072

fs.defaultFS
NameNode ?HDFS MapReduce core-site.xml hdfs-site.xml

[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/hdfs-site.xml

dfs.namenode.name.dir
file:/usr/local/hadoop-2.7.2/dfs/name
dfs.datanode.data.dir
file:/usr/local/hadoop-2.7.2/dfs/data
dfs.replication
1
dfs.namenode.secondary.http-address
master:9001
dfs.webhdfs.enabled
true

[root@master ~]# mv /usr/local/hadoop-2.7.2/etc/hadoop/mapred-site.xml.template /usr/local/hadoop-2.7.2/etc/hadoop/mapred-site.xml
[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/mapred-site.xml

mapreduce.framework.name
yarn
mapreduce.jobhistory.address
master:10020
mapreduce.jobhistory.webapp.address
master:19888

[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/yarn-site.xml

yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.nodemanager.auxservices.mapreduce.shuffle.class
org.apache.hadoop.mapred.ShuffleHandler
yarn.resourcemanager.address
master:8032
yarn.resourcemanager.scheduler.address
master:8030
yarn.resourcemanager.resource-tracker.address
master:8031
yarn.resourcemanager.admin.address
master:8033
yarn.resourcemanager.webapp.address
master:8088

[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/hadoop-env.sh
export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=/usr/local/jdk1.7.0_79

[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/yarn-env.sh

export JAVA_HOME=/usr/local/jdk1.7.0_79

root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/mapred-env.sh
# export JAVA_HOME=/home/y/libexec/jdk1.6.0/
export JAVA_HOME=/usr/local/jdk1.7.0_79

[root@master ~]# vi /usr/local/hadoop-2.7.2/etc/hadoop/slaves
localhost
slave

[root@master ~]# rsync -av /usr/local/hadoop-2.7.2/etc/ slave:/usr/local/hadoop-2.7.2/etc/

[root@master ~]# vi /etc/profile.d/hadoop.sh

export HADOOP_HOME=/usr/local/hadoop-2.7.2
export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH

[root@master ~]# source /etc/profile.d/hadoop.sh
[root@master ~]# hadoop version
Hadoop 2.7.2
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r b165c4fe8a74265c792ce23f546c64604acf0e41
Compiled by jenkins on 2016-01-26T00:08Z
Compiled with protoc 2.5.0
From source with checksum d0fda26633fa762bff87ec759ebe689c
This command was run using /usr/local/hadoop-2.7.2/share/hadoop/common/hadoop-common-2.7.2.jar

[root@master ~]# scp /etc/profile.d/hadoop.sh slave:/etc/profile.d/
slave

hadoop

[root@slave ~]# source /etc/profile.d/hadoop.sh
[root@slave ~]# hadoop version
Hadoop 2.7.2
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r b165c4fe8a74265c792ce23f546c64604acf0e41
Compiled by jenkins on 2016-01-26T00:08Z
Compiled with protoc 2.5.0
From source with checksum d0fda26633fa762bff87ec759ebe689c
This command was run using /usr/local/hadoop-2.7.2/share/hadoop/common/hadoop-common-2.7.2.jar

Hadoop

master

[root@master ~]# /usr/local/hadoop-2.7.2/bin/hdfs namenode -format
[root@master ~]# echo $?
0

root@master ~]# /usr/local/hadoop-2.7.2/sbin/start-all.sh
[root@master ~]# jps
5560 ResourceManager
5239 NameNode
5631 Jps
5415 SecondaryNameNode
slave

[root@slave ~]# jps
5231 DataNode
5444 Jps
5320 NodeManager
master

web UI
master:50070 ?namenode datanode?
master:8088 ?Yarn?

[root@master ~]# cd /usr/local/hadoop-2.7.2/
[root@master hadoop-2.7.2]# bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar pi 1

[root@master ~]# /usr/local/hadoop-2.7.2/sbin/stop-all.sh

127.0.0.1 localhost
192.168.229.130 master
192.168.229.131 slave

copyFromLocal: Cannot create directory /123/. Name node is in safe mode

[root@master ~]# /usr/local/hadoop-2.7.2/bin/hdfs dfsadmin -safemode leave

postfix admin

This article mainly describes the postfix common command and mail queue management:

Postfix has the following four message queues, are managed by the management of the process of unified management:

maildrop: local mail placed in maildrop, but also copied to incoming.
incoming: Places messages that are arriving at the queue or managing the process that have not yet been discovered.
active: places the queue management process has been opened and is ready to deliver the message, the queue has a length limit.
deferred: Place messages that can not be delivered. May be delayed sending mail
Start postfix

/usr/sbin/postfix start
Stop postfix

/usr/sbin/postfix stop
Check the postfix configuration file

/usr/sbin/postfix check
Displays the configuration information that Postfix currently takes effect

postconf -n
Re-read the postfix configuration file

/ usr / sbin / postfix reload
View messages in the queue:

mailq
postqueue -p
View the queue size

mailq | wc – l
postqueue -p | wc -l
View the contents of the message

postcat -q Queue_ID
Force the sending of messages in the queue

/ usr / sbin / postfix flush
postqueue -f
Suspended sending messages in the queue

postsuper – h Queue_ID
postsuper- h ALL deferred
Unblock sent messages

postsuper – H Queue_ID
postsuper -H ALL deferred
Rejoining the queue:

postsuper – r Queue_ID
postsuper -r ALL
Delete the specified message

postsuper -d Queue_ID
Empty the messages in the queue

postsuper -d ALL
# Delete the message in the queue (in the deferred list of messages, delete the mail file directly, you can see which letters were deleted):

postsuper – d ALL deferred
find / var / spool / postfix / deferred -type f -exec rm – vf {} \;
# find / var / spool / postfix / defer -type f -exec rm -vf {} \;
List all problem mail (currently all messages that can not be sent)

find / var / spool / postfix / deferred -type f -exec ls -l – time -style = +% Y-% m-% d_% H:% M:% S {} \;
Delete messages that have not been sent for 3 days

find / var / spool / postfix / deferred -type f -mtime + 3 -exec rm -f {} \;
Delete bounce records for more than 5 days of mail (more than 5 days in the “defer” list)

find /var/spool/postfix/defer -type f -mtime + 5 -exec rm -f {} \;

# Here are some related logs

View the system log:

tail -f / var / log / messages
Check the e-mail log: basically very comprehensive, almost all of the mail problems encountered can be handled by the log

tail -f / var / log / maillog
maildrop related

tail -f /var/log/maildrop.log
clamd related

tail -f / var / log / clamav / clamd.log
tail -f /var/log/clamav/freshclam.log

Mariadb centos 7.4

Mariadb centos 7.4

vi /etc/yum.repos.d/Mariadb.repo

# MariaDB 10.1 CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

yum -y install MariaDB-server MariaDB-client

systemctl start mysql.service

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] n

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y

firewall

firewall-cmd –state

not running?firewall

systemctl start firewalld

running

3306
firewall-cmd –zone=public –add-port=3306/tcp –permanent
firewall-cmd –reload

2. root MariaDB

Mariadb
mysql -uroot -p
use mysql;
Grant all on *.* to ‘root’@’%’ identified by ‘root@test123’ with grant option;
flush privileges;

Docker issue x509: certificate has expired or is not yet valid

root@clusterserver3 ~]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos …
Pulling repository docker.io/library/centos
Error while pulling image: Get https://index.docker.io/v1/repositories/library/centos/images: x509: certificate has expired or is not yet valid
[root@clusterserver3 ~]# update-ca-trust extract

RabbitMQ installation deployment

RabbitMQ installation deployment

This article mainly introduces the installation of rabbitmq-server-3.6.12 deployment

# Check if the old version of the software has been installed

rpm-qa | grep erlang
rpm -qa | grep rabbitmq
# If yum installed before the rabbitmq may have the old version of the software, you need to uninstall and then install

yum remove erlang-R14B erlang-erts -y
# Configure rabbitmq required yum source (epel source)

su -c ‘ rpm -Uvh http: // download. Fedora project.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ‘
# Install the specified version of rabbitmq

wget http: // www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el6.x86_64.rpm
wget http: // www.rabbitmq.com/releases/rabbitmq-server/v3.6.12/rabbitmq -server-3.6.12-1.el6.noarch.rpm
yum install erlang- 19.0 . 4 – 1 .el6.x86_64.rpm – y
yum install rabbitmq-server- 3.6 . 12 – 1 .el6.noarch.rpm -y
# Start rabbitmq and configure the boot from the start

service rabbitmq- server start
ps -ef | grep rabbitmq
chkconfig rabbitmq – server on
chkconfig –list rabbitmq-server
# Set the rabbitmq enabled feature

rabbitmq- plugins enable rabbitmq_management
service rabbitmq -server restart
# The default user password for the guest, you can create a new rabbitmq user and authorize

rabbitmqctl add_user admin 123456
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p ” / ” admin ” . * ” ” . * ” ” . * ”
# Create other users nice

rabbitmqctl add_user nice 123456
rabbitmqctl add_vhost nice
rabbitmqctl set_user_tags nice administrator
rabbitmqctl set_permissions -p ” nice ” nice ” . * ” ” . * ” ” . * ”
Can visit: http: // IP: 15672

complete

CentOS7 install iptables firewall

CentOS 7 default firewall is not iptables, but firewall

Install iptable iptable-service

# First check whether the installation of iptables
service iptables status
# install iptables
yum install-y iptables
# upgrade iptables
yum update iptables
# install iptables-services
yum install iptables-services

Disable / stop the built-in firewalld service

# Stop the firewalld service
systemctl stop firewalld
# Disable the firewalld service
systemctl mask firewalld

Set up existing rules

# View iptables existing rules
iptables -L-n
# first allow all, otherwise there may be a cup
iptables -P INPUT ACCEPT
# clear all default rules
iptables-F
# clear all custom rules
iptables-X
# all counters 0
iptables -Z
# Allows packets from the lo interface (local access)
iptables -A INPUT -i lo -j ACCEPT
# open 22 port
iptables -A INPUT -p tcp -dport 22 -j ACCEPT
# open 21 port (FTP)
-A -p TCP –dport the INPUT iptables 21 is -j ACCEPT
# open port 80 (the HTTP)
iptables -A 80 –dport the INPUT -p TCP -j ACCEPT
# open port 443 (the HTTPS)
iptables -A the INPUT -p TCP – -dport 443 -j ACCEPT
# Allow ping
iptables -A INPUT -p icmp –icmp-type 8 -j ACCEPT
# Allow the return data after the native request RELATED, which is set for FTP
iptables -A INPUT -m state –state RELATED, ESTABLISHED -j ACCEPT
# other inbound discarded
iptables -P INPUT DROP
# all outbound all green
iptables -P OUTPUT ACCEPT
# all forwarded
iptables -P FORWARD DROP

Other rules set

Iptables -P INPUT
-p tcp -s 45.96.174.68 -j ACCEPT
# Filter all requests that are not above rules
iptables -P INPUT DROP
# To block an IP, if you want to add an intranet ip trusted (accept all of its TCP requests) Use the following command:
iptables -I INPUT -s ***. ***. ***. *** -j DROP
# To unblock an IP, use the following command:
iptables -D INPUT -s * **. ***. ***. *** -j DROP

Save the rule settings

# Save the above rules
service iptables save

Open the iptables service

# Register iptables service
# equivalent to the previous chkconfig iptables on
systemctl enable iptables.service
# Open service
systemctl start iptables.service
# View status
systemctl status iptables.service

Solve vsftpd iptables open, can not use the passive mode of the problem

1. First modify or add the following in / etc / sysconfig / iptables-config

# Add the following, note that the order can not be exchanged
IPTABLES_MODULES = “ip_conntrack_ftp”
IPTABLES_MODULES = “ip_nat_ftp”

2. Reset the iptables settings

iptables -A INPUT -m state –state RELATED, ESTABLISHED -j ACCEPT

The following is a complete setup script

#! / bin / SH
iptables -P the INPUT ACCEPT
iptables -F
iptables the -X-
iptables the -Z
iptables -A the INPUT LO -i -j ACCEPT
iptables -A –dport 22 is the INPUT -p TCP -j ACCEPT
iptables -A the INPUT -p tcp –dport 21 -j ACCEPT
iptables -A INPUT -p tcp –dport 80 -j ACCEPT
iptables -A INPUT -p tcp –dport 443 -j ACCEPT
iptables -A INPUT -p icmp –icmp-type 8 – j ACCEPT
iptables -A INPUT -m state –state RELATED, ESTABLISHED -j ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
service iptables save
systemctl restart iptables.service

CentOS 7 installs MySQL5.7.19

Environment: Virtual Machine + CentOS 7

1. download binary package, the following mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz link is the official website

cd /usr/local/src

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
2. extract, rename

[root@beta src]# tar zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz

[root@beta src]# ls
index.html?id=471614 mysql-5.7.19-linux-glibc2.12-x86_64 mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
[root@beta src]# mv mysql-5.7.19-linux-glibc2.12-x86_64 /usr/local/mysql
3. Initialize

[root@beta mysql]# useradd -M -s /sbin/nologin mysql

[root@beta mysql]# ls
bin COPYING docs include lib man README share support-files
[root@beta mysql]# mkdir -p /usr/local/mysql/data/mysql
[root@beta mysql]# chown mysql /usr/local/mysql/data/mysql
The following step attention to the last sentence:

[root@beta mysql]# ./bin/mysqld –initialize –user=mysql –datadir=/usr/local/mysql/data/mysql
2017-09-27T03:44:47.999985Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use –explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-27T03:44:49.011240Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-09-27T03:44:49.180334Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-09-27T03:44:49.245777Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3649ce8c-a336-11e7-a43f-000c292b2832.
2017-09-27T03:44:49.266053Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2017-09-27T03:44:49.268172Z 1 [Note] A temporary password is generated for root@localhost: ADB&yGx-d8ab

ADB&yGx-d8ab
Then execute:

[root@beta mysql]# ./bin/mysql_ssl_rsa_setup –datadir=usr/local/mysql/data/mysql
Generating a 2048 bit RSA private key
………………….+++
…+++
writing new private key to ‘ca-key.pem’
—–
Generating a 2048 bit RSA private key
…………………….+++
…………………………………………………………………….+++
writing new private key to ‘server-key.pem’
—–
Generating a 2048 bit RSA private key
………………..+++
…………………..+++
writing new private key to ‘client-key.pem’
4. Copy the configuration file and startup script

First check whether there is /etc/my.cnf, if not

cp support-files/my-default.cnf /etc/my.cnf
Edit /etc/my.cnf, focus on the following changes, the other as far as possible comment out:

basedir = /usr/local/mysql
datadir = //usr/local/mysql/data/mysql
socket = /tmp/mysql.sock
2. Start the script

cp support-files/mysql.server /etc/init.d/mysqld
Edit /etc/init.d/mysqld, only modify the following:

basedir=/usr/local/mysql
datadir=/data/mysql
Add /etc/init.d/mysqld to the startup item:

[root@beta mysql]# chkconfig –add mysqld
[root@beta mysql]# chkconfig –list

systemd ‘systemctl list-unit-files’?
target
systemctl list-dependencies [target]?

5. Start the service

/etc/init.d/mysqld start
6. Set the root password

Log in with the initial password (see step 3 above)

/usr/local/mysql/bin/mysql -uroot -p‘’ #-p?’’
Appears mysql>, enter set password = password (‘new password’);

Exit, login with new password

2. Forget the initial password

To /etc/my.cnf/[mysqld] Add a line below skip-grant-tables, restart mysqld: /etc/init.d/mysqld restart

[mysqld]
skip-grant-tables
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data/mysql
socket=/tmp/mysql.sock

[root@beta ~]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
Re-login mysql:

[root@beta ~]# /usr/local/mysql/bin/mysql -uroot
mysql> enter: update mysql.user set authentication_string = password (‘123333’) where user = ‘root’;

mysql> update mysql.user set authentication_string=password(‘123333′) where user=’root’;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
Quit, delete my.cnf added skip-grant-tables, restart mysqld

New password re-login mysql:

[root@beta ~]# /usr/local/mysql/bin/mysql -uroot -p’123333′
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

Page 5 of 164« First...34567...102030...Last »