Rabu, 07 November 2018

How to Install Mytop from source on Centos 6

  Tidak ada komentar
Mytop is an open source and free monitoring program for MySQL and MariaDB databases was written by Jeremy Zawodny using Perl language. It is much similar in look and feel of the most famous Linux system monitoring tool called top.

Mytop program provides a command-line shell interface to monitor real time MySQL/MariaDB threads, queries per second, process list and performance of databases and gives a idea for the database administrator to better optimize the server to handle heavy load.

Download mytop package source from official website : http://jeremy.zawodny.com/mysql/mytop/
[root@cloud ~]# curl -O http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 19720  100 19720    0     0   5852      0  0:00:03  0:00:03 --:--:--  5862
[root@cloud ~]#
[root@cloud ~]# ls
anaconda-ks.cfg   apr-util-1.6.1.tar.gz  httpd-2.4.28.tar.gz  install.log         mysql80-community-release-el6-1.noarch.rpm  php-5.5.17
apr-1.6.5.tar.gz  db_bak                 httpd-2.4.36         install.log.syslog  mytop-1.6.tar.gz                            php-5.5.17.tar.gz
[root@cloud ~]#
.Extract the mytop package
[root@cloud ~]# tar xzf mytop-1.6.tar.gz
[root@cloud ~]# ls
anaconda-ks.cfg        db_bak               install.log                                 mytop-1.6         php-5.5.17.tar.gz
apr-1.6.5.tar.gz       httpd-2.4.28.tar.gz  install.log.syslog                          mytop-1.6.tar.gz
apr-util-1.6.1.tar.gz  httpd-2.4.36         mysql80-community-release-el6-1.noarch.rpm  php-5.5.17
[root@cloud ~]#

Install perl TermReadKey to avoid error Warning: prerequisite Term::ReadKey 2.1 not found.
[root@cloud ~]# yum install perl-TermReadKey
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.biz.net.id
 * epel: del-repos.extreme-ix.org
 * extras: centos.biz.net.id
 * updates: centos.biz.net.id
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package perl-TermReadKey.x86_64 0:2.30-13.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                                   Arch                            Version                               Repository                     Size
=====================================================================================================================================================
Installing:
 perl-TermReadKey                          x86_64                          2.30-13.el6                           base                           31 k

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

Total download size: 31 k
Installed size: 62 k
Is this ok [y/N]: y
Downloading Packages:
perl-TermReadKey-2.30-13.el6.x86_64.rpm                                                                                       |  31 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : perl-TermReadKey-2.30-13.el6.x86_64                                                                                               1/1
  Verifying  : perl-TermReadKey-2.30-13.el6.x86_64                                                                                               1/1

Installed:
  perl-TermReadKey.x86_64 0:2.30-13.el6

Complete!
[root@cloud ~]#
Change working directory to mytop
[root@cloud ~]# cd mytop-1.6
[root@cloud mytop-1.6]# ls
Changes  INSTALL  Makefile  Makefile.PL  MANIFEST  META.yml  mytop  README  test.pl
[root@cloud mytop-1.6]#
Execute the makefile with perl
[root@cloud mytop-1.6]# perl Makefile.PL
Writing Makefile for mytop
[root@cloud mytop-1.6]#
Compile the mytop
[root@cloud mytop-1.6]# make
cp mytop blib/script/mytop
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/mytop
Manifying blib/man1/mytop.1
[root@cloud mytop-1.6]#
Testing before install
[root@cloud mytop-1.6]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
1..1
ok 1
[root@cloud mytop-1.6]#
Install mytop
[root@cloud mytop-1.6]# make install
Installing /usr/local/share/man/man1/mytop.1
Installing /usr/local/bin/mytop
Appending installation info to /usr/lib64/perl5/perllocal.pod
[root@cloud mytop-1.6]#
Edit mytop binary
[root@cloud ~]# vi /usr/local/bin/mytop
[root@cloud ~]#
Mark the "long|!" => \$config{long_nums}, To solve error Error in option spec: "long|!"
GetOptions(
    "color!"              => \$config{color},
    "user|u=s"            => \$config{user},
    "pass|password|p=s"   => \$config{pass},
    "database|db|d=s"     => \$config{db},
    "host|h=s"            => \$config{host},
    "port|P=i"            => \$config{port},
    "socket|S=s"          => \$config{socket},
    "delay|s=i"           => \$config{delay},
    "batch|batchmode|b"   => \$config{batchmode},
    "header!"             => \$config{header},
    "idle|i"              => \$config{idle},
    "resolve|r"           => \$config{resolve},
    "prompt!"             => \$config{prompt},
#    "long|!"              => \$config{long_nums},
    "mode|m=s"            => \$config{mode},
    "sort=s"              => \$config{sort},
);
Run mytop with following command
[root@cloud ~]# mytop --prompt -u root -d portal
The output of running mytop
MySQL on localhost (5.5.62)                                                                                                 up 11+10:06:05 [22:11:18]
 Queries: 5.0    qps:    0 Slow:     0.0         Se/In/Up/De(%):    00/00/00/00
             qps now:    0 Slow qps: 0.0  Threads:    1 (   1/   0) 00/00/00/00
 Key Efficiency: 100.0%  Bps in/out:   0.0/  0.0   Now in/out:   8.3/ 1.7k

      Id      User         Host/IP         DB      Time    Cmd Query or State
      --      ----         -------         --      ----    --- ----------
      12      root       localhost     portal         0  Query show full processlist

[root@cloud ~]#

Senin, 05 November 2018

How To Set Up Time Synchronization on Ubuntu 16.04

  Tidak ada komentar

Introduction

Accurate timekeeping has become a critical component of modern software deployments. Whether it's making sure logs are recorded in the right order or database updates are applied correctly, out-of-sync time can cause errors, data corruption, and other hard to debug issues.
Ubuntu 16.04 has time synchronization built in and activated by default using systemd's timesyncd service. In this article we will look at some basic time-related commands, verify that timesyncd is active, and learn how to install an alternate network time service.

Prerequisites

Before starting this tutorial, you will need an Ubuntu 16.04 server with a non-root, sudo-enabled user, as described in this Ubuntu 16.04 server setup tutorial.
The most basic command for finding out the time on your server is date. Any user can type this command to print out the date and time:
maswachid@cloud:~$ date
Tue Nov  6 09:10:36 WIB 2018
maswachid@cloud:~$
Most often your server will default to the UTC time zone, as highlighted in the above output. UTC is Coordinated Universal Time, the time at zero degrees longitude. Consistently using Universal Time reduces confusion when your infrastructure spans multiple time zones.
If you have different requirements and need to change the time zone, you can use the timedatectlcommand to do so.
First, list the available time zones:
maswachid@cloud:~$ timedatectl list-timezones
A list of time zones will print to your screen. You can press SPACE to page down, and b to page up. Once you find the correct time zone, make note of it then type q to exit the list.
Now set the time zone with timedatectl set-timezone, making sure to replace the highlighted portion below with the time zone you found in the list. You'll need to use sudo with timedatectl to make this change:
maswachid@cloud:~$ timedatectl set-timezone Asia/Jakarta
You can verify your changes by running date again:
maswachid@cloud:~$ date
Tue Nov  6 09:14:15 WIB 2018
maswachid@cloud:~$
The time zone abbreviation should reflect the newly chosen value.
Now that we know how to check the clock and set time zones, let’s make sure our time is being synchronized properly.

Controlling timesyncd with timedatectl

Until recently, most network time synchronization was handled by the Network Time Protocol daemon or ntpd. This server connects to a pool of other NTP servers that provide it with constant and accurate time updates.
Ubuntu's default install now uses timesyncd instead of ntpd. timesyncd connects to the same time servers and works in roughly the same way, but is more lightweight and more integrated with systemd and the low level workings of Ubuntu.
We can query the status of timesyncd by running timedatectl with no arguments. You don't need to use sudo in this case:
maswachid@cloud:/home$ timedatectl
      Local time: Tue 2018-11-06 09:06:47 WIB
  Universal time: Tue 2018-11-06 02:06:47 UTC
        RTC time: Tue 2018-11-06 02:06:48
       Time zone: Asia/Jakarta (WIB, +0700)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no
maswachid@cloud:/home$
This prints out the local time, universal time (which may be the same as local time, if you didn't switch from the UTC time zone), and some network time status information. Network time on: yes means that timesyncd is enabled, and NTP synchronized: yes indicates that the time has been successfully synced.
If timesyncd isn't enabled, turn it on with timedatectl:
maswachid@cloud:~$ sudo timedatectl set-ntp on
[sudo] password for sysop:
maswachid@cloud:~$
Run timedatectl again to confirm the network time status. It may take a minute for the actual sync to happen, but eventually both Network time on: and NTP synchronized: should read yes.

Switching to ntpd

Though timesyncd is fine for most purposes, some applications that are very sensitive to even the slightest perturbations in time may be better served by ntpd, as it uses more sophisticated techniques to constantly and gradually keep the system time on track.
Before installing ntpd, we should turn off timesyncd:
maswachid@cloud:~$ sudo timedatectl set-ntp no
[sudo] password for sysop:
maswachid@cloud:~$
Verify that timesyncd is off:
maswachid@cloud:~$ timedatectl
      Local time: Tue 2018-11-06 09:46:57 WIB
  Universal time: Tue 2018-11-06 02:46:57 UTC
        RTC time: Tue 2018-11-06 02:46:58
       Time zone: Asia/Jakarta (WIB, +0700)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no
maswachid@cloud:~$
Look for Network time on: no in the output. This means timesyncd has been stopped. We can now install the ntp package with apt-get:
maswachid@cloud:~$ sudo apt-get install ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libopts25
Suggested packages:
  ntp-doc
The following NEW packages will be installed:
  libopts25 ntp
0 upgraded, 2 newly installed, 0 to remove and 73 not upgraded.
Need to get 576 kB of archives.
After this operation, 1,792 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://id.archive.ubuntu.com/ubuntu xenial/main amd64 libopts25 amd64 1:5.18.7-3 [57.8 kB]
Get:2 http://id.archive.ubuntu.com/ubuntu xenial-updates/main amd64 ntp amd64 1:4.2.8p4+dfsg-3ubuntu5.9 [519 kB]
Fetched 576 kB in 14s (41.0 kB/s)
Selecting previously unselected package libopts25:amd64.
(Reading database ... 74018 files and directories currently installed.)
Preparing to unpack .../libopts25_1%3a5.18.7-3_amd64.deb ...
Unpacking libopts25:amd64 (1:5.18.7-3) ...
Selecting previously unselected package ntp.
Preparing to unpack .../ntp_1%3a4.2.8p4+dfsg-3ubuntu5.9_amd64.deb ...
Unpacking ntp (1:4.2.8p4+dfsg-3ubuntu5.9) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up libopts25:amd64 (1:5.18.7-3) ...
Setting up ntp (1:4.2.8p4+dfsg-3ubuntu5.9) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...
maswachid@cloud:~$
ntpd will be started automatically after install. You can query ntpd for status information to verify that everything is working:
maswachid@cloud:~$ sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
maswachid@cloud:~$
maswachid@cloud:~$ timedatectl
      Local time: Tue 2018-11-06 09:52:30 WIB
  Universal time: Tue 2018-11-06 02:52:30 UTC
        RTC time: Tue 2018-11-06 02:52:30
       Time zone: Asia/Jakarta (WIB, +0700)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no
maswachid@cloud:~$
ntpq is a query tool for ntpd. The -p flag asks for information about the NTP servers (or peers) ntpd has connected to. Your output will be slightly different, but should list the default Ubuntu pool servers plus a few others. Bear in mind that it can take a few minutes for ntpd to establish connections.

Conclusion

In this article we’ve shown how to view the system time, change time zones, work with Ubuntu's default timesyncd, and install ntpd. If you have more sophisticated timekeeping needs than what we’ve covered here, you might reference the offical NTP documentation, and also take a look at the NTP Pool Project, a global group of volunteers providing much of the world's NTP infrastructure.

How to Fix Apache AH01630 Client Denied by Server Configuration Error

  Tidak ada komentar
If you are using Apache 2.4 and above, you might get the following error message. This might specifically start happening after you’ve upgraded from an older version of apache.
For example, after you’ve upgraded from Apache 2.2 to a latest version, you might start getting the following error message.
AH01630: client denied by server configuration: /home/myapp/server/
Open your Apache configuration, commonly httpd.conf and find the directory setting, make sure the allowed path is match with what you web app directory accessed
<Directory "/home/myapp/server">
    Options Indexes MultiViews
    AllowOverride None
    Require all granted
</Directory>
For more information : https://wiki.apache.org/httpd/ClientDeniedByServerConfiguration

Minggu, 04 November 2018

How to install and setting fail2ban firewalld centos 7

  Tidak ada komentar
Install the fail2ban with running yum install fail2ban-firewalld
[root@localhost ~]# yum install fail2ban
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                           | 7.9 kB  00:00:00
 * base: mirror.axarva.id
 * epel: epel.mirror.angkasa.id
 * extras: mirror.axarva.id
 * updates: mirror.axarva.id
as-repo-centos7                                                                                                | 2.9 kB  00:00:00
base                                                                                                           | 3.6 kB  00:00:00
cheese                                                                                                         | 3.4 kB  00:00:00
cr                                                                                                             | 2.9 kB  00:00:00
epel                                                                                                           | 5.3 kB  00:00:00
extras                                                                                                         | 2.9 kB  00:00:00
mongodb-org-4.0                                                                                                | 2.5 kB  00:00:00
pritunl                                                                                                        | 2.9 kB  00:00:00
updates                                                                                                        | 2.9 kB  00:00:00
(1/4): epel/x86_64/updateinfo                                                                                  | 1.0 MB  00:00:01
(2/4): updates/7/x86_64/primary_db                                                                             | 4.2 MB  00:00:02
(3/4): epel/x86_64/primary_db                                                                                  | 6.9 MB  00:00:06
(4/4): cheese/7/x86_64/primary_db                                                                              | 534 kB  00:00:15
Resolving Dependencies
--> Running transaction check
---> Package fail2ban.noarch 0:0.9.7-1.el7 will be installed
--> Processing Dependency: fail2ban-firewalld = 0.9.7-1.el7 for package: fail2ban-0.9.7-1.el7.noarch
--> Processing Dependency: fail2ban-sendmail = 0.9.7-1.el7 for package: fail2ban-0.9.7-1.el7.noarch
--> Processing Dependency: fail2ban-server = 0.9.7-1.el7 for package: fail2ban-0.9.7-1.el7.noarch
--> Running transaction check
---> Package fail2ban-firewalld.noarch 0:0.9.7-1.el7 will be installed
---> Package fail2ban-sendmail.noarch 0:0.9.7-1.el7 will be installed
---> Package fail2ban-server.noarch 0:0.9.7-1.el7 will be installed
--> Processing Dependency: systemd-python for package: fail2ban-server-0.9.7-1.el7.noarch
--> Running transaction check
---> Package systemd-python.x86_64 0:219-67.el7_7.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                               Arch                      Version                             Repository                  Size
======================================================================================================================================
Installing:
 fail2ban                              noarch                    0.9.7-1.el7                         epel                        11 k
Installing for dependencies:
 fail2ban-firewalld                    noarch                    0.9.7-1.el7                         epel                        11 k
 fail2ban-sendmail                     noarch                    0.9.7-1.el7                         epel                        14 k
 fail2ban-server                       noarch                    0.9.7-1.el7                         epel                       288 k
 systemd-python                        x86_64                    219-67.el7_7.2                      updates                    137 k

Transaction Summary
======================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 462 k
Installed size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): fail2ban-0.9.7-1.el7.noarch.rpm                                                                         |  11 kB  00:00:00
(2/5): fail2ban-firewalld-0.9.7-1.el7.noarch.rpm                                                               |  11 kB  00:00:00
(3/5): fail2ban-sendmail-0.9.7-1.el7.noarch.rpm                                                                |  14 kB  00:00:00
(4/5): fail2ban-server-0.9.7-1.el7.noarch.rpm                                                                  | 288 kB  00:00:00
(5/5): systemd-python-219-67.el7_7.2.x86_64.rpm                                                                | 137 kB  00:00:00
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 324 kB/s | 462 kB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : systemd-python-219-67.el7_7.2.x86_64                                                                               1/5
  Installing : fail2ban-server-0.9.7-1.el7.noarch                                                                                 2/5
  Installing : fail2ban-sendmail-0.9.7-1.el7.noarch                                                                               3/5
  Installing : fail2ban-firewalld-0.9.7-1.el7.noarch                                                                              4/5
  Installing : fail2ban-0.9.7-1.el7.noarch                                                                                        5/5
  Verifying  : fail2ban-sendmail-0.9.7-1.el7.noarch                                                                               1/5
  Verifying  : fail2ban-0.9.7-1.el7.noarch                                                                                        2/5
  Verifying  : fail2ban-server-0.9.7-1.el7.noarch                                                                                 3/5
  Verifying  : fail2ban-firewalld-0.9.7-1.el7.noarch                                                                              4/5
  Verifying  : systemd-python-219-67.el7_7.2.x86_64                                                                               5/5

Installed:
  fail2ban.noarch 0:0.9.7-1.el7

Dependency Installed:
  fail2ban-firewalld.noarch 0:0.9.7-1.el7      fail2ban-sendmail.noarch 0:0.9.7-1.el7      fail2ban-server.noarch 0:0.9.7-1.el7
  systemd-python.x86_64 0:219-67.el7_7.2

Complete!
[root@localhost ~]#

Configure Fail2ban

Fail2ban configuration files reside in /etc/fail2ban. The default configuration file is called jail.confwhich should never be edited by hand because future updates will rewrite this file. Instead, create a new configuration file called jail.local. Any values here will override the default values.

Change working directory to fail2ban and open the default config jail.conf
[root@localhost ~]# cd /etc/fail2ban/
[root@localhost fail2ban]# ls
action.d       filter.d   paths-common.conf  paths-freebsd.conf
fail2ban.conf  jail.conf  paths-debian.conf  paths-opensuse.conf
fail2ban.d     jail.d     paths-fedora.conf  paths-osx.conf
[root@localhost fail2ban]#
[root@localhost fail2ban]# vi jail.conf
[root@localhost fail2ban]#
Change directory to jail.d and create config file
[root@localhost fail2ban]# cd jail.d/
[root@localhost jail.d]# ls
00-firewalld.conf
[root@localhost jail.d]# vi sshd.local
[root@localhost jail.d]#
Example of configuration 
[root@localhost jail.d]# cat sshd.local
[sshd]

# To use more aggressive sshd filter (inclusive sshd-ddos failregex):
#filter = sshd-aggressive
port    = 2222
logpath = %(sshd_log)s
backend = %(sshd_backend)s
enabled = true
# bantime in seconds
bantime = 86400

[root@localhost jail.d]#
Start the fail2ban service and check the service status
[root@localhost jail.d]# systemctl start fail2ban
[root@localhost jail.d]# systemctl status fail2ban
● fail2ban.service - Fail2Ban Service
   Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-11-04 17:16:54 WIB; 4s ago
     Docs: man:fail2ban(1)
  Process: 64772 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=0/SUCCESS)
 Main PID: 64775 (fail2ban-server)
   CGroup: /system.slice/fail2ban.service
           └─64775 /usr/bin/python2 -s /usr/bin/fail2ban-server -s /var/run/fail2ban/fail2ban.sock -p /var/run/fail2ban/fail2ban.pi...

Nov 04 17:16:54 localhost.localdomain systemd[1]: Starting Fail2Ban Service...
Nov 04 17:16:54 localhost.localdomain fail2ban-client[64772]: 2018-11-04 17:16:54,326 fail2ban.server         [64773]: INFO   ...0.9.7
Nov 04 17:16:54 localhost.localdomain fail2ban-client[64772]: 2018-11-04 17:16:54,326 fail2ban.server         [64773]: INFO   ... mode
Nov 04 17:16:54 localhost.localdomain systemd[1]: Started Fail2Ban Service.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost jail.d]#
[root@localhost jail.d]# fail2ban-client status
Status
|- Number of jail:      1
`- Jail list:   sshd
[root@localhost jail.d]#

Fail2ban client showing sshd status
[root@localhost ~]# sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
|  |- Currently failed: 5
|  |- Total failed:     55
|  `- Journal matches:  _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions
   |- Currently banned: 7
   |- Total banned:     7
   `- Banned IP list:   182.61.19.79 54.38.241.162 195.16.41.171 182.61.106.79 77.70.96.195 112.64.170.178 129.28.142.81
[root@localhost ~]#

How to setup timezone on centos 7 with command line

  Tidak ada komentar
Check available timezone
[root@localhost ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/El_Aaiun
Africa/Freetown
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
Africa/Juba
Africa/Kampala
Africa/Khartoum
Africa/Kigali
Africa/Kinshasa
Africa/Lagos
Africa/Libreville
Africa/Lome
Africa/Luanda
Africa/Lubumbashi
Africa/Lusaka
Africa/Malabo
Africa/Maputo
Africa/Maseru
Africa/Mbabane
Africa/Mogadishu
Africa/Monrovia
Africa/Nairobi
Africa/Ndjamena
Africa/Niamey
Africa/Nouakchott
Africa/Ouagadougou
Africa/Porto-Novo
Africa/Sao_Tome
Africa/Tripoli
Africa/Tunis
Africa/Windhoek
America/Adak
America/Anchorage
America/Anguilla
America/Antigua
America/Araguaina
America/Argentina/Buenos_Aires
America/Argentina/Catamarca
America/Argentina/Cordoba
America/Argentina/Jujuy
America/Argentina/La_Rioja
America/Argentina/Mendoza
America/Argentina/Rio_Gallegos
America/Argentina/Salta
America/Argentina/San_Juan
America/Argentina/San_Luis
America/Argentina/Tucuman
America/Argentina/Ushuaia
America/Aruba
America/Asuncion
America/Atikokan
America/Bahia
America/Bahia_Banderas
America/Barbados
America/Belem
Set to the wished timezone
[root@localhost ~]# timedatectl set-timezone Asia/Jakarta
[root@localhost ~]#
Check the timezone after setup
[root@localhost ~]# timedatectl
      Local time: Sun 2018-11-04 17:21:40 WIB
  Universal time: Sun 2018-11-04 10:21:40 UTC
        RTC time: Sun 2018-11-04 10:21:40
       Time zone: Asia/Jakarta (WIB, +0700)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@localhost ~]#

How to install php rar module from source on centos 6

  Tidak ada komentar
Download the php rar source : http://pecl.php.net/package/rar
[root@localhost ~]# wget http://pecl.php.net/get/rar-4.0.0.tgz
--2018-11-03 22:04:55--  http://pecl.php.net/get/rar-4.0.0.tgz
Connecting to 192.168.71.17:9898... connected.
Proxy request sent, awaiting response... 200 OK
Length: 383732 (375K) [application/octet-stream]
Saving to: “rar-4.0.0.tgz”

100%[============================================================================================>] 383,732      359K/s   in 1.0s

2018-11-03 22:04:59 (359 KB/s) - “rar-4.0.0.tgz” saved [383732/383732]

[root@localhost ~]#
[root@localhost ~]# ls
anaconda-ks.cfg        bakupan_eplan.tar.gz  install.log         mysql80-community-release-el6-1.noarch.rpm  rar-4.0.0.tgz
apr-1.6.5.tar.gz       httpd-2.4.37          install.log.syslog  php-5.4.45                                  wch_backres_eplan.sh
apr-util-1.6.1.tar.gz  httpd-2.4.37.tar.gz   ius-release.rpm     php-5.4.45.tar.gz
[root@localhost ~]#
Install some needed library
[root@localhost ~]# tar -xzf rar-4.0.0.tgz
[root@localhost ~]# ls
anaconda-ks.cfg        httpd-2.4.37         ius-release.rpm                             php-5.4.45.tar.gz
apr-1.6.5.tar.gz       httpd-2.4.37.tar.gz  mysql80-community-release-el6-1.noarch.rpm  rar-4.0.0
apr-util-1.6.1.tar.gz  install.log          package.xml                                 rar-4.0.0.tgz
bakupan_eplan.tar.gz   install.log.syslog   php-5.4.45                                  wch_backres_eplan.sh
[root@localhost ~]#
Download php from official website


Install some needed library

[root@localhost ~]# cd rar-4.0.0
[root@localhost rar-4.0.0]# ls
config.m4   CREDITS      LICENSE    rararch.c  rarentry.c   rar_navigation.c  rar_time.c  tests
config.w32  example.php  php_rar.h  rar.c      rar_error.c  rar_stream.c      README.md   unrar
[root@localhost rar-4.0.0]# phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
[root@localhost rar-4.0.0]#
Download php from official website
Install some needed library


[root@localhost ~]# cd rar-4.0.0
[root@localhost rar-4.0.0]# ls
config.m4   CREDITS      LICENSE    rararch.c  rarentry.c   rar_navigation.c  rar_time.c  tests
config.w32  example.php  php_rar.h  rar.c      rar_error.c  rar_stream.c      README.md   unrar
[root@localhost rar-4.0.0]# phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
[root@localhost rar-4.0.0]# ls
acinclude.m4    config.guess  configure     example.php  Makefile.global  rararch.c    rar_navigation.c  run-tests.php
aclocal.m4      config.h.in   configure.in  install-sh   missing          rar.c        rar_stream.c      tests
autom4te.cache  config.m4     config.w32    LICENSE      mkinstalldirs    rarentry.c   rar_time.c        unrar
build           config.sub    CREDITS       ltmain.sh    php_rar.h        rar_error.c  README.md
[root@localhost rar-4.0.0]# 
Download php from official
Install some needed library



[root@localhost rar-4.0.0]# ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
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 cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php5
checking for PHP includes... -I/usr/local/php5/include/php -I/usr/local/php5/include/php/main -I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend -I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/local/php5/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... gawk
checking whether to enable rar support... yes, shared
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 1966080
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
[root@localhost rar-4.0.0]#
Download php from official website
Install some needed library



[root@localhost rar-4.0.0]# make
/bin/sh /root/rar-4.0.0/libtool --mode=compile cc -DRARDLL -DSILENT -Wno-write-strings -Wall -I/root/rar-4.0.0/unrar -I. -I/root/rar-4.0.0 -DPHP_ATOM_INC -I/root/rar-4.0.0/include -I/root/rar-4.0.0/main -I/root/rar-4.0.0 -I/usr/local/php5/include/php -I/usr/local/php5/include/php/main -I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend -I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/rar-4.0.0/rar.c -o rar.lo
mkdir .libs
 cc -DRARDLL -DSILENT -Wno-write-strings -Wall -I/root/rar-4.0.0/unrar -I. -I/root/rar-4.0.0 -DPHP_ATOM_INC -I/root/rar-4.0.0/include -I/root/rar-4.0.0/main -I/root/rar-4.0.0 -I/usr/local/php5/include/php -I/usr/local/php5/include/php/main -I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend -I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/rar-4.0.0/rar.c  -fPIC -DPIC -o .libs/rar.o
/bin/sh /root/rar-4.0.0/libtool --mode=compile cc -DRARDLL -DSILENT -Wno-write-strings -Wall -I/root/rar-4.0.0/unrar -I. -I/root/rar-4.0.0 -DPHP_ATOM_INC -I/root/rar-4.0.0/include -I/root/rar-4.0.0/main -I/root/rar-4.0.0 -I/usr/local/php5/include/php -I/usr/local/php5/include/php/main -I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend -I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/rar-4.0.0/rar_error.c -o rar_error.lo
 cc -DRARDLL -DSILENT -Wno-write-strings -Wall -I/root/rar-4.0.0/unrar -I. -I/root/rar-4.0.0 -DPHP_ATOM_INC -I/root/rar-4.0.0/include -I/root/rar-4.0.0/main -I/root/rar-4.0.0 -I/usr/local/php5/include/php -I/usr/local/php5/include/php/main -I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend -I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/rar-4.0.0/rar_error.c  -fPIC -DPIC -o .libs/rar_error.o
/bin/sh /root/rar-4.0.0/libtool --mode=compile cc -DRARDLL -DSILENT -Wno-write-strings -Wall -I/root/rar-4.0.0/unrar -I. -I/root/rar-4.0.0 -DPHP_ATOM_INC -I/root/rar-4.0.0/include -I/root/rar-4.0.0/main -I/root/rar-4.0.0 -I/usr/local/php5/include/php -I/usr/local/php5/include/php/main -I/usr/local/php5/include/php/TSRM -I/usr/local/php5/include/php/Zend -I/usr/local/php5/include/php/ext -I/usr/local/php5/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/rar-4.0.0/rararch.c -o rararch.lo
 ..
 ..
 Libraries have been installed in:
   /root/rar-4.0.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.
Download php from official
source
[root@localhost rar-4.0.0]# make install
Installing shared extensions:     /usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/
[root@localhost rar-4.0.0]#


Install some needed library

Download php from official
source
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.

extension=rar.so



Install some needed library

Download php from official
source
[root@localhost rar-4.0.0]# service httpd restart
Shutting down httpd:                                       [  OK  ]
Starting httpd:                                            [  OK  ]
[root@localhost rar-4.0.0]#

Install some needed library
Download php from official
source
[root@localhost rar-4.0.0]# php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
rar
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib

[Zend Modules]

[root@localhost rar-4.0.0]#



Install some needed library