2018년 11월 29일 목요일

[APACHE] failed No route to host

[APACHE] failed No route to host



[root@vps ~]# wget http://www.example.com:8080
--2018-11-29 10:37:56--  http://www.example.com:8080/
Resolving www.example.com (www.example.com)... xxx.xxx.xxx.xxx
Connecting to www.example.com (www.example.com)|xxx.xxx.xxx.xxx|:8080... failed: No route to host.

/etc/sysconfig/iptables add rule

-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT

2018년 11월 16일 금요일

[MySQL] Unknown collation utf8mb4_unicode_520_ci

[MySQL] Unknown collation utf8mb4_unicode_520_ci



ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_unicode_520_ci'

CREATE TABLE `wp_commentmeta` (
  `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `comment_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  `meta_value` longtext COLLATE utf8mb4_unicode_520_ci,
  PRIMARY KEY (`meta_id`),
  KEY `comment_id` (`comment_id`),
  KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

Swapping
    utf8mb4_unicode_520_ci => utf8_general_ci

ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
=>
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;


2018년 11월 15일 목요일

[CentOS] How to restore Factory setting

[CentOS] How to restore Factory setting



# yum history list all
Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    22 | root <root>              | 2018-10-19 15:13 | Update         |    7
    21 | root <root>              | 2018-09-11 14:07 | Install        |   10
    20 | root <root>              | 2018-09-11 14:07 | Erase          |    8
    19 | System <unset>           | 2018-09-11 10:24 | Update         |    3
    18 | root <root>              | 2017-12-07 10:07 | Install        |    1
    17 | root <root>              | 2017-11-24 12:26 | Install        |    1
    16 | root <root>              | 2017-11-24 12:25 | Install        |    2
    15 | root <root>              | 2017-11-24 12:23 | Install        |    2
    14 | root <root>              | 2017-11-24 12:22 | Install        |    6
    13 | root <root>              | 2017-11-05 09:48 | Install        |   22
    12 | root <root>              | 2017-10-29 10:44 | Install        |    1
    11 | root <root>              | 2017-10-29 10:36 | I, O, U        |   41
    10 | root <root>              | 2017-10-29 10:36 | Install        |    5
     9 | root <root>              | 2017-10-29 00:20 | Install        |   18
     8 | root <root>              | 2017-10-29 00:20 | Install        |   30
     7 | root <root>              | 2017-10-29 00:19 | Update         |    1 EE
     6 | root <root>              | 2017-10-17 16:54 | Install        |    3
     5 | root <root>              | 2017-10-17 16:52 | Install        |  218 EE
     4 | root <root>              | 2017-10-17 16:51 | Update         |    3
     3 | root <root>              | 2017-09-20 13:54 | Install        |    1
     2 | root <root>              | 2017-09-20 13:52 | I, U           |   28
     1 | System <unset>           | 2017-09-14 12:20 | Install        |  291
history list

# yum history info 22

# yum -y history undo 22
# yum -y history undo 21
# yum -y history undo ...
# yum -y history undo 1

2018년 11월 9일 금요일

윈도우10 안쓰는 기본앱 제거하기

윈도우10 안쓰는 기본앱 제거하기


윈도우 기본적으로 설치된 앱 중에서 사용하지 않으면서 용량을 차지하는 앱들이 있습니다.
물론 얼마되지 않는 사이즈이지만 조금이나마 C 드라이브 공간을 늘이는 방법입니다.

PowerShell 을 관리자권한으로 실행해서 아래 명령어로 삭제하면 됩니다.

계산기
Get-AppxPackage *windowscalculator* | Remove-AppxPackage
날씨
Get-AppxPackage *bingweather* | Remove-AppxPackage
메일 및 일정
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
윈도우폰
Get-AppxPackage *windowsphone* | Remove-AppxPackage
3D빌더
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
알람 및 시계
Get-AppxPackage *windowsalarms* | Remove-AppxPackage
카메라
Get-AppxPackage *windowscamera* | Remove-AppxPackage
영화 및 TV
Get-AppxPackage *zunevideo* | Remove-AppxPackage
오피스
Get-AppxPackage *officehub* | Remove-AppxPackage
음성 녹음기
Get-AppxPackage *soundrecorder* | Remove-AppxPackage
시작
Get-AppxPackage *getstarted* | Remove-AppxPackage
지도
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
피플
Get-AppxPackage *people* | Remove-AppxPackage
Groove 음악
Get-AppxPackage *zunemusic* | Remove-AppxPackage
Microsoft Store
Get-AppxPackage *windowsstore* | Remove-AppxPackage
Skype
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Xbox
Get-AppxPackage *xboxapp* | Remove-AppxPackage

CCleaner Free 유틸리티로 지우면 좀 더 편하게 지울 수 있습니다.




2018년 11월 8일 목요일

VirtualBox VERR_VD_IMAGE_READ_ONLY

VirtualBox VERR_VD_IMAGE_READ_ONLY



VirtualBox 에서 이미 만들어진 VHD 파일을 디스크로 연결해서 실행하면

Failed to open image 'vhd경로' for writing due to wrong permissions
(VERR_VD_IMAGE_READ_ONLY).
AHCI: Failed to attach drive to Port0
(VERR_VD_IMAGE_READ_ONLY).

이렇게 오류가 나오면서 세션을 열 수 없습니다.



이 문제는 VirtualBox 를 관리자 권한으로 실행하면 됩니다.

2018년 10월 12일 금요일

CentOS 7.x Postfix + Dovecot + MySQL + RoundCube Webmail

CentOS 7.x Postfix + Dovecot + MySQL + RoundCube Webmail




# yum install postfix dovecot dovecot-mysql roundcubemail

# useradd -u 5000 -d /home/vmail -s /sbin/nologin -m vmail


CREATE DATABASE webmail;
GRANT ALL PRIVILEGES ON webmail.* TO webmail@localhost IDENTIFIED BY 'dbpassword';


CREATE TABLE `webmail`.`virtual_domains` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `name` VARCHAR(50) NOT NULL,
 PRIMARY KEY (`id`)
 ) DEFAULT CHARSET=utf8;

CREATE TABLE `webmail`.`virtual_users` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `password` VARCHAR(106) NOT NULL,
 `email` VARCHAR(80) NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `email` (`email`)
 ) DEFAULT CHARSET=utf8;

CREATE TABLE `webmail`.`virtual_aliases` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `source` varchar(100) NOT NULL,
 `destination` varchar(100) NOT NULL,
 PRIMARY KEY (`id`)
 ) DEFAULT CHARSET=utf8;

INSERT INTO `webmail`.`virtual_domains` (`id` ,`name`) VALUES
 ('1', 'aaa.com'),
 ('2', 'bbb.com'),
 ('3', 'example.com');

INSERT INTO `webmail`.`virtual_users` (`id`, `password`, `email`) VALUES
 ('1', ENCRYPT('userpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user1@aaa.com'),
 ('2', ENCRYPT('userpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user2@aaa.com'),
 ('3', ENCRYPT('userpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user1@bbb.com'),
 ('4', ENCRYPT('userpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user2@bbb.com'),
 ('5', ENCRYPT('userpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user1@example.com'),
 ('6', ENCRYPT('userpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user2@example.com');

INSERT INTO `webmail`.`virtual_aliases` (`id`, `source`, `destination`) VALUES
 ('1', 'alias@aaa.com', 'user1@aaa.com'),
 ('2', 'user2@example.com', 'user1@example.com');


# vi /etc/postfix/mysql-virtual-alias-maps.cf
hosts = 127.0.0.1
dbname = webmail
user = webmail
password = dbpassword
query = SELECT destination FROM virtual_aliases WHERE source='%s'

# vi /etc/postfix/mysql-virtual-users.cf
hosts = 127.0.0.1
dbname = webmail
user = webmail
password = dbpassword
query = SELECT email FROM virtual_users WHERE email='%s'

# vi /etc/postfix/mysql-virtual-mailbox-domains.cf
hosts = 127.0.0.1
dbname = webmail
user = webmail
password = dbpassword
query = SELECT name FROM virtual_domains WHERE name='%s'

# vi /etc/postfix/mysql-virtual-mailbox-maps.cf
hosts = 127.0.0.1
dbname = webmail
user = webmail
password = dbpassword
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM virtual_users WHERE email='%s'

# chgrp postfix /etc/postfix/mysql-virtual-*.cf
# chmod o= /etc/postfix/mysql-virtual-*.cf


# vi /etc/postfix/main.cf
myhostname = mail.example.com
mydestination = localhost
mynetworks = 127.0.0.0/8
inet_interfaces = all
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual-alias-maps.cf, mysql:/etc/postfix/mysql-virtual-users.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1


# vi /etc/postfix/master.cf
dovecot   unix  -       n       n       -       -       pipe
    flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}

submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  #-o smtpd_client_restrictions=$mua_client_restrictions
  #-o smtpd_helo_restrictions=$mua_helo_restrictions
  #-o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_reject_unlisted_recipient=no
  #-o smtpd_client_restrictions=$mua_client_restrictions
  #-o smtpd_helo_restrictions=$mua_helo_restrictions
  #-o smtpd_sender_restrictions=$mua_sender_restrictions
  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING



# systemctl restart postfix
# systemctl status postfix
# postmap -q alias@aaa.com mysql:/etc/postfix/mysql-virtual-alias-maps.cf
# postmap -q user1@aaa.com mysql:/etc/postfix/mysql-virtual-users.cf
# postmap -q aaa.com mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
# postmap -q user1@aaa.com mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf


# mv /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.ori
# vi /etc/dovecot/dovecot.conf
protocols = imap pop3
listen = *
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir

ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem

namespace {
    type = private
    separator = .
    prefix = INBOX.
    inbox = yes
}

service auth {
    unix_listener auth-master {
        mode = 0600
        user = vmail
    }
    unix_listener /var/spool/postfix/private/auth {
        mode = 0666
        user = postfix
        group = postfix
    }
    user = root
}

service auth-worker {
    user = root
}

protocol lda {
    log_path = /home/vmail/dovecot-deliver.log
    auth_socket_path = /var/run/dovecot/auth-master
    postmaster_address = postmaster@example.com
}

protocol pop3 {
    pop3_uidl_format = %08Xu%08Xv
}

passdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf.ext
}

userdb {
    driver = static
    args = uid=vmail gid=vmail home=/home/vmail/%d/%n allow_all_users=yes
}

# vi /etc/dovecot/dovecot-sql.conf.ext
driver = mysql
connect = host=127.0.0.1 dbname=webmail user=webmail password=dbpassword
default_pass_scheme = SHA512-CRYPT
password_query = SELECT email as user, password FROM virtual_users WHERE email='%u';

# chown vmail:dovecot /etc/dovecot
# chown vmail:dovecot /etc/dovecot/dovecot.conf
# chown vmail:dovecot /etc/dovecot/dovecot-sql.conf.ext
# chmod o= /etc/dovecot/dovecot-sql.conf.ext

 systemctl restart postfix
 systemctl restart dovecot
 tail -n15 /var/log/maillog


# mysql -u webmail -p webmail < /usr/share/roundcubemail/SQL/mysql.initial.sql

# cp -p /etc/roundcubemail/config.inc.php.sample /etc/roundcubemail/config.inc.php
# vi /etc/roundcubemail/config.inc.php
$config['db_dsnw'] = 'mysql://webmail:dbpassword@localhost/webmail';
$config['product_name'] = 'Webmail'; // HTML Title

# vi /etc/httpd/conf.d/roundcubemail.conf
<Directory /usr/share/roundcubemail/>
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require local
        Require all granted
    </IfModule>
</Directory>
<Directory /usr/share/roundcubemail/installer/>
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require local
        Require ip xxx.xxx.xxx.xxx
    </IfModule>
</Directory>
# vi /etc/httpd/conf.d/webmail.example.com.conf
<VirtualHost *:80>
    ServerName webmail.example.com
    DocumentRoot /usr/share/roundcubemail
    ErrorLog logs/webmail.example.com-error_log
    LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vcommon
    CustomLog logs/webmail.example.com-access_log vcommon
</VirtualHost>
# systemctl restart httpd


2017년 8월 14일 월요일

CentOS 7.x nslookup yum install

CentOS 7.x nslookup yum install



[root@ctb ~]# nslookup
-bash: nslookup: command not found

[root@ctb ~]# yum install bind-utils
......
================================================================================
 Package             Arch        Version                     Repository    Size
================================================================================
Installing:
 bind-utils          x86_64      32:9.9.4-50.el7_3.1         updates      202 k
Installing for dependencies:
 bind-libs           x86_64      32:9.9.4-50.el7_3.1         updates      1.0 M
Updating for dependencies:
 bind-libs-lite      x86_64      32:9.9.4-50.el7_3.1         updates      730 k
 bind-license        noarch      32:9.9.4-50.el7_3.1         updates       83 k

Transaction Summary
================================================================================
Install  1 Package  (+1 Dependent package)
Upgrade             ( 2 Dependent packages)

Total download size: 2.0 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/4): bind-libs-lite-9.9.4-50.el7_3.1.x86_64.rpm          | 730 kB   00:02
(2/4): bind-license-9.9.4-50.el7_3.1.noarch.rpm            |  83 kB   00:01
(3/4): bind-libs-9.9.4-50.el7_3.1.x86_64.rpm               | 1.0 MB   00:01
(4/4): bind-utils-9.9.4-50.el7_3.1.x86_64.rpm              | 202 kB   00:02
--------------------------------------------------------------------------------
Total                                              735 kB/s | 2.0 MB  00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 32:bind-license-9.9.4-50.el7_3.1.noarch                      1/6
  Installing : 32:bind-libs-9.9.4-50.el7_3.1.x86_64                         2/6
  Installing : 32:bind-utils-9.9.4-50.el7_3.1.x86_64                        3/6
  Updating   : 32:bind-libs-lite-9.9.4-50.el7_3.1.x86_64                    4/6
  Cleanup    : 32:bind-libs-lite-9.9.4-38.el7_3.3.x86_64                    5/6
  Cleanup    : 32:bind-license-9.9.4-38.el7_3.3.noarch                      6/6
  Verifying  : 32:bind-license-9.9.4-50.el7_3.1.noarch                      1/6
  Verifying  : 32:bind-libs-lite-9.9.4-50.el7_3.1.x86_64                    2/6
  Verifying  : 32:bind-utils-9.9.4-50.el7_3.1.x86_64                        3/6
  Verifying  : 32:bind-libs-9.9.4-50.el7_3.1.x86_64                         4/6
  Verifying  : 32:bind-libs-lite-9.9.4-38.el7_3.3.x86_64                    5/6
  Verifying  : 32:bind-license-9.9.4-38.el7_3.3.noarch                      6/6

Installed:
  bind-utils.x86_64 32:9.9.4-50.el7_3.1

Dependency Installed:
  bind-libs.x86_64 32:9.9.4-50.el7_3.1

Dependency Updated:
  bind-libs-lite.x86_64 32:9.9.4-50.el7_3.1
  bind-license.noarch 32:9.9.4-50.el7_3.1

Complete!

2017년 6월 16일 금요일

PHPExcel 비밀번호 설정 기능 동작안함

PHPExcel 비밀번호 설정 기능 동작안함



1.8.0 버전에서 아래코드로 확인한 바 작동하지 않는다.


$objPHPExcel->getSecurity()->setLockWindows(true);
$objPHPExcel->getSecurity()->setLockStructure(true);
$objPHPExcel->getSecurity()->setWorkbookPassword('1234');

이 코드도 안되고

$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
$objPHPExcel->getActiveSheet()->getProtection()->setSort(true);
$objPHPExcel->getActiveSheet()->getProtection()->setInsertRows(true);
$objPHPExcel->getActiveSheet()->getProtection()->setFormatCells(true);
$objPHPExcel->getActiveSheet()->getProtection()->setPassword('1234');

이 코드도 먹히지 않는다.


안되는데 함수는 왜 있는걸까??

엑셀문서에 암호를 거는 방법은 정말 없단말인가~~

2017년 5월 2일 화요일

MySQL Replication 가끔 누락되는 데이터

MySQL Replication 가끔 누락되는 데이터


DB Master 와 Slave 서버로 Replication 으로 동기화 운영중인데

하루에 몇 건 정도는 싱크가 누락되는 것 같다.

이유가 무엇일까 궁금하다~

cron 으로 두 DB 의 테이블을 비교하는 스크립트를 돌려서 다르면 다시 맞춰주고 있지만

제대로 Replication 이 되면 얼마나 좋을까~

그냥 푸념해본다~

2017년 4월 21일 금요일

CentOS 7.x minimal ifconfig command not found

CentOS 7.x minimal ifconfig command not found



[root@localhost ~]# ifconfig
-bash: ifconfig: command not found

[root@localhost ~]# netstat
-bash: netstat: command not found


[root@localhost ~]# yum install net-tools
...
Dependencies Resolved

================================================================================
 Package         Arch         Version                          Repository  Size
================================================================================
Installing:
 net-tools       x86_64       2.0-0.17.20131004git.el7         base       304 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm              | 304 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                    1/1
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                    1/1

Installed:
  net-tools.x86_64 0:2.0-0.17.20131004git.el7


Complete!


2017년 4월 7일 금요일

CentOS 6.x X Window 삭제

CentOS 6.x X Window 삭제


서버호스팅을 신청했더니 불필요한 X윈도우까지 설치가 되어 있네요.

삭제하는 방법은 yum 그룹리스트가 있는 확인하고 삭제하면 됩니다.

[root@vps ~]# yum grouplist "X Window System"
Loaded plugins: fastestmirror, security
Setting up Group Process
Loading mirror speeds from cached hostfile
 * base: mirror.oasis.onnetcorp.com
 * epel: mirror.premi.st
 * extras: mirror.oasis.onnetcorp.com
 * rpmforge: ftp.neowiz.com
 * updates: mirror.oasis.onnetcorp.com
Available Groups:
   X Window System
Done
[root@vps ~]# yum groupremove "X Window System"
Loaded plugins: fastestmirror, security
Setting up Group Process
Loading mirror speeds from cached hostfile
 * base: mirror.oasis.onnetcorp.com
 * epel: mirror.premi.st
 * extras: mirror.oasis.onnetcorp.com
 * rpmforge: ftp.neowiz.com
 * updates: mirror.oasis.onnetcorp.com
Resolving Dependencies
--> Running transaction check
---> Package hal.x86_64 0:0.5.14-14.el6 will be erased
--> Processing Dependency: hal >= 0.5.10 for package: hal-info-20090716-5.el6.noarch
--> Processing Dependency: hal = 0.5.14-14.el6 for package: hal-devel-0.5.14-14.el6.x86_64
--> Processing Dependency: hal for package: pm-utils-1.2.5-11.el6.x86_64
---> Package xorg-x11-server-utils.x86_64 0:7.7-14.el6 will be erased
---> Package xorg-x11-xauth.x86_64 1:1.0.9-1.el6 will be erased
---> Package xorg-x11-xinit.x86_64 0:1.0.9-14.el6 will be erased
--> Processing Dependency: xorg-x11-xinit >= 1.0.2-22.fc8 for package: imsettings-0.108.0-3.6.el6.x86_64
--> Running transaction check
---> Package hal-devel.x86_64 0:0.5.14-14.el6 will be erased
---> Package hal-info.noarch 0:20090716-5.el6 will be erased
---> Package imsettings.x86_64 0:0.108.0-3.6.el6 will be erased
---> Package pm-utils.x86_64 0:1.2.5-11.el6 will be erased
--> Processing Dependency: pm-utils for package: libvirt-client-0.10.2-62.el6.x86_64
--> Running transaction check
---> Package libvirt-client.x86_64 0:0.10.2-62.el6 will be erased
--> Processing Dependency: libvirt-qemu.so.0()(64bit) for package: libvirt-devel-0.10.2-62.el6.x86_64
--> Processing Dependency: libvirt.so.0()(64bit) for package: libvirt-devel-0.10.2-62.el6.x86_64
--> Processing Dependency: libvirt-client = 0.10.2-62.el6 for package: libvirt-devel-0.10.2-62.el6.x86_64
--> Processing Dependency: libvirt-client >= 0.9.12 for package: libvirt-java-0.4.9-1.el6.noarch
--> Running transaction check
---> Package libvirt-devel.x86_64 0:0.10.2-62.el6 will be erased
---> Package libvirt-java.noarch 0:0.4.9-1.el6 will be erased
--> Processing Dependency: libvirt-java = 0.4.9-1.el6 for package: libvirt-java-devel-0.4.9-1.el6.noarch
--> Running transaction check
---> Package libvirt-java-devel.noarch 0:0.4.9-1.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                    Arch        Version                Repository  Size
================================================================================
Removing:
 hal                        x86_64      0.5.14-14.el6          @base      1.2 M
 xorg-x11-server-utils      x86_64      7.7-14.el6             @base      364 k
 xorg-x11-xauth             x86_64      1:1.0.9-1.el6          @base       89 k
 xorg-x11-xinit             x86_64      1.0.9-14.el6           @base       71 k
Removing for dependencies:
 hal-devel                  x86_64      0.5.14-14.el6          @base       48 k
 hal-info                   noarch      20090716-5.el6         @base      311 k
 imsettings                 x86_64      0.108.0-3.6.el6        @base      813 k
 libvirt-client             x86_64      0.10.2-62.el6          @base       15 M
 libvirt-devel              x86_64      0.10.2-62.el6          @base      5.0 M
 libvirt-java               noarch      0.4.9-1.el6            @base       73 k
 libvirt-java-devel         noarch      0.4.9-1.el6            @base       15 k
 pm-utils                   x86_64      1.2.5-11.el6           @base      254 k

Transaction Summary
================================================================================
Remove       12 Package(s)

Installed size: 23 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : libvirt-devel-0.10.2-62.el6.x86_64                          1/12
  Erasing    : libvirt-java-devel-0.4.9-1.el6.noarch                       2/12
  Erasing    : libvirt-java-0.4.9-1.el6.noarch                             3/12
  Erasing    : hal-devel-0.5.14-14.el6.x86_64                              4/12
  Erasing    : libvirt-client-0.10.2-62.el6.x86_64                         5/12
  Erasing    : hal-info-20090716-5.el6.noarch                              6/12
  Erasing    : hal-0.5.14-14.el6.x86_64                                    7/12
  Erasing    : pm-utils-1.2.5-11.el6.x86_64                                8/12
  Erasing    : imsettings-0.108.0-3.6.el6.x86_64                           9/12
  Erasing    : xorg-x11-xinit-1.0.9-14.el6.x86_64                         10/12
  Erasing    : 1:xorg-x11-xauth-1.0.9-1.el6.x86_64                        11/12
  Erasing    : xorg-x11-server-utils-7.7-14.el6.x86_64                    12/12
  Verifying  : xorg-x11-server-utils-7.7-14.el6.x86_64                     1/12
  Verifying  : pm-utils-1.2.5-11.el6.x86_64                                2/12
  Verifying  : xorg-x11-xinit-1.0.9-14.el6.x86_64                          3/12
  Verifying  : hal-info-20090716-5.el6.noarch                              4/12
  Verifying  : hal-devel-0.5.14-14.el6.x86_64                              5/12
  Verifying  : libvirt-client-0.10.2-62.el6.x86_64                         6/12
  Verifying  : 1:xorg-x11-xauth-1.0.9-1.el6.x86_64                         7/12
  Verifying  : imsettings-0.108.0-3.6.el6.x86_64                           8/12
  Verifying  : hal-0.5.14-14.el6.x86_64                                    9/12
  Verifying  : libvirt-java-devel-0.4.9-1.el6.noarch                      10/12
  Verifying  : libvirt-java-0.4.9-1.el6.noarch                            11/12
  Verifying  : libvirt-devel-0.10.2-62.el6.x86_64                         12/12

Removed:
  hal.x86_64 0:0.5.14-14.el6          xorg-x11-server-utils.x86_64 0:7.7-14.el6
  xorg-x11-xauth.x86_64 1:1.0.9-1.el6 xorg-x11-xinit.x86_64 0:1.0.9-14.el6

Dependency Removed:
  hal-devel.x86_64 0:0.5.14-14.el6        hal-info.noarch 0:20090716-5.el6
  imsettings.x86_64 0:0.108.0-3.6.el6     libvirt-client.x86_64 0:0.10.2-62.el6
  libvirt-devel.x86_64 0:0.10.2-62.el6    libvirt-java.noarch 0:0.4.9-1.el6
  libvirt-java-devel.noarch 0:0.4.9-1.el6 pm-utils.x86_64 0:1.2.5-11.el6

Complete!

2017년 3월 28일 화요일

UNISON Waiting for changes from server

UNISON Waiting for changes from server



unison 을 실행하였는데 "Waiting for changes from server" 메시지 출력 이후 한참 기다려도 끝이 안나는데 그래도 기다리면 결과가 나옵니다.

이유는 두 서버에 파일이 많으면 파일 비교 데이터를 생성하는 과정에서  시간이 걸리기 때문입니다.

서버 사양에 따라 다르겠지만 7기가 조금 넘은 분량인데 10분 정도 걸렸습니다.

# unison
Contacting server...
Connected [//mydomain2.com//home -> //mydomain1.com//home]
Looking for changes
Warning: No archive files were found for these roots, whose canonical names are:
        /home
        //mydomain1.com//home
This can happen either
because this is the first time you have synchronized these roots,
or because you have upgraded Unison to a new version with a different
archive format.

Update detection may take a while on this run if the replicas are
large.

Unison will assume that the 'last synchronized state' of both replicas
was completely empty.  This means that any files that are different
will be reported as conflicts, and any files that exist only on one
replica will be judged as new and propagated to the other replica.
If the two replicas are identical, then no changes will be reported.

If you see this message repeatedly, it may be because one of your machines
is getting its address from DHCP, which is causing its host name to change
between synchronizations.  See the documentation for the UNISONLOCALHOSTNAME
environment variable for advice on how to correct this.

Donations to the Unison project are gratefully accepted:
http://www.cis.upenn.edu/~bcpierce/unison

  Waiting for changes from server
Reconciling changes
Nothing to do: replicas have been changed only in identical ways since last sync.

2017년 3월 27일 월요일

CentOS 7.x lsyncd Error: Temporary or permanent failure on startup

CentOS 7.x lsyncd Error: Temporary or permanent failure on startup



# systemctl start lsyncd
Mon Mar 27 15:45:27 2017 Error: Temporary or permanent failure on startup of "/home/". Terminating since "insist" is not set.


Main Server


# cat /etc/ssh/sshd_config | grep PermitRoot
PermitRootLogin no


# vi /etc/ssh/sshd_config

#PermitRootLogin no
PermitRootLogin yes


# systemctl restart sshd


Backup Server


# ssh-keygen
# ssh-copy-id root@mainserverip
# systemctl start lsyncd

2017년 3월 22일 수요일

CentOS 7.x mod_cband compile error

CentOS 7.x mod_cband compile error



# ./configure
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

# yum install gcc

# ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether make sets $(MAKE)... yes
checking for apr_palloc in -laprutil... no
checking for an ANSI C-conforming const... yes
checking for apxs... no
checking for apxs2... no
configure: error: apxs missing

# yum install httpd-devel


# make

apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -Wall -DDST_CLASS=3  -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1054:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
               ^
src/mod_cband.c:1054:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
                                                 ^
src/mod_cband.c:1058:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
               ^
src/mod_cband.c:1058:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
                                                 ^
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1333:47: error: 'conn_rec' has no member named 'remote_ip'
     p.add.sin.s_addr = inet_addr(r->connection->remote_ip);
                                               ^
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1362:10: error: 'struct conn_rec' has no member named 'remote_i '
     if (c->remote_ip != NULL)
          ^
src/mod_cband.c:1363:20: error: 'struct conn_rec' has no member named 'remote_i '
  addr = inet_addr(c->remote_ip);
                    ^
src/mod_cband.c:1365:10: error: 'struct conn_rec' has no member named 'remote_addr'
  addr = c->remote_addr->sa.sin.sin_addr.s_addr;
          ^
src/mod_cband.c: In function 'mod_cband_update_speed':
src/mod_cband.c:1905:19: warning: variable 'time_last_request' set but not used [-Wunused-but-set-variable]
     unsigned long time_last_request;
                   ^
src/mod_cband.c: In function 'mod_cband_check_connections_speed':
src/mod_cband.c:2963:19: warning: variable 'time_now' set but not used [-Wunused-but-set-variable]
     unsigned long time_now;
                   ^
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] Error 1


# sed -i 's/remote_ip/client_ip/g' ./src/mod_cband.c
# sed -i 's/c->remote_addr/c->client_addr/g' ./src/mod_cband.c
# make
# make install


CentOS 7.x How to open 53 port

CentOS 7.x How to open 53 port


[root@vps log]# firewall-cmd --permanent --zone=public --add-service=dns
success
[root@vps log]# firewall-cmd --reload
success
[root@vps log]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client dns ftp http https mysql ssh
  ports:
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks: echo-request
  rich rules:

[root@vps log]# netstat -ant | grep :53
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN


how to remove

# firewall-cmd --permanent --zone=public --remove-service=dns

2017년 3월 21일 화요일

MariaDB charset UTF8 설정

MariaDB charset UTF8 설정


CentOS 7.x 버전에 APM 을 설치했더니 MySQL 디폴트 문자셋이 latin1 으로 되어있네요.

/etc/my.cnf 를 수정해주면 됩니다.

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

init_connect='set names utf8'
character-set-server=utf8

위 두줄은 추가해주고

# systemctl restart mariadb

2017년 3월 20일 월요일

How to fix, Replication slave server Error Duplicate entry

How to fix, Replication slave server Error Duplicate entry


Error 'Duplicate entry for key 'PRIMARY'' on query.

MySQL Replication 슬래이브 서버에서

show slave status 로 상태 확인시 위와 같은 에러가 있으면 더 이상 DB 데이터 싱크는 되지 않습니다.

아무튼 이런 경우에는 my.cnf 에 아래 옵션을 넣어주면 됩니다.

[mysqld]
server-id=2
slave-skip-errors=1062

1062 에러가 primary key 데이터 중복시 나는 에러입니다.

auto_increment 가 되어 있는데도 불구 하고 에러가 나는게 조금 이상하긴 하네요.

2017년 3월 15일 수요일

LSYNCD Error Terminating since out of inotify watches

LSYNCD Error Terminating since out of inotify watches



lsyncd 로그 파일에 아래와 같은 에러가 있다면 동기화 하려는 파일의 수가 많을 때 발생합니다.


Wed Mar 15 14:05:54 2017 Normal: --- TERM signal, fading ---
Wed Mar 15 14:05:56 2017 Error: Terminating since out of inotify watches.
Consider increasing /proc/sys/fs/inotify/max_user_watches


동기화 시키려는 파일이 많은 때는 위와 같은 에러가 발생합니다.

이럴때는 max_user_watches 수를 증가시켜 주면 됩니다.

먼저 얼마로 되어 있는지 확인해 보고 수치를 증가시켜 줍시다.

# cat /proc/sys/fs/inotify/max_user_watches
8192

# echo 65536 > /proc/sys/fs/inotify/max_user_watches


이제 lsyncd 를 재시작 하면 됩니다.

ssh-copy-id Pseudo-terminal will not be allocated because stdin is not a terminal

ssh-copy-id Pseudo-terminal will not be allocated because stdin is not a terminal



# ssh-copy-id root@192.168.1.2
Pseudo-terminal will not be allocated because stdin is not a terminal.
ssh: Could not resolve hostname umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys && (test -x /sbin/restorec: Name or service not known

위와 같이 복사가 안 될 때는 scp 명령어로 복사하여 주면 됩니다.

# scp ./.ssh/id_rsa.pub root@192.168.1.2:~/.ssh/authorized_keys

authorized_keys 에 다른 서버의 키 값이 있다면 복사가 아닌 cat 으로 덧붙어 주어야 합니다.

# cat ./.ssh/id_rsa.pub | ssh root@192.168.1.2 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"


2017년 3월 10일 금요일

LINUX fdisk error

LINUX fdisk error


Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 5: Input/output error.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

디스크 상태가 이상해서 파티션을 다시 잡을려고 하니 위와 같이 에러가 발생한다.

아무래도 디스크가 맛이 갔나보다.