2014年7月31日 星期四

[研究] CentOS 7 主要的 MySQL 變成 MariaDB 了

[研究] CentOS 7 主要的 MySQL 變成 MariaDB 了

2014-07-31
2014-08-01 修訂

[root@localhost ~]# yum list | grep mysql
akonadi-mysql.x86_64                       1.9.2-4.el7                 base
apr-util-mysql.x86_64                      1.5.2-6.el7                 base
dovecot-mysql.x86_64                       1:2.2.10-4.el7_0.1          updates
freeradius-mysql.x86_64                    3.0.1-6.el7                 base
libdbi-dbd-mysql.x86_64                    0.8.3-16.el7                base
mysql-connector-java.noarch                1:5.1.25-3.el7              base
mysql-connector-odbc.x86_64                5.2.5-6.el7                 base
php-mysql.x86_64                           5.4.16-21.el7               base
php-mysqlnd.x86_64                         5.4.16-21.el7               base
qt-mysql.i686                              1:4.8.5-8.el7               base
qt-mysql.x86_64                            1:4.8.5-8.el7               base
redland-mysql.x86_64                       1.0.16-6.el7                base
rsyslog-mysql.x86_64                       7.4.7-6.el7                 base
[root@localhost ~]#


[root@localhost ~]# yum search mysql
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror01.idc.hinet.net
 * extras: mirror01.idc.hinet.net
 * updates: mirror01.idc.hinet.net
============================== N/S matched: mysql ==============================
MySQL-python.x86_64 : An interface to MySQL
akonadi-mysql.x86_64 : Akonadi MySQL backend support
apr-util-mysql.x86_64 : APR utility library MySQL DBD driver
dovecot-mysql.x86_64 : MySQL back end for dovecot
freeradius-mysql.x86_64 : MySQL support for freeradius
libdbi-dbd-mysql.x86_64 : MySQL plugin for libdbi
mysql-connector-java.noarch : Official JDBC driver for MySQL
mysql-connector-odbc.x86_64 : ODBC driver for MySQL
perl-DBD-MySQL.x86_64 : A MySQL interface for Perl
php-mysql.x86_64 : A module for PHP applications that use MySQL databases
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
qt-mysql.i686 : MySQL driver for Qt's SQL classes
qt-mysql.x86_64 : MySQL driver for Qt's SQL classes
qt3-MySQL.i686 : MySQL drivers for Qt 3's SQL classes
qt3-MySQL.x86_64 : MySQL drivers for Qt 3's SQL classes
redland-mysql.x86_64 : MySQL storage support for Redland
rsyslog-mysql.x86_64 : MySQL support for rsyslog
mariadb.x86_64 : A community developed branch of MySQL
mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients

  Name and summary matches only, use "search all" for everything.
[root@localhost ~]#

上面,找 MySQL,出現 mariadb

[root@localhost system]# yum list | grep mariadb
mariadb.x86_64                             1:5.5.37-1.el7_0            @updates
mariadb-libs.x86_64                        1:5.5.37-1.el7_0            @updates
mariadb-server.x86_64                      1:5.5.37-1.el7_0            @updates
mariadb-bench.x86_64                       1:5.5.37-1.el7_0            updates
mariadb-devel.i686                         1:5.5.37-1.el7_0            updates
mariadb-devel.x86_64                       1:5.5.37-1.el7_0            updates
mariadb-embedded.i686                      1:5.5.37-1.el7_0            updates
mariadb-embedded.x86_64                    1:5.5.37-1.el7_0            updates
mariadb-embedded-devel.i686                1:5.5.37-1.el7_0            updates
mariadb-embedded-devel.x86_64              1:5.5.37-1.el7_0            updates
mariadb-libs.i686                          1:5.5.37-1.el7_0            updates
mariadb-test.x86_64                        1:5.5.37-1.el7_0            updates
[root@localhost system]#


[root@localhost ~]# yum -y install mysql
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror01.idc.hinet.net
 * extras: mirror01.idc.hinet.net
 * updates: mirror01.idc.hinet.net
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.37-1.el7_0 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.37-1.el7_0 for package: 1:mariadb-5.5.37-1.el7_0.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.35-3.el7 will be updated
---> Package mariadb-libs.x86_64 1:5.5.37-1.el7_0 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch          Version                 Repository      Size
================================================================================
Installing:
 mariadb             x86_64        1:5.5.37-1.el7_0        updates        8.9 M
Updating for dependencies:
 mariadb-libs        x86_64        1:5.5.37-1.el7_0        updates        752 k

Transaction Summary
================================================================================
Install  1 Package
Upgrade             ( 1 Dependent package)

Total size: 9.7 M
Total download size: 8.9 M
Downloading packages:
mariadb-5.5.37-1.el7_0.x86_64.rpm                          | 8.9 MB   00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:mariadb-libs-5.5.37-1.el7_0.x86_64                         1/3
  Installing : 1:mariadb-5.5.37-1.el7_0.x86_64                              2/3
  Cleanup    : 1:mariadb-libs-5.5.35-3.el7.x86_64                           3/3
  Verifying  : 1:mariadb-5.5.37-1.el7_0.x86_64                              1/3
  Verifying  : 1:mariadb-libs-5.5.37-1.el7_0.x86_64                         2/3
  Verifying  : 1:mariadb-libs-5.5.35-3.el7.x86_64                           3/3

Installed:
  mariadb.x86_64 1:5.5.37-1.el7_0

Dependency Updated:
  mariadb-libs.x86_64 1:5.5.37-1.el7_0

Complete!
[root@localhost ~]#


[root@localhost ~]# yum -y install mysql-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror01.idc.hinet.net
 * extras: mirror01.idc.hinet.net
 * updates: mirror01.idc.hinet.net
No package mysql-server available.
Error: Nothing to do
[root@localhost ~]#

[root@localhost ~]# service mysqld restart
Redirecting to /bin/systemctl restart  mysqld.service
Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.
[root@localhost ~]#

[root@localhost ~]# yum -y install mariadb-server

[root@localhost system]# ls -a /usr/lib/systemd/system/mariadb.*
/usr/lib/systemd/system/mariadb.service
[root@localhost system]#

[root@localhost system]# service mariadb service
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@localhost system]#

enable 會在作業系統啟動時,自動啟動服務
[root@localhost system]# systemctl enable  mariadb

start, stop, restart 等參數操作服務,不會有訊息
[root@localhost system]# systemctl start  mariadb

用 status 檢查服務狀態
[root@localhost system]# systemctl status  mariadb
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled)
   Active: active (running) since Thu 2014-07-31 17:16:05 CST; 46s ago
  Process: 15054 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 14975 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 15053 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           â”œâ”€15053 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           â””─15211 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socke...

Jul 31 17:16:03 localhost.localdomain mariadb-prepare-db-dir[14975]: http://dev.mysql.com
Jul 31 17:16:03 localhost.localdomain mariadb-prepare-db-dir[14975]: Support MariaDB development by buying support/new features from
Jul 31 17:16:03 localhost.localdomain mariadb-prepare-db-dir[14975]: SkySQL Ab. You can contact us about this at sales@skysql.com.
Jul 31 17:16:03 localhost.localdomain mariadb-prepare-db-dir[14975]: Alternatively consider joining our community based development effort:
Jul 31 17:16:03 localhost.localdomain mariadb-prepare-db-dir[14975]: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
Jul 31 17:16:03 localhost.localdomain mysqld_safe[15053]: 140731 17:16:03 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jul 31 17:16:03 localhost.localdomain mysqld_safe[15053]: 140731 17:16:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jul 31 17:16:05 localhost.localdomain systemd[1]: Started MariaDB database server.
Jul 31 17:16:39 localhost.localdomain systemd[1]: Started MariaDB database server.
Jul 31 17:16:43 localhost.localdomain systemd[1]: Started MariaDB database server.

[root@localhost system]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.37-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> \q
Bye
[root@localhost system]#

[root@localhost system]# ps aux | grep mariadb
mysql    15451  0.0  5.0 847184 94404 ?        Sl   17:17   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root     15577  0.0  0.0 112640   980 pts/1    R+   17:24   0:00 grep --color=auto mariadb

[root@localhost system]# ps aux | grep mysql
mysql    15293  0.0  0.0 115344  1684 ?        Ss   17:17   0:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql    15451  0.0  5.0 847184 94404 ?        Sl   17:17   0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root     15579  0.0  0.0 112640   976 pts/1    R+   17:24   0:00 grep --color=auto mysql
[root@localhost system]#

設定 資料庫 root 的密碼

[root@localhost ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@localhost ~]#

測試

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.37-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> quit
Bye
[root@localhost ~]#


防火牆相關命令

# firewall-cmd --state
# firewall-cmd --list-all
# firewall-cmd --list-interfaces
# firewall-cmd --get-service
# firewall-cmd --query-service service_name
# firewall-cmd --add-port=8080/tcp

(完)

[研究] fillder (Web Debugger)

[研究] fillder (Web Debugger)

2014-07-31

官方網站
http://www.telerik.com/fiddler


重要功能

Web Debugging
Debug traffic from PC, Mac or Linux systems and mobile devices. Ensure the proper cookies, headers and cache directives are transferred between the client and server. Supports any framework, including .NET, Java, Ruby, etc.

Performance Testing
Fiddler lets you see the “total page weight,” HTTP caching and compression at a glance. Isolate performance bottlenecks with rules like “Flag any uncompressed responses larger than 25kb.”

HTTP/HTTPS Traffic Recording
Fiddler is a free web debugging proxy which logs all HTTP(s) traffic between your computer and the Internet. Use it to debug traffic from virtually any application that supports a proxy like IE, Chrome, Safari, Firefox, Opera and more.

Web Session Manipulation
Easily manipulate and edit web sessions. All you need to do is set a breakpoint to pause the processing of the session and permit alteration of the request/response. You can also compose your own HTTP requests to run through Fiddler.

Security Testing
Use Fiddler for security testing your web applications -- decrypt HTTPS traffic, and display and modify requests using a man-in-the-middle decryption technique. Configure Fiddler to decrypt all traffic, or only specific sessions.

Customizing Fiddler
Benefit from a rich extensibility model, ranging from simple FiddlerScript to powerful Extensions which can be developed using any .NET language.


只是簡單試一下










(完)

[研究] php-pear-Mail 安裝(CentOS 7.0 x86_64)

[研究] php-pear-Mail 安裝(CentOS 7.0 x86_64)

2014-07-31

CentOS 7.0 x64 的 yum 預設沒有 php-pear-Mail 套件

yum list  | grep  php-pear
只看到 php-pear.noarch 而已

[root@localhost ~]# yum list  | grep  php-pear
php-pear.noarch                            1:1.9.4-21.el7              base
[root@localhost ~]#

解決方法:

連上
http://download.fedoraproject.org/pub/epel/
找到目錄
http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/beta/7/x86_64/
網站尋找最新版 epel ,例如
http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

安裝
wget  http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
rpm -Uvh  epel-release-7-0.2.noarch.rpm
yum -y install php-pear-Auth-SASL php-pear-Mail.noarch php-pear-Mail-Mime.noarch php-pear-Net-SMTP.noarch php-pear-Net-Socket.noarch

看看有那些 php-pear 可以安裝

[root@localhost ~]#  yum list  | grep  php-pear
php-pear.noarch                             1:1.9.4-21.el7             base
php-pear-Auth.noarch                        1.6.4-2.el7                epel
php-pear-Auth-RADIUS.noarch                 1.0.7-7.el7                epel
php-pear-Auth-SASL.noarch                   1.0.6-5.el7                epel
php-pear-Auth-radius.noarch                 1.6.4-2.el7                epel
php-pear-Auth-samba.noarch                  1.6.4-2.el7                epel
php-pear-Benchmark.noarch                   1.2.9-5.el7                epel
php-pear-CAS.noarch                         1.3.3-1.el7                epel
php-pear-Cache.noarch                       1.5.6-8.el7                epel
php-pear-Cache-Lite.noarch                  1.7.16-1.el7               epel
php-pear-CodeGen.noarch                     1.0.7-9.el7                epel
php-pear-CodeGen-PECL.noarch                1.1.3-10.el7               epel
php-pear-Console-Color.noarch               1.0.3-7.el7                epel
php-pear-Console-CommandLine.noarch         1.2.0-2.el7                epel
php-pear-Console-Getargs.noarch             1.3.5-9.el7                epel
php-pear-Console-ProgressBar.noarch         0.5.2-0.12.beta.el7        epel
php-pear-Console-Table.noarch               1.1.6-1.el7                epel
php-pear-Crypt-CHAP.noarch                  1.5.0-7.el7                epel
php-pear-DB.noarch                          1.7.14-6.el7               epel
php-pear-DB-DataObject.noarch               1.11.3-1.el7               epel
php-pear-DB-DataObject-FormBuilder.noarch   1.0.2-5.el7                epel
php-pear-DB-QueryTool.noarch                1.1.2-10.el7               epel
php-pear-Date.noarch                        1.4.7-12.el7               epel
php-pear-Date-Holidays.noarch               0.21.8-2.el7               epel
php-pear-Date-Holidays-USA.noarch           0.1.1-11.el7               epel
php-pear-Event-Dispatcher.noarch            1.1.0-8.el7                epel
php-pear-File.noarch                        1.4.1-5.el7                epel
php-pear-File-CSV.noarch                    1.0.0-6.el7                epel
php-pear-File-Find.noarch                   1.3.3-1.el7                epel
php-pear-File-Fstab.noarch                  2.0.3-2.el7                epel
php-pear-File-Passwd.noarch                 1.1.7-8.el7                epel
php-pear-File-SMBPasswd.noarch              1.0.3-8.el7                epel
php-pear-File-Util.noarch                   1.0.0-6.el7                epel
php-pear-HTML-Common.noarch                 1.2.5-8.el7                epel
php-pear-HTML-QuickForm.noarch              3.2.13-5.el7               epel
php-pear-HTML-QuickForm-ElementGrid.noarch  0.1.2-4.el7                epel
php-pear-HTML-QuickForm-advmultiselect.noarch
php-pear-HTML-Table.noarch                  1.8.3-8.el7                epel
php-pear-HTTP.noarch                        1.4.1-12.el7               epel
php-pear-HTTP-Client.noarch                 1.2.1-10.el7               epel
php-pear-HTTP-OAuth.noarch                  0.3.1-1.el7                epel
php-pear-HTTP-Request.noarch                1.4.4-8.el7                epel
php-pear-HTTP-Request2.noarch               2.2.1-1.el7                epel
php-pear-HTTP-Upload.noarch                 0.9.1-11.el7               epel
php-pear-Image-Canvas.noarch                0.3.5-5.el7                epel
php-pear-Image-Color.noarch                 1.0.4-9.el7                epel
php-pear-Image-Graph.noarch                 0.8.0-7.el7                epel
php-pear-Image-GraphViz.noarch              1.3.0-7.el7                epel
php-pear-Image-Text.noarch                  0.7.0-1.el7                epel
php-pear-Log.noarch                         1.12.8-1.el7               epel
php-pear-MDB2.noarch                        2.5.0-0.9.b5.el7           epel
php-pear-MDB2-Driver-mysql.noarch           1.5.0-0.8.b4.el7           epel
php-pear-MDB2-Driver-mysqli.noarch          1.5.0-0.8.b4.el7           epel
php-pear-MDB2-Driver-pgsql.noarch           1.5.0-0.8.b4.el7           epel
php-pear-Mail.noarch                        1.2.0-7.el7                epel
php-pear-Mail-Mime.noarch                   1.8.9-1.el7                epel
php-pear-Mail-mimeDecode.noarch             1.5.5-7.el7                epel
php-pear-Math-Stats.noarch                  0.9.1-12.el7               epel
php-pear-Net-Curl.noarch                    1.2.5-10.el7               epel
php-pear-Net-DIME.noarch                    1.0.2-7.el7                epel
php-pear-Net-DNS.noarch                     1.0.7-5.el7                epel
php-pear-Net-DNS2.noarch                    1.3.2-1.el7                epel
php-pear-Net-FTP.noarch                     1.3.7-12.el7               epel
php-pear-Net-IDNA2.noarch                   0.1.1-10.el7               epel
php-pear-Net-IMAP.noarch                    1.1.3-1.el7                epel
php-pear-Net-IPv4.noarch                    1.3.4-7.el7                epel
php-pear-Net-POP3.noarch                    1.3.8-8.el7                epel
php-pear-Net-Ping.noarch                    2.4.5-9.el7                epel
php-pear-Net-SMTP.noarch                    1.6.2-1.el7                epel
php-pear-Net-Sieve.noarch                   1.3.2-6.el7                epel
php-pear-Net-Socket.noarch                  1.0.14-1.el7               epel
php-pear-Net-Traceroute.noarch              0.21.3-7.el7               epel
php-pear-Net-URL.noarch                     1.0.15-10.el7              epel
php-pear-Net-URL-Mapper.noarch              0.9.1-12.el7               epel
php-pear-Net-URL2.noarch                    2.0.6-1.el7                epel
php-pear-Net-UserAgent-Detect.noarch        2.5.2-7.el7                epel
php-pear-Numbers-Roman.noarch               1.0.2-15.el7               epel
php-pear-Numbers-Words.noarch               0.16.4-5.el7               epel
php-pear-PEAR-Command-Packaging.noarch      0.3.0-7.el7                epel
php-pear-Pager.noarch                       2.4.9-1.el7                epel
php-pear-Payment-Process.noarch             0.6.8-3.el7                epel
php-pear-SOAP.noarch                        0.13.0-5.el7               epel
php-pear-Services-Twitter.noarch            0.6.3-8.el7                epel
php-pear-Services-Weather.noarch            1.4.7-2.el7                epel
php-pear-Structures-DataGrid.noarch         0.9.3-4.el7                epel
php-pear-Structures-DataGrid-DataSource-Array.noarch
php-pear-Structures-DataGrid-DataSource-DataObject.noarch
php-pear-Structures-DataGrid-DataSource-MDB2.noarch
php-pear-Structures-DataGrid-DataSource-RSS.noarch
php-pear-Structures-DataGrid-Renderer-Pager.noarch
php-pear-Structures-DataGrid-Renderer-Smarty.noarch
php-pear-Text-CAPTCHA.noarch                1.0.1-1.el7                epel
php-pear-Text-Figlet.noarch                 1.0.2-2.el7                epel
php-pear-Text-Password.noarch               1.1.1-2.el7                epel
php-pear-Validate.noarch                    0.8.5-6.el7                epel
php-pear-Validate-Finance-CreditCard.noarch 0.5.3-11.el7               epel
php-pear-Var-Dump.noarch                    1.0.4-9.el7                epel
php-pear-XML-Beautifier.noarch              1.2.2-8.el7                epel
php-pear-XML-Parser.noarch                  1.3.4-10.el7               epel
php-pear-XML-RPC.noarch                     1.5.5-4.el7                epel
php-pear-XML-RPC2.noarch                    1.1.2-1.el7                epel
php-pear-XML-RSS.noarch                     1.0.2-10.el7               epel
php-pear-XML-SVG.noarch                     1.1.0-3.el7                epel
php-pear-XML-Serializer.noarch              0.20.2-12.el7              epel
php-pear-console-color2.noarch              0.1.2-2.el7                epel
php-pear-phing.noarch                       2.6.1-1.el7                epel
php-pear-text-wiki.noarch                   1.2.1-3.el7                epel
[root@localhost ~]#

檢查

[root@localhost ~]# yum list | grep php-pear-Mail
php-pear-Mail.noarch                        1.2.0-7.el7                @epel
php-pear-Mail-Mime.noarch                   1.8.9-1.el7                @epel
php-pear-Mail-mimeDecode.noarch             1.5.5-7.el7                epel
[root@localhost ~]#

(完)

[研究] php-pear-Mail 安裝(CentOS 7.0 x86_64)
http://shaurong.blogspot.com/2014/07/php-pear-mail-centos-70-x8664.html

[研究] php-pear-Mail 安裝(CentOS 6.3 x86)
http://shaurong.blogspot.tw/2013/02/php-pear-mail-centos-63-x86.html

[研究] php-pear-Mail 安裝(CentOS 6.2 x86)
http://shaurong.blogspot.tw/2012/05/centos-62-php-pear-mail.html

[研究] NMAP 6.40 (CentOS 7.0 x86_64)

[研究] NMAP 6.40 (CentOS 7.0 x86_64)

2014-07-31

官方網站
http://nmap.org/

Nmap 是網路掃描、探測工具(支援 Windows, Mac, Linux),這次只是想大略試一下試怎樣的東西,沒有要深入研究。

安裝環境:CentOS 7.0 x64

看有些甚麼相關 NMAP 的套件 ( 好像沒有 GUI版的 zenmap)

[root@localhost bin]# yum search nmap
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror01.idc.hinet.net
 * extras: mirror01.idc.hinet.net
 * updates: mirror01.idc.hinet.net
============================== N/S matched: nmap ===============================
nmap-frontend.noarch : The GTK+ front end for nmap
nmap-ncat.x86_64 : Nmap's Netcat replacement
nmap.x86_64 : Network exploration tool and security scanner

  Name and summary matches only, use "search all" for everything.
[root@localhost bin]#

安裝

[root@localhost ~]# yum -y install  nmap

[root@localhost ~]# yum list | grep nmap
nmap.x86_64                                2:6.40-4.el7                @base
nmap-ncat.x86_64                           2:6.40-4.el7                @anaconda
nmap-frontend.noarch                       2:6.40-4.el7                base
[root@localhost ~]#

測試一下

[root@localhost ~]# nmap
Nmap 6.40 ( http://nmap.org )
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION:
  Can pass hostnames, IP addresses, networks, etc.
  Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
  -iL <inputfilename>: Input from list of hosts/networks
  -iR <num hosts>: Choose random targets
  --exclude <host1[,host2][,host3],...>: Exclude hosts/networks
  --excludefile <exclude_file>: Exclude list from file
HOST DISCOVERY:
  -sL: List Scan - simply list targets to scan
  -sn: Ping Scan - disable port scan
  -Pn: Treat all hosts as online -- skip host discovery
  -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
  -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
  -PO[protocol list]: IP Protocol Ping
  -n/-R: Never do DNS resolution/Always resolve [default: sometimes]
  --dns-servers <serv1[,serv2],...>: Specify custom DNS servers
  --system-dns: Use OS's DNS resolver
  --traceroute: Trace hop path to each host
SCAN TECHNIQUES:
  -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
  -sU: UDP Scan
  -sN/sF/sX: TCP Null, FIN, and Xmas scans
  --scanflags <flags>: Customize TCP scan flags
  -sI <zombie host[:probeport]>: Idle scan
  -sY/sZ: SCTP INIT/COOKIE-ECHO scans
  -sO: IP protocol scan
  -b <FTP relay host>: FTP bounce scan
PORT SPECIFICATION AND SCAN ORDER:
  -p <port ranges>: Only scan specified ports
    Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
  -F: Fast mode - Scan fewer ports than the default scan
  -r: Scan ports consecutively - don't randomize
  --top-ports <number>: Scan <number> most common ports
  --port-ratio <ratio>: Scan ports more common than <ratio>
SERVICE/VERSION DETECTION:
  -sV: Probe open ports to determine service/version info
  --version-intensity <level>: Set from 0 (light) to 9 (try all probes)
  --version-light: Limit to most likely probes (intensity 2)
  --version-all: Try every single probe (intensity 9)
  --version-trace: Show detailed version scan activity (for debugging)
SCRIPT SCAN:
  -sC: equivalent to --script=default
  --script=<Lua scripts>: <Lua scripts> is a comma separated list of
           directories, script-files or script-categories
  --script-args=<n1=v1,[n2=v2,...]>: provide arguments to scripts
  --script-args-file=filename: provide NSE script args in a file
  --script-trace: Show all data sent and received
  --script-updatedb: Update the script database.
  --script-help=<Lua scripts>: Show help about scripts.
           <Lua scripts> is a comma separted list of script-files or
           script-categories.
OS DETECTION:
  -O: Enable OS detection
  --osscan-limit: Limit OS detection to promising targets
  --osscan-guess: Guess OS more aggressively
TIMING AND PERFORMANCE:
  Options which take <time> are in seconds, or append 'ms' (milliseconds),
  's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m).
  -T<0-5>: Set timing template (higher is faster)
  --min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes
  --min-parallelism/max-parallelism <numprobes>: Probe parallelization
  --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies
      probe round trip time.
  --max-retries <tries>: Caps number of port scan probe retransmissions.
  --host-timeout <time>: Give up on target after this long
  --scan-delay/--max-scan-delay <time>: Adjust delay between probes
  --min-rate <number>: Send packets no slower than <number> per second
  --max-rate <number>: Send packets no faster than <number> per second
FIREWALL/IDS EVASION AND SPOOFING:
  -f; --mtu <val>: fragment packets (optionally w/given MTU)
  -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys
  -S <IP_Address>: Spoof source address
  -e <iface>: Use specified interface
  -g/--source-port <portnum>: Use given port number
  --data-length <num>: Append random data to sent packets
  --ip-options <options>: Send packets with specified ip options
  --ttl <val>: Set IP time-to-live field
  --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address
  --badsum: Send packets with a bogus TCP/UDP/SCTP checksum
OUTPUT:
  -oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3,
     and Grepable format, respectively, to the given filename.
  -oA <basename>: Output in the three major formats at once
  -v: Increase verbosity level (use -vv or more for greater effect)
  -d: Increase debugging level (use -dd or more for greater effect)
  --reason: Display the reason a port is in a particular state
  --open: Only show open (or possibly open) ports
  --packet-trace: Show all packets sent and received
  --iflist: Print host interfaces and routes (for debugging)
  --log-errors: Log errors/warnings to the normal-format output file
  --append-output: Append to rather than clobber specified output files
  --resume <filename>: Resume an aborted scan
  --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML
  --webxml: Reference stylesheet from Nmap.Org for more portable XML
  --no-stylesheet: Prevent associating of XSL stylesheet w/XML output
MISC:
  -6: Enable IPv6 scanning
  -A: Enable OS detection, version detection, script scanning, and traceroute
  --datadir <dirname>: Specify custom Nmap data file location
  --send-eth/--send-ip: Send using raw ethernet frames or IP packets
  --privileged: Assume that the user is fully privileged
  --unprivileged: Assume the user lacks raw socket privileges
  -V: Print version number
  -h: Print this help summary page.
EXAMPLES:
  nmap -v -A scanme.nmap.org
  nmap -v -sn 192.168.0.0/16 10.0.0.0/8
  nmap -v -iR 10000 -Pn -p 80
SEE THE MAN PAGE (http://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES
[root@localhost ~]#


[root@localhost ~]# nmap localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2014-07-31 14:05 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000073s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 996 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
25/tcp  open  smtp
111/tcp open  rpcbind
631/tcp open  ipp

Nmap done: 1 IP address (1 host up) scanned in 89.85 seconds
[root@localhost ~]#

[root@localhost ~]# nmap 10.3.74.101

Starting Nmap 6.40 ( http://nmap.org ) at 2014-07-31 14:07 CST
Nmap scan report for 10.3.74.101
Host is up (0.00014s latency).
Not shown: 995 filtered ports
PORT     STATE SERVICE
80/tcp   open  http
135/tcp  open  msrpc
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
3389/tcp open  ms-wbt-server

Nmap done: 1 IP address (1 host up) scanned in 148.92 seconds
[root@localhost ~]#

(完)

[研究] NMAP 6.46 安裝 (nmap-6.46-setup.exe) (Windows 7 x64)

[研究] NMAP 6.46 安裝 (nmap-6.46-setup.exe) (Windows 7 x64)

2014-07-31

官方網站
http://nmap.org/

Nmap 是網路掃描、探測工具(支援 Windows, Mac, Linux),這次下載測試  nmap-6.46-setup.exe,只是想大略試一下試怎樣的東西,沒有要深入研究。

安裝環境:Windows 7 x64




(下圖) 軟體看來是 x86 版


(下圖) 但是包含 WinPcap x64 driver



(下圖) NMAP 安裝 VC++ 2008 可轉發套件失敗,不知最後可否使用

Microsoft Visual C++ 2008 SP1 可轉散發套件 (x64)
http://www.microsoft.com/zh-tw/download/details.aspx?id=2092
查了一下,只支援 Windows XP, Windows Server 2003, Windows Vista , Windows Server 2008,沒有支援 Windows 7 或更新












似乎還能用。

(下圖) 程式結束後,說 log 無法寫入,仍是有點問題。


(完)

[研究] systeminfo.exe 指令

[研究] systeminfo.exe 指令

2014-07-31

這是從 Windows XP 開始提供的命令,下面是在 Windows Server 2012 R2 上測試的畫面。







(完)

2014年7月25日 星期五

[研究] CentOS 7.0 x64 安裝 VMware Tools 9.6.2 (on VMware Workstation 10.0.3)

[研究] CentOS 7.0 x64 安裝 VMware Tools 9.6.2 (on VMware Workstation 10.0.3)

2014-07-25

軟體
VMware Workstation 10.0.3 for MS-Windows
VM 上安裝  CentOS-7.0-1406-x86_64-DVD.iso
安裝 VMwareTools-9.6.2-1688356.tar.gz

(下圖) 安裝完 CentOS 後,要安裝 VMware Tools 時,發現根本已經安裝了。




(完)

相關

[研究] CentOS 7.0 x64 安裝 VMware Tools 9.6.2 (on VMware Workstation 10.0.3)
http://shaurong.blogspot.com/2014/07/centos-70-x64-vmware-tools-962.html

[研究] Ubuntu 14.04 Desktop x64 安裝 VMware Tools 9.6.2 (失敗)
http://shaurong.blogspot.tw/2014/07/ubuntu-1404-desktop-x64-vmware-tools-962.html

[研究] Ubuntu 14.04 Desktop x64 安裝 VMware Tools 8.0.3
http://shaurong.blogspot.tw/2012/05/ubuntu-1204-desktop-x86-vmware-tools.html

[研究] Fedora 20 x86_64 安裝 vSphere 5.1 VMware Tools 9.0.5
http://shaurong.blogspot.tw/2013/12/fedora-20-x8664-vsphere-51-vmware-tools.html

[研究] Ubuntu 14.04 Desktop x64 安裝 VMware Tools 9.6.2

[研究] Ubuntu 14.04 Desktop x64 安裝 VMware Tools 9.6.2

2014-07-25
2014-07-28 修訂

軟體
VMware Workstation 10.0.3 for MS-Windows
VM 上安裝  ubuntu-14.04-desktop-amd64.iso
安裝 VMwareTools-9.6.2-1688356.tar.gz

(下圖) Ubuntu 14.04 的 kernel 目前為 3.13  (實際上 kernel 出到 3.14 )

(下圖) 更新 apt-get 套件清單

(下圖) 檢查發現 apt-get 目前只能把 kernel 更新到 3.13.0

(下圖) 掛上 VMware Tools

(下圖) double click  "vmware-tools-upgrader-64" 沒反應

(下圖)   "vmware-tools-upgrader-64" 按下滑鼠右鍵選 Run 也沒反應


(下圖) 直接執行 "vmware-tools-upgrader-64" ,可以看到失敗狀況






**********************
找到正確方法 (注意,光碟掛載目錄要先用 mount 指令看一下,大家可能不同)

cp  /media/lu/VMware \Tools/VMwareTools-9.6.2-1688356.tar.gz   /tmp/.
cd   /tmp

tar  zxvf   VMwareTools-9.6.2-1688356.tar.gz
cd  vmware-tools-distrib
sudo  su  -c  "./vmware-install.pl"
/usr/bin/vmware-user



(完)

相關

[研究] Ubuntu 14.04 Desktop x64 安裝 VMware Tools 8.0.3
http://shaurong.blogspot.tw/2012/05/ubuntu-1204-desktop-x86-vmware-tools.html

[研究] Fedora 20 x86_64 安裝 vSphere 5.1 VMware Tools 9.0.5
http://shaurong.blogspot.tw/2013/12/fedora-20-x8664-vsphere-51-vmware-tools.html

[研究] CentOS 7.0 x64 的 iptables 與 firewall-cmd 防火牆

[研究] CentOS 7.0 x64 的 iptables 與 firewall-cmd 防火牆

2014-07-25
2014-08-01 修訂

CentOS 7.0 開始,服務的管理使用變成用 systemctl,例如 httpd 的使用可用下面幾種方式

# systemctl status|start|stop|restart|reload httpd
OR 
# service httpd status|start|stop|restart|reload
OR 
# apachectl configtest| graceful

service httpd 會自動重導指令到 systemctl 命令,問題不大。

但是防火牆就有問題了,因為架網站時本機測試正常,遠端關了防火牆卻仍連不上,所以做了點研究測試。

[root@localhost ~]# yum -y install httpd
[root@localhost ~]# service httpd restart
Redirecting to /bin/systemctl restart  httpd.service
[root@localhost ~]# service httpd status
Redirecting to /bin/systemctl status  httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: active (running) since Fri 2014-07-25 15:54:58 CST; 21s ago
 Main PID: 14250 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ?   ? 14250 /usr/sbin/httpd -DFOREGROUND
           ?   ? 14251 /usr/sbin/httpd -DFOREGROUND
           ?   ? 14252 /usr/sbin/httpd -DFOREGROUND
           ?   ? 14253 /usr/sbin/httpd -DFOREGROUND
           ?   ? 14254 /usr/sbin/httpd -DFOREGROUND
           ?   ? 14255 /usr/sbin/httpd -DFOREGROUND

Jul 25 15:54:58 localhost.localdomain systemd[1]: Starting The Apache HTTP Se...
Jul 25 15:54:58 localhost.localdomain httpd[14250]: AH00558: httpd: Could not...
Jul 25 15:54:58 localhost.localdomain systemd[1]: Started The Apache HTTP Ser...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# ps aux | grep httpd
root     14250  0.0  0.2 209484  4804 ?        Ss   15:54   0:00 /usr/sbin/http  -DFOREGROUND
apache   14251  0.0  0.1 211568  2968 ?        S    15:54   0:00 /usr/sbin/http  -DFOREGROUND
apache   14252  0.0  0.1 211568  2968 ?        S    15:54   0:00 /usr/sbin/http  -DFOREGROUND
apache   14253  0.0  0.1 211568  2968 ?        S    15:54   0:00 /usr/sbin/http  -DFOREGROUND
apache   14254  0.0  0.1 211568  2968 ?        S    15:54   0:00 /usr/sbin/http  -DFOREGROUND
apache   14255  0.0  0.1 211568  2968 ?        S    15:54   0:00 /usr/sbin/http  -DFOREGROUND
root     14276  0.0  0.0 112640   980 pts/1    R+   15:55   0:00 grep --color=auto httpd
[root@localhost ~]#

[root@localhost ~]# service iptables stop
Redirecting to /bin/systemctl stop  iptables.service

(下圖) 本機上測試正常

(下圖) 遠端去連失敗

檢查防火牆狀態,是 inactive 的

[root@localhost ~]# service iptables -L
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

[root@localhost ~]# service iptables status
Redirecting to /bin/systemctl status  iptables.service
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
   Active: inactive (dead)

Jul 25 15:56:53 localhost.localdomain systemd[1]: Stopped IPv4 firewall with ...
Hint: Some lines were ellipsized, use -l to show in full.

列出防火牆  rules,居然仍有

[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
INPUT_direct  all  --  anywhere             anywhere
INPUT_ZONES_SOURCE  all  --  anywhere             anywhere
INPUT_ZONES  all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
FORWARD_direct  all  --  anywhere             anywhere
FORWARD_IN_ZONES_SOURCE  all  --  anywhere             anywhere
FORWARD_IN_ZONES  all  --  anywhere             anywhere
FORWARD_OUT_ZONES_SOURCE  all  --  anywhere             anywhere
FORWARD_OUT_ZONES  all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
OUTPUT_direct  all  --  anywhere             anywhere

Chain FORWARD_IN_ZONES (1 references)
target     prot opt source               destination
FWDI_public  all  --  anywhere             anywhere            [goto]
FWDI_public  all  --  anywhere             anywhere            [goto]

Chain FORWARD_IN_ZONES_SOURCE (1 references)
target     prot opt source               destination

Chain FORWARD_OUT_ZONES (1 references)
target     prot opt source               destination
FWDO_public  all  --  anywhere             anywhere            [goto]
FWDO_public  all  --  anywhere             anywhere            [goto]

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target     prot opt source               destination

Chain FORWARD_direct (1 references)
target     prot opt source               destination

Chain FWDI_public (2 references)
target     prot opt source               destination
FWDI_public_log  all  --  anywhere             anywhere
FWDI_public_deny  all  --  anywhere             anywhere
FWDI_public_allow  all  --  anywhere             anywhere

Chain FWDI_public_allow (1 references)
target     prot opt source               destination

Chain FWDI_public_deny (1 references)
target     prot opt source               destination

Chain FWDI_public_log (1 references)
target     prot opt source               destination

Chain FWDO_public (2 references)
target     prot opt source               destination
FWDO_public_log  all  --  anywhere             anywhere
FWDO_public_deny  all  --  anywhere             anywhere
FWDO_public_allow  all  --  anywhere             anywhere

Chain FWDO_public_allow (1 references)
target     prot opt source               destination

Chain FWDO_public_deny (1 references)
target     prot opt source               destination

Chain FWDO_public_log (1 references)
target     prot opt source               destination

Chain INPUT_ZONES (1 references)
target     prot opt source               destination
IN_public  all  --  anywhere             anywhere            [goto]
IN_public  all  --  anywhere             anywhere            [goto]

Chain INPUT_ZONES_SOURCE (1 references)
target     prot opt source               destination

Chain INPUT_direct (1 references)
target     prot opt source               destination

Chain IN_public (2 references)
target     prot opt source               destination
IN_public_log  all  --  anywhere             anywhere
IN_public_deny  all  --  anywhere             anywhere
IN_public_allow  all  --  anywhere             anywhere

Chain IN_public_allow (1 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh ctstate NEW

Chain IN_public_deny (1 references)
target     prot opt source               destination

Chain IN_public_log (1 references)
target     prot opt source               destination

Chain OUTPUT_direct (1 references)
target     prot opt source               destination
[root@localhost ~]#

經過研究發現,應該要改用 firewall-cmd 命令

要暫時開放 http port,可執行
# firewall-cmd --add-service=http

要永久開放 http port,可執行
# firewall-cmd --permanent --add-service=http
# systemctl restart firewalld

要停掉
[root@localhost ~]# systemctl stop firewalld

下面確認一下,真的停掉了

[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[root@localhost ~]#

(下圖) 再從遠端連上網站看看,成功了

也就是 service iptables stop 無法停掉防火牆了 ( 看下面訊息該有支援,Bug 嗎 ?)

[root@localhost ~]# service iptables
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

設定 httpd 隨作業系統啟動
systemctl enable  httpd

其他常用 firewall-cmd 命令

# firewall-cmd --state
# firewall-cmd --list-all
# firewall-cmd --list-interfaces
# firewall-cmd --get-service
# firewall-cmd --query-service service_name
# firewall-cmd --add-port=8080/tcp

(完)

相關

[研究] CentOS 7.0 x64 的網站架設與防火牆
http://shaurong.blogspot.tw/2014/07/centos-linux-701406.html

Installing LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin) in RHEL/CentOS 7.0
http://www.tecmint.com/install-lamp-in-centos-7/